diff --git a/share/check_mk/agents/special/agent_unifi_controller b/agents/special/agent_unifi_controller old mode 100644 new mode 100755 similarity index 99% rename from share/check_mk/agents/special/agent_unifi_controller rename to agents/special/agent_unifi_controller index 16c31c6..5f909a9 --- a/share/check_mk/agents/special/agent_unifi_controller +++ b/agents/special/agent_unifi_controller @@ -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("<<>>" + print("<<>>") print(json.dumps(labels)) ##pprint(_api.get_data("/stat/rogueap?within=4")) diff --git a/share/check_mk/checkman/unifi_controller b/checkman/unifi_controller similarity index 100% rename from share/check_mk/checkman/unifi_controller rename to checkman/unifi_controller diff --git a/share/check_mk/checkman/unifi_device b/checkman/unifi_device similarity index 100% rename from share/check_mk/checkman/unifi_device rename to checkman/unifi_device diff --git a/share/check_mk/checkman/unifi_device_shortlist b/checkman/unifi_device_shortlist similarity index 100% rename from share/check_mk/checkman/unifi_device_shortlist rename to checkman/unifi_device_shortlist diff --git a/share/check_mk/checkman/unifi_network_ports_if b/checkman/unifi_network_ports_if similarity index 100% rename from share/check_mk/checkman/unifi_network_ports_if rename to checkman/unifi_network_ports_if diff --git a/share/check_mk/checkman/unifi_network_radios b/checkman/unifi_network_radios similarity index 100% rename from share/check_mk/checkman/unifi_network_radios rename to checkman/unifi_network_radios diff --git a/share/check_mk/checkman/unifi_network_ssids b/checkman/unifi_network_ssids similarity index 100% rename from share/check_mk/checkman/unifi_network_ssids rename to checkman/unifi_network_ssids diff --git a/share/check_mk/checkman/unifi_sites b/checkman/unifi_sites similarity index 100% rename from share/check_mk/checkman/unifi_sites rename to checkman/unifi_sites diff --git a/share/check_mk/checkman/unifi_ssid_list b/checkman/unifi_ssid_list similarity index 100% rename from share/check_mk/checkman/unifi_ssid_list rename to checkman/unifi_ssid_list diff --git a/share/check_mk/checks/agent_unifi_controller b/checks/agent_unifi_controller similarity index 100% rename from share/check_mk/checks/agent_unifi_controller rename to checks/agent_unifi_controller diff --git a/share/check_mk/inventory/unifi_controller b/share/check_mk/inventory/unifi_controller deleted file mode 100644 index 32b9be8..0000000 --- a/share/check_mk/inventory/unifi_controller +++ /dev/null @@ -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 -} - diff --git a/unifi_controller-0.88.1.mkp b/unifi_controller-0.88.1.mkp new file mode 100644 index 0000000..8b4e906 Binary files /dev/null and b/unifi_controller-0.88.1.mkp differ diff --git a/share/check_mk/web/plugins/metrics/unifi_metrics.py b/web/plugins/metrics/unifi_metrics.py similarity index 100% rename from share/check_mk/web/plugins/metrics/unifi_metrics.py rename to web/plugins/metrics/unifi_metrics.py diff --git a/share/check_mk/web/plugins/perfometer/unifi_performeter.py b/web/plugins/perfometer/unifi_performeter.py similarity index 100% rename from share/check_mk/web/plugins/perfometer/unifi_performeter.py rename to web/plugins/perfometer/unifi_performeter.py diff --git a/share/check_mk/web/plugins/wato/datasource_unifi_controller.py b/web/plugins/wato/datasource_unifi_controller.py similarity index 100% rename from share/check_mk/web/plugins/wato/datasource_unifi_controller.py rename to web/plugins/wato/datasource_unifi_controller.py