mirror of
https://github.com/kemko/keenetic-grafana-monitoring.git
synced 2026-01-01 15:45:43 +03:00
Add more metrics
This commit is contained in:
committed by
Vitaliy Skrypnyk
parent
9f0a28896b
commit
2fcb3b1ce8
42
config.json
42
config.json
@@ -71,6 +71,48 @@
|
||||
"bytes-in": "$.bytes",
|
||||
"bytes-out": "$.bytes-out"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command": "system",
|
||||
"root" : "$",
|
||||
"tags" : {
|
||||
"hostname" : "$.hostname"
|
||||
},
|
||||
"values" : {
|
||||
"cpuload": "$.cpuload",
|
||||
"memtotal": "$.memtotal",
|
||||
"memfree": "$.memfree",
|
||||
"memcache": "$.memcache",
|
||||
"swaptotal": "$.swaptotal",
|
||||
"swapfree": "$.swapfree",
|
||||
"uptime": "$.uptime",
|
||||
"membuffers": "$.membuffers"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command": "internet status",
|
||||
"root" : "$",
|
||||
"tags" : {},
|
||||
"values" : {
|
||||
"internet": "$.internet",
|
||||
"gateway-accessible": "$.gateway-accessible",
|
||||
"dns-accessible": "$.dns-accessible",
|
||||
"host-accessible": "$.host-accessible",
|
||||
"captive-accessible": "$.captive-accessible"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command": "media",
|
||||
"root" : "$.*.partition.[*]",
|
||||
"tags" : {
|
||||
"label" : "$.label",
|
||||
"uuid" : "$.uuid",
|
||||
"state" : "$.state"
|
||||
},
|
||||
"values" : {
|
||||
"total": "$.total",
|
||||
"free": "$.free"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -37,6 +37,7 @@ class KeeneticCollector(object):
|
||||
|
||||
roots = self._root.find(response)
|
||||
metrics = []
|
||||
start_time = time.time_ns()
|
||||
|
||||
for root in roots:
|
||||
tags = {}
|
||||
@@ -56,7 +57,9 @@ class KeeneticCollector(object):
|
||||
|
||||
metric = self.create_metric(self._command, tags, values)
|
||||
metrics.append(metric)
|
||||
print(json.dumps(metric))
|
||||
|
||||
metrics.append( self.create_metric( "collector", { "command" : self._command }, { "duration" : (time.time_ns() - start_time) } ) )
|
||||
# print(json.dumps(metrics))
|
||||
|
||||
infuxdb_writter.write_metrics(metrics)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user