Enable metric recording.

This commit is contained in:
yohan 2024-06-09 23:21:10 +02:00
parent 741eec436b
commit 58c742c625

View File

@ -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))