Envoie maintenant le nombre d'urls en attentes de http_post dans Grafana

This commit is contained in:
Christian Zufferey
2020-06-07 16:35:14 +02:00
parent 048174d44a
commit 8784c7dc7e
3 changed files with 7 additions and 4 deletions

View File

@@ -1,13 +1,15 @@
-- Petit script pour faire office de crontab pour les mesures
print("\n 0_cron.lua zf200604.1313 \n")
print("\n 0_cron.lua zf200604.1629 \n")
cron1=tmr.create()
cron1:alarm(10*1000, tmr.ALARM_AUTO, function()
if verbose then print("cron1........................") end
if verbose then gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH) end
-- http_post(influxdb_url,"energy,value=test1_"..yellow_id.." val=1")
http_post(influxdb_url,"energy,memory=cron1_"..yellow_id.." ram="..node.heap())
http_post(influxdb_url,"energy,compteur=3 puissance="..zpower/1000)
-- http_post(influxdb_url,"energy,value=test2_"..yellow_id.." val=2")
-- f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end

View File

@@ -1,7 +1,7 @@
-- Petit script pour envoyer en // es valeurs sur un serveur WEB (InfluxDB)
-- via un http POST à travers un FIFO
if verbose then print("\n 0_http_post.lua zf200606.1334 \n") end
if verbose then print("\n 0_http_post.lua zf200607.1611 \n") end
t_zurl={} t_zarg={} f_zpost=false
@@ -11,6 +11,7 @@ end
function zpost()
f_zpost=true zurl=t_zurl[1] zarg=t_zarg[1]
zarg=zarg.."\n".."energy,value=nb_waiting_"..yellow_id.." val="..#t_zurl
if verbose then print("zurl: "..zurl) end if verbose then print("zarg: "..zarg) end
http.post(zurl, 'Content-Type: application/x-www-form-urlencoded\r\n', zarg, function(code, data)

View File

@@ -1,6 +1,6 @@
-- Scripts à charger après le boot pour démarrer son projet
print("\n boot.lua zf200607.1549 \n")
print("\n boot.lua zf200607.1625 \n")
-- function ztime_stamp() return tmr.now()/1000000 end
@@ -14,7 +14,7 @@ function boot()
_, boot_reason = node.bootreason()
zarg_boot= "energy,memory=boot_"..yellow_id.." ram="..node.heap().."\n"
zarg_boot=zarg_boot.."energy,boot=boot_reason_"..yellow_id.." err="..boot_reason
zarg_boot=zarg_boot.."energy,value=boot_reason_"..yellow_id.." val="..boot_reason
http_post(influxdb_url,zarg_boot)
boot_reason = nil