Add more metrics

This commit is contained in:
Vitaliy Skrypnyk
2020-07-28 19:36:35 +03:00
committed by Vitaliy Skrypnyk
parent 9f0a28896b
commit 2fcb3b1ce8
2 changed files with 46 additions and 1 deletions

View File

@@ -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"
}
}
]
}

View File

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