Adding ntce export

This commit is contained in:
Vitaliy Skrypnyk
2021-09-01 14:48:30 +03:00
parent a70258471c
commit 56f8f65d83
2 changed files with 21 additions and 12 deletions

View File

@@ -51,18 +51,6 @@
"state": "$.state" "state": "$.state"
} }
}, },
{
"command": "ip nat",
"root" : "$.[*]",
"tags" : {
"src" : "$.src",
"dst" : "$.dst"
},
"values" : {
"bytes-in": "$.bytes",
"bytes-out": "$.bytes-out"
}
},
{ {
"command": "system", "command": "system",
"root" : "$", "root" : "$",
@@ -174,6 +162,24 @@
"rxspeed": "$.rxspeed", "rxspeed": "$.rxspeed",
"txspeed": "$.txspeed" "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"
}
} }
] ]
} }

View File

@@ -55,6 +55,9 @@ class KeeneticCollector(object):
for tagName, tagPath in self._tags.items(): for tagName, tagPath in self._tags.items():
if tagPath == '~': if tagPath == '~':
tags[tagName] = root.path.fields[0] 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: else:
tags[tagName] = self.get_first_value(tagPath.find(root.value)) tags[tagName] = self.get_first_value(tagPath.find(root.value))