mirror of
https://github.com/kemko/keenetic-grafana-monitoring.git
synced 2026-01-01 15:45:43 +03:00
Add interfaces
This commit is contained in:
committed by
Vitaliy Skrypnyk
parent
ab8426f893
commit
9f0a28896b
17
config.json
17
config.json
@@ -43,6 +43,23 @@
|
|||||||
"speed": "$.speed"
|
"speed": "$.speed"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "interface",
|
||||||
|
"root" : "$.*",
|
||||||
|
"tags" : {
|
||||||
|
"id": "$.id",
|
||||||
|
"type": "$.type",
|
||||||
|
"description": "$.description",
|
||||||
|
"interface-name": "$.interface-name",
|
||||||
|
"state": "$.state",
|
||||||
|
"address": "$.address"
|
||||||
|
},
|
||||||
|
"values" : {
|
||||||
|
"mtu": "$.mtu",
|
||||||
|
"uptime": "$.uptime",
|
||||||
|
"tx-queue": "$.tx-queue"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "ip nat",
|
"command": "ip nat",
|
||||||
"root" : "$.[*]",
|
"root" : "$.[*]",
|
||||||
|
|||||||
@@ -44,12 +44,15 @@ class KeeneticCollector(object):
|
|||||||
|
|
||||||
for tagName, tagPath in self._tags.items():
|
for tagName, tagPath in self._tags.items():
|
||||||
if tagPath == '~':
|
if tagPath == '~':
|
||||||
tags[tagName] = str(root.path.fields[0])
|
tags[tagName] = root.path.fields[0]
|
||||||
else:
|
else:
|
||||||
tags[tagName] = str(self.get_first_value(tagPath.find(root.value)))
|
tags[tagName] = self.get_first_value(tagPath.find(root.value))
|
||||||
|
|
||||||
for valueName, valuePath in self._values.items():
|
for valueName, valuePath in self._values.items():
|
||||||
values[valueName] = normalize_value(self.get_first_value(valuePath.find(root.value)))
|
value = self.get_first_value(valuePath.find(root.value))
|
||||||
|
if value is not None: values[valueName] = normalize_value(value)
|
||||||
|
|
||||||
|
if values.__len__() == 0: continue
|
||||||
|
|
||||||
metric = self.create_metric(self._command, tags, values)
|
metric = self.create_metric(self._command, tags, values)
|
||||||
metrics.append(metric)
|
metrics.append(metric)
|
||||||
|
|||||||
Reference in New Issue
Block a user