|
@@ -30,6 +30,7 @@ def init_db():
|
|
influxdb_client.switch_database(DB_DATABASE)
|
|
influxdb_client.switch_database(DB_DATABASE)
|
|
print('{} - Switched to database {}'.format(datetime.datetime.now(), DB_DATABASE))
|
|
print('{} - Switched to database {}'.format(datetime.datetime.now(), DB_DATABASE))
|
|
|
|
|
|
|
|
+
|
|
def get_data_for_influxdb():
|
|
def get_data_for_influxdb():
|
|
influx_data = [
|
|
influx_data = [
|
|
{
|
|
{
|
|
@@ -59,6 +60,14 @@ def get_data_for_influxdb():
|
|
'unique_clients': int(pihole.unique_clients.replace(',','')),
|
|
'unique_clients': int(pihole.unique_clients.replace(',','')),
|
|
'total_queries': int(pihole.total_queries.replace(',',''))
|
|
'total_queries': int(pihole.total_queries.replace(',',''))
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ 'measurement': 'other',
|
|
|
|
+ 'time': datetime.datetime.now(),
|
|
|
|
+ 'fields': {
|
|
|
|
+ 'status': True if pihole.status == 'enabled' else False,
|
|
|
|
+ 'gravity_last_update': pihole.gravity_last_updated['absolute']
|
|
|
|
+ }
|
|
}
|
|
}
|
|
]
|
|
]
|
|
|
|
|