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