From 56f8f65d83057d8b3d84d4603eb4a91a69cfbc2e Mon Sep 17 00:00:00 2001 From: Vitaliy Skrypnyk Date: Wed, 1 Sep 2021 14:48:30 +0300 Subject: [PATCH] Adding ntce export --- config/metrics.json | 30 ++++++++++++++++++------------ keentic_influxdb_exporter.py | 3 +++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/config/metrics.json b/config/metrics.json index 198615b..c8dbbfd 100644 --- a/config/metrics.json +++ b/config/metrics.json @@ -51,18 +51,6 @@ "state": "$.state" } }, - { - "command": "ip nat", - "root" : "$.[*]", - "tags" : { - "src" : "$.src", - "dst" : "$.dst" - }, - "values" : { - "bytes-in": "$.bytes", - "bytes-out": "$.bytes-out" - } - }, { "command": "system", "root" : "$", @@ -174,6 +162,24 @@ "rxspeed": "$.rxspeed", "txspeed": "$.txspeed" } + }, + { + "command": "ntce hosts", + "root" : "$.host[*].application[*]", + "tags" : { + "group-long" : "$.group-long", + "groupset-long-id" : "$.groupset-long-id", + "long" : "$.long", + "short": "$.short", + + "name": "`parent`.`parent`.host.name", + "ip": "`parent`.`parent`.host.ip", + "hostname": "`parent`.`parent`.host.hostname" + }, + "values" : { + "rxbytes": "$.rxbytes", + "txbytes": "$.txbytes" + } } ] } diff --git a/keentic_influxdb_exporter.py b/keentic_influxdb_exporter.py index f8a598d..96bb89c 100644 --- a/keentic_influxdb_exporter.py +++ b/keentic_influxdb_exporter.py @@ -55,6 +55,9 @@ class KeeneticCollector(object): for tagName, tagPath in self._tags.items(): if tagPath == '~': tags[tagName] = root.path.fields[0] + elif str(tagPath).startswith('`parent`'): + full_path = root.full_path.child(tagPath) + tags[tagName] = self.get_first_value(full_path.find(response)) else: tags[tagName] = self.get_first_value(tagPath.find(root.value))