From 58c742c625346212c99982a1d9d32846f4bc2b60 Mon Sep 17 00:00:00 2001 From: yohan <783b8c87@scimetis.net> Date: Sun, 9 Jun 2024 23:21:10 +0200 Subject: [PATCH] Enable metric recording. --- sensors-polling.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sensors-polling.py b/sensors-polling.py index b94f7f8..0427a9e 100755 --- a/sensors-polling.py +++ b/sensors-polling.py @@ -132,14 +132,14 @@ def sensors_polling(poller_conf): try: for metric in poller_conf['metrics']: logger.debug('Posting data for '+metric['name']) - #r = s.post(post_url[metric['type']], - # headers={'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0', - # 'X-API-KEY': recording_api_key}, - # json={'metric': metric['name'], - # 'value': last_data[metric['name']]['value'], - # 'time': utc_now.isoformat()}) - #if r.status_code != 201: - # logger.error(str(r.status_code)+" "+r.reason) + r = s.post(post_url[metric['type']], + headers={'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0', + 'X-API-KEY': recording_api_key}, + json={'metric': metric['name'], + 'value': last_data[metric['name']]['value'], + 'time': utc_now.isoformat()}) + if r.status_code != 201: + logger.error(str(r.status_code)+" "+r.reason) # It has to be current_time variable so the interval check works correctly last_recording_time=current_time logger.debug('last_recording_time: '+str(last_recording_time))