renames files in repo

This commit is contained in:
Robert Sander 2024-02-16 09:56:47 +01:00
parent 5af8b06f42
commit f96bd89f55
15 changed files with 2 additions and 78 deletions

View File

@ -23,7 +23,7 @@
## SOFTWARE.
###
__VERSION__ = 2.2.0
__VERSION__ = "2.2.0"
import sys
import socket
@ -645,7 +645,7 @@ if __name__ == '__main__':
if _api.is_unifios:
labels = {"cmk/os_family": "UnifiOS"}
print("<<<labels:sep(0)>>>"
print("<<<labels:sep(0)>>>")
print(json.dumps(labels))
##pprint(_api.get_data("/stat/rogueap?within=4"))

View File

@ -1,76 +0,0 @@
#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
from pprint import pprint
from collections import defaultdict
class dictobject(defaultdict):
def __getattr__(self,name):
return self[name] if name in self else ""
nested_dictobject = lambda: dictobject(nested_dictobject)
def inv_unifi_controller(info):
node = inv_tree("software.os")
node["version"] = info.get("controller_version")
def inv_unifi_device(info):
node = inv_tree("software.configuration.snmp_info")
node["name"] = info.get("name")
node["contact"] = info.get("snmp_contact")
node["location"] = info.get("snmp_location")
node = inv_tree("software.os")
node["version"] = info.get("version")
node = inv_tree("harware.system")
node["vendor"] = "ubiquiti"
for _key in ("model","board_rev","serial","mac"):
_val = info.get(_key)
if _val:
node[_key] = _val
def inv_unifi_port(info,params,inventory_tree):
_parsed = nested_dictobject()
for _line in info:
_parsed[_line[0]][_line[1]] = _line[2]
_interfaces = []
_total_ethernet_ports = 0
_available_ethernet_ports = 0
def _saveint(num):
try:
return int(num)
except (TypeError,ValueError):
return 0
for _iface in _parsed.values():
_interfaces.append({
"index" : int(_iface.port_idx),
"description" : _iface.name,
"alias" : _iface.name,
"speed" : _saveint(_iface.speed)*1000000,
"phys_address" : "",
"oper_status" : _saveint(_iface.oper_status),
"admin_status" : _saveint(_iface.admin_status),
"port_type" : 6,
"available" : _iface.oper_status == '2'
})
_total_ethernet_ports+=1
_available_ethernet_ports+=1 if _iface.oper_status == '2' else 0
node = inventory_tree.get_list("networking.interfaces:")
node.extend(sorted(_interfaces, key=lambda i: i.get('index')))
node = inventory_tree.get_dict("networking.")
node["available_ethernet_ports"] = _available_ethernet_ports
node["total_ethernet_ports"] = _total_ethernet_ports
node["total_interfaces"] = len(_parsed)
inv_info["unifi_controller"] = {
"inv_function" : inv_unifi_controller
}
inv_info["unifi_device"] = {
"inv_function" : inv_unifi_device
}
inv_info["unifi_network_ports"] = {
"inv_function" : inv_unifi_port
}

BIN
unifi_controller-0.88.1.mkp Normal file

Binary file not shown.