From 8784c7dc7e983310f0f7e7c0413b93aeac8d87f0 Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Sun, 7 Jun 2020 16:35:14 +0200 Subject: [PATCH] Envoie maintenant le nombre d'urls en attentes de http_post dans Grafana --- Mesures/energy/transfo_courant_clip_1p_1/0_cron.lua | 4 +++- Mesures/energy/transfo_courant_clip_1p_1/0_http_post.lua | 3 ++- Mesures/energy/transfo_courant_clip_1p_1/boot.lua | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Mesures/energy/transfo_courant_clip_1p_1/0_cron.lua b/Mesures/energy/transfo_courant_clip_1p_1/0_cron.lua index bfbbf8c..24bdd8a 100644 --- a/Mesures/energy/transfo_courant_clip_1p_1/0_cron.lua +++ b/Mesures/energy/transfo_courant_clip_1p_1/0_cron.lua @@ -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 diff --git a/Mesures/energy/transfo_courant_clip_1p_1/0_http_post.lua b/Mesures/energy/transfo_courant_clip_1p_1/0_http_post.lua index 16ea55d..ea3fc2f 100644 --- a/Mesures/energy/transfo_courant_clip_1p_1/0_http_post.lua +++ b/Mesures/energy/transfo_courant_clip_1p_1/0_http_post.lua @@ -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) diff --git a/Mesures/energy/transfo_courant_clip_1p_1/boot.lua b/Mesures/energy/transfo_courant_clip_1p_1/boot.lua index 045bf51..fd0d0a9 100644 --- a/Mesures/energy/transfo_courant_clip_1p_1/boot.lua +++ b/Mesures/energy/transfo_courant_clip_1p_1/boot.lua @@ -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