mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-07 14:18:05 +00:00
give custom datapoint to influx
Signed-off-by: lanforge <stidmatt@gmail.com>
This commit is contained in:
@@ -33,7 +33,7 @@ class RecordInflux(LFCliBase):
|
||||
self.influx_passwd = _influx_passwd
|
||||
self.influx_db = _influx_db
|
||||
|
||||
def posttoinflux(self,station,key,response,client):
|
||||
def posttoinflux(self,station,key,value,client):
|
||||
json_body = [
|
||||
{
|
||||
"measurement": station + ' ' + key,
|
||||
@@ -43,7 +43,7 @@ class RecordInflux(LFCliBase):
|
||||
},
|
||||
"time": str(datetime.datetime.utcnow().isoformat()),
|
||||
"fields": {
|
||||
"value": response['interface'][key]
|
||||
"value": value
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -67,11 +67,11 @@ class RecordInflux(LFCliBase):
|
||||
response = json.loads(requests.get(url1).text)
|
||||
if target_kpi is None:
|
||||
for key in response['interface'].keys():
|
||||
self.posttoinflux(station, key, response, client)
|
||||
self.posttoinflux(station, key, response['interface'][key], client)
|
||||
else:
|
||||
targets = target_kpi+['ip','ipv6 address','alias','mac']
|
||||
response['interface']={your_key: response['interface'][your_key] for your_key in targets}
|
||||
for key in response['interface'].keys():
|
||||
self.posttoinflux(station, key, response, client)
|
||||
self.posttoinflux(station, key, response['interface'][key], client)
|
||||
|
||||
time.sleep(monitor_interval)
|
||||
time.sleep(monitor_interval)
|
||||
Reference in New Issue
Block a user