Compare commits

...

8 Commits
v0.87 ... main

Author SHA1 Message Date
Thorsten Spille
6e390dcbf7
Update agent_unifi_controller 2024-09-18 18:29:03 +02:00
Thorsten Spille
64895fa1e2
Update unifi_controller.py 2024-09-18 18:28:05 +02:00
Thorsten Spille
f3646613fd
Merge pull request #3 from mo-ki/main
remove check_mk section
2023-02-18 21:05:19 +01:00
Thorsten Spille
d67358acef
Merge pull request #1 from doctore74/patch-1
Update unifi_controller.py
2023-02-18 21:04:37 +01:00
Thorsten Spille
c6f9b80fac
Merge branch 'main' into patch-1 2023-02-18 21:04:09 +01:00
Thorsten Spille
6813a7c308
Update README.md 2022-11-11 20:57:41 +01:00
Moritz Kiemer
5b13d9c786 remove check_mk section
Writing the check_mk section no longer gives the
desired results.

See https://checkmk.com/de/werk/13705
2022-03-11 16:13:53 +01:00
Christian W
519ee43607
Update unifi_controller.py
Changed Uptime to Unifi Device Uptime because it collides with the service Uptime if you use SNMP monitoring  additionally on unifi devices.
2022-01-27 00:25:31 +01:00
3 changed files with 216 additions and 172 deletions

View File

@ -1,2 +1,16 @@
# check-unifi-controller
Checkmk special agent for checking unifi controller
### Usage:
Login into your checkmk instnace user on your checkmk server (e.g. via SSH).
Download and install the checkmk agent:
~~~
wget https://github.com/bashclub/check-unifi-controller/releases/download/v0.87/unifi_controller-0.87.mkp
mkp install ./unifi_controller-0.87.mkp
~~~
### Configure Agent
Login into your checkmk website and go to "Setup" -> "Agents" -> "Other integrations" (Datasource programs). Under the category "Hardware" click on "Unifi Controller via API" and create a new rule.
Fill in the credentials of your Unifi controller, set the HTTPS Port, define the site name (if other than default), check "Ignore certificate validation" if using a self signed certificate, select Hostname or IP for storing piggyback data.
Under "Conditions" assign an "Explicit host" with your Unifi Controller Machine.
The agent will carry piggyback data for switches and access points and you can create new hosts to monitor, where piggyback data will be assignesd on exact match (IP or hostname).

View File

@ -3,7 +3,7 @@
#
## MIT License
##
## Copyright (c) 2021 Bash Club
## Copyright (c) 2024 Bash Club
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
@ -120,7 +120,7 @@ def check_unifi_controller(item,section):
state=State.OK,
summary=f"Version: {section.cloudkey_version}"
)
if int(section.cloudkey_update_available) > 0:
if _safe_int(section.cloudkey_update_available) > 0:
yield Result(
state=State.WARN,
notice=_("Update available")
@ -315,7 +315,6 @@ def check_unifi_device(item,section):
)
yield Metric("user_sta",_active_user)
yield Metric("guest_sta",_safe_int(section.guest_num_sta))
if item == "Satisfaction":
yield Result(
state=State.OK,
@ -407,7 +406,7 @@ register.inventory_plugin(
############ DEVICEPORT ###########
@dataclass
class unifi_interface(interfaces.Interface):
class unifi_interface(interfaces.InterfaceWithCounters):
jumbo : bool = False
satisfaction : int = 0
poe_enable : bool = False
@ -422,8 +421,6 @@ class unifi_interface(interfaces.Interface):
ip_address : Optional[str] = None
portconf : Optional[str] = None
def __post_init__(self) -> None:
self.finalize()
def _convert_unifi_counters_if(section: Section) -> interfaces.Section:
## 10|port_idx|10
@ -480,25 +477,29 @@ def _convert_unifi_counters_if(section: Section) -> interfaces.Section:
return [
unifi_interface(
index=str(netif.port_idx),
descr=netif.name,
alias=netif.name,
type='6',
speed=_safe_int(netif.speed)*1000000,
oper_status=netif.oper_status,
admin_status=netif.admin_status,
in_octets=_safe_int(netif.rx_bytes),
in_ucast=_safe_int(netif.rx_packets),
in_mcast=_safe_int(netif.rx_multicast),
in_bcast=_safe_int(netif.rx_broadcast),
in_discards=_safe_int(netif.rx_dropped),
in_errors=_safe_int(netif.rx_errors),
out_octets=_safe_int(netif.tx_bytes),
out_ucast=_safe_int(netif.tx_packets),
out_mcast=_safe_int(netif.tx_multicast),
out_bcast=_safe_int(netif.tx_broadcast),
out_discards=_safe_int(netif.tx_dropped),
out_errors=_safe_int(netif.tx_errors),
attributes=interfaces.Attributes(
index=str(netif.port_idx),
descr=netif.name,
alias=netif.name,
type='6',
speed=_safe_int(netif.speed)*1000000,
oper_status=netif.oper_status,
admin_status=netif.admin_status,
),
counters=interfaces.Counters(
in_octets=_safe_int(netif.rx_bytes),
in_ucast=_safe_int(netif.rx_packets),
in_mcast=_safe_int(netif.rx_multicast),
in_bcast=_safe_int(netif.rx_broadcast),
in_disc=_safe_int(netif.rx_dropped),
in_err=_safe_int(netif.rx_errors),
out_octets=_safe_int(netif.tx_bytes),
out_ucast=_safe_int(netif.tx_packets),
out_mcast=_safe_int(netif.tx_multicast),
out_bcast=_safe_int(netif.tx_broadcast),
out_disc=_safe_int(netif.tx_dropped),
out_err=_safe_int(netif.tx_errors),
),
jumbo=True if netif.jumbo == "1" else False,
satisfaction=_safe_int(netif.satisfaction) if netif.satisfaction and netif.oper_status == "1" else 0,
poe_enable=True if netif.poe_enable == "1" else False,
@ -532,7 +533,7 @@ def check_unifi_network_port_if( ##fixme parsed_section_name
section: Section,
) -> CheckResult:
_converted_ifs = _convert_unifi_counters_if(section)
iface = next(filter(lambda x: _safe_int(item,-1) == _safe_int(x.index) or item == x.alias,_converted_ifs),None) ## fix Service Discovery appearance alias/descr
iface = next(filter(lambda x: _safe_int(item,-1) == _safe_int(x.attributes.index) or item == x.attributes.alias,_converted_ifs),None) ## fix Service Discovery appearance alias/descr
yield from interfaces.check_multiple_interfaces(
item,
params,
@ -665,41 +666,42 @@ def discovery_unifi_ssids(section):
def check_unifi_ssids(item,section):
ssid = section.get(item)
_channels = ",".join(list(filter(lambda x: _safe_int(x) > 0,[ssid.ng_channel,ssid.na_channel])))
yield Result(
state=State.OK,
summary=f"Channels: {_channels}"
)
if (_safe_int(ssid.ng_is_guest) + _safe_int(ssid.na_is_guest)) > 0:
if ssid:
_channels = ",".join(list(filter(lambda x: _safe_int(x) > 0,[ssid.ng_channel,ssid.na_channel])))
yield Result(
state=State.OK,
summary="Guest"
summary=f"Channels: {_channels}"
)
_satisfaction = max(0,min(_safe_int(ssid.ng_satisfaction),_safe_int(ssid.na_satisfaction)))
yield Result(
state=State.OK,
summary=f"Satisfaction: {_satisfaction}"
)
_num_sta = _safe_int(ssid.na_num_sta) + _safe_int(ssid.ng_num_sta)
if _num_sta > 0:
if (_safe_int(ssid.ng_is_guest) + _safe_int(ssid.na_is_guest)) > 0:
yield Result(
state=State.OK,
summary="Guest"
)
_satisfaction = max(0,min(_safe_int(ssid.ng_satisfaction),_safe_int(ssid.na_satisfaction)))
yield Result(
state=State.OK,
summary=f"User: {_num_sta}"
summary=f"Satisfaction: {_satisfaction}"
)
yield Metric("satisfaction",max(0,_satisfaction))
yield Metric("wlan_24Ghz_num_user",_safe_int(ssid.ng_num_sta) )
yield Metric("wlan_5Ghz_num_user",_safe_int(ssid.na_num_sta) )
yield Metric("na_avg_client_signal",_safe_int(ssid.na_avg_client_signal))
yield Metric("ng_avg_client_signal",_safe_int(ssid.ng_avg_client_signal))
_num_sta = _safe_int(ssid.na_num_sta) + _safe_int(ssid.ng_num_sta)
if _num_sta > 0:
yield Result(
state=State.OK,
summary=f"User: {_num_sta}"
)
yield Metric("satisfaction",max(0,_satisfaction))
yield Metric("wlan_24Ghz_num_user",_safe_int(ssid.ng_num_sta) )
yield Metric("wlan_5Ghz_num_user",_safe_int(ssid.na_num_sta) )
yield Metric("na_tcp_packet_loss",_safe_int(ssid.na_tcp_packet_loss))
yield Metric("ng_tcp_packet_loss",_safe_int(ssid.ng_tcp_packet_loss))
yield Metric("na_wifi_retries",_safe_int(ssid.na_wifi_retries))
yield Metric("ng_wifi_retries",_safe_int(ssid.ng_wifi_retries))
yield Metric("na_wifi_latency",_safe_int(ssid.na_wifi_latency))
yield Metric("ng_wifi_latency",_safe_int(ssid.ng_wifi_latency))
yield Metric("na_avg_client_signal",_safe_int(ssid.na_avg_client_signal))
yield Metric("ng_avg_client_signal",_safe_int(ssid.ng_avg_client_signal))
yield Metric("na_tcp_packet_loss",_safe_int(ssid.na_tcp_packet_loss))
yield Metric("ng_tcp_packet_loss",_safe_int(ssid.ng_tcp_packet_loss))
yield Metric("na_wifi_retries",_safe_int(ssid.na_wifi_retries))
yield Metric("ng_wifi_retries",_safe_int(ssid.ng_wifi_retries))
yield Metric("na_wifi_latency",_safe_int(ssid.na_wifi_latency))
yield Metric("ng_wifi_latency",_safe_int(ssid.ng_wifi_latency))
@ -724,26 +726,27 @@ def discovery_unifi_ssidlist(section):
def check_unifi_ssidlist(item,section):
ssid = section.get(item)
yield Result(
state=State.OK,
summary=f"Channels: {ssid.channels}"
)
yield Result(
state=State.OK,
summary=f"User: {ssid.num_sta}"
)
yield Metric("wlan_24Ghz_num_user",_safe_int(ssid.ng_num_sta) )
yield Metric("wlan_5Ghz_num_user",_safe_int(ssid.na_num_sta) )
yield Metric("na_avg_client_signal",_safe_int(ssid.na_avg_client_signal))
yield Metric("ng_avg_client_signal",_safe_int(ssid.ng_avg_client_signal))
if ssid:
yield Result(
state=State.OK,
summary=f"Channels: {ssid.channels}"
)
yield Result(
state=State.OK,
summary=f"User: {ssid.num_sta}"
)
yield Metric("wlan_24Ghz_num_user",_safe_int(ssid.ng_num_sta) )
yield Metric("wlan_5Ghz_num_user",_safe_int(ssid.na_num_sta) )
yield Metric("na_avg_client_signal",_safe_int(ssid.na_avg_client_signal))
yield Metric("ng_avg_client_signal",_safe_int(ssid.ng_avg_client_signal))
yield Metric("na_tcp_packet_loss",_safe_int(ssid.na_tcp_packet_loss))
yield Metric("ng_tcp_packet_loss",_safe_int(ssid.ng_tcp_packet_loss))
yield Metric("na_tcp_packet_loss",_safe_int(ssid.na_tcp_packet_loss))
yield Metric("ng_tcp_packet_loss",_safe_int(ssid.ng_tcp_packet_loss))
yield Metric("na_wifi_retries",_safe_int(ssid.na_wifi_retries))
yield Metric("ng_wifi_retries",_safe_int(ssid.ng_wifi_retries))
yield Metric("na_wifi_latency",_safe_int(ssid.na_wifi_latency))
yield Metric("ng_wifi_latency",_safe_int(ssid.ng_wifi_latency))
yield Metric("na_wifi_retries",_safe_int(ssid.na_wifi_retries))
yield Metric("ng_wifi_retries",_safe_int(ssid.ng_wifi_retries))
yield Metric("na_wifi_latency",_safe_int(ssid.na_wifi_latency))
yield Metric("ng_wifi_latency",_safe_int(ssid.ng_wifi_latency))
register.agent_section(
name = 'unifi_ssid_list',
@ -758,5 +761,3 @@ register.check_plugin(
)

View File

@ -2,7 +2,7 @@
# -*- encoding: utf-8; py-indent-offset: 4 -*-
## MIT License
##
## Copyright (c) 2021 Bash Club
## Copyright (c) 2024 Bash Club
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
## SOFTWARE.
###
__VERSION__ = 0.87
__VERSION__ = 2.01
import sys
import socket
@ -44,117 +44,130 @@ except ImportError:
UNIFI_DEVICE_TABLE = {
'BZ2' : 'UAP',
'BZ2LR' : 'UAP-LR',
'S216150' : 'US-16-150W',
'S224250' : 'US-24-250W',
'S224500' : 'US-24-500W',
'S248500' : 'US-48-500W',
'S248750' : 'US-48-750W',
'S28150' : 'US-8-150W',
'U2HSR' : 'UAP-Outdoor+',
'U2IW' : 'UAP-IW',
'U2L48' : 'UAP-AC-LR',
'U2Lv2' : 'UAP-AC-LR',
'U2L48' : 'UAP-LR',
'U2Lv2' : 'UAP-LRv2',
'U2M' : 'UAP-Mini',
'U2O' : 'UAP-Outdoor',
'U2S48' : 'UAP-AC',
'U2Sv2' : 'UAP-AC',
'U2S48' : 'UAP',
'U2Sv2' : 'UAPv2',
'U5O' : 'UAP-Outdoor5',
'U6ENT' : 'U6-Enterprise',
'U6EXT' : 'U6-Extender',
'U6IW' : 'U6-IW',
'U6M' : 'U6-Mesh',
'U7E' : 'UAP-AC',
'U7EDU' : 'UAP-AC-EDU',
'U7Ev2' : 'UAP-AC',
'U7HD' : 'UAP-AC-HD',
'U7SHD' : 'UAP-AC-SHD',
'U7NHD' : 'UAP-nanoHD',
'UFLHD' : 'UAP-FlexHD',
'UHDIW' : 'UAP-IW-HD',
'UAIW6' : 'U6-IW',
'UAE6' : 'U6-Extender',
'UAL6' : 'U6-Lite',
'UAM6' : 'U6-Mesh',
'UALR6' : 'U6-LR-EA',
'UAP6' : 'U6-LR',
'UALR6v2' : 'U6-LR',
'UALR6v3' : 'U6-LR',
'UCXG' : 'UAP-XG',
'UXSDM' : 'UWB-XG',
'UXBSDM' : 'UWB-XG-BK',
'UCMSH' : 'UAP-XG-Mesh',
'U7IW' : 'UAP-AC-IW',
'U7IWP' : 'UAP-AC-IW-Pro',
'U7MP' : 'UAP-AC-M-Pro',
'U7LR' : 'UAP-AC-LR',
'U7LT' : 'UAP-AC-Lite',
'U7O' : 'UAP-AC-Outdoor',
'U7P' : 'UAP-Pro',
'U7MP' : 'UAP-AC-M-Pro',
'U7MSH' : 'UAP-AC-M',
'U7NHD' : 'UAP-nanoHD',
'U7O' : 'UAP-AC-Outdoor',
'U7P' : 'UAP-AC-Pro',
'U7PG2' : 'UAP-AC-Pro',
'p2N' : 'PICOM2HP',
'UDMB' : 'UAP-BeaconHD',
'USF5P' : 'USW-Flex',
'US8' : 'US-8',
'US8P60' : 'US-8-60W',
'US8P150' : 'US-8-150W',
'S28150' : 'US-8-150W',
'USC8' : 'US-8',
'USC8P60' : 'US-8-60W',
'USC8P150' : 'US-8-150W',
'US16P150' : 'US-16-150W',
'S216150' : 'US-16-150W',
'US24' : 'US-24-G1',
'US24PRO' : 'USW-Pro-24-PoE',
'US24PRO2' : 'USW-Pro-24',
'US24P250' : 'US-24-250W',
'US24PL2' : 'US-L2-24-PoE',
'US24P500' : 'US-24-500W',
'S224250' : 'US-24-250W',
'S224500' : 'US-24-500W',
'US48' : 'US-48-G1',
'US48PRO' : 'USW-Pro-48-PoE',
'US48PRO2' : 'USW-Pro-48',
'US48P500' : 'US-48-500W',
'US48PL2' : 'US-L2-48-PoE',
'US48P750' : 'US-48-750W',
'S248500' : 'US-48-500W',
'S248750' : 'US-48-750W',
'US6XG150' : 'US-XG-6PoE',
'USMINI' : 'USW-Flex-Mini',
'USXG' : 'US-16-XG',
'USC8P450' : 'USW-Industrial',
'UDC48X6' : 'USW-Leaf',
'USL8A' : 'UniFi Switch Aggregation',
'USAGGPRO' : 'UniFi Switch Aggregation Pro',
'USL8LP' : 'USW-Lite-8-PoE',
'USL8MP' : 'USW-Mission-Critical',
'USL16P' : 'USW-16-PoE',
'USL16LP' : 'USW-Lite-16-PoE',
'USL24' : 'USW-24-G2',
'USL48' : 'USW-48-G2',
'USL24P' : 'USW-24-PoE',
'USL48P' : 'USW-48-PoE',
'UGW3' : 'USG-3P',
'UGW4' : 'USG-Pro-4',
'UGWHD4' : 'USG',
'UGWXG' : 'USG-XG-8',
'UDM' : 'UDM',
'UDMSE' : 'UDM-SE',
'UDMPRO' : 'UDM-Pro',
'UP4' : 'UVP-X',
'UP5' : 'UVP',
'UP5t' : 'UVP-Pro',
'UP7' : 'UVP-Executive',
'UP5c' : 'UVP',
'UP5tc' : 'UVP-Pro',
'UP7c' : 'UVP-Executive',
'U7SHD' : 'UAP-AC-SHD',
'UAE6' : 'U6-Extender-EA',
'UAIW6' : 'U6-IW-EA',
'UAL6' : 'U6-Lite',
'UALR6' : 'U6-LR-EA',
'UALR6v2' : 'U6-LR',
'UALR6v3' : 'U6-LR',
'UAM6' : 'U6-Mesh-EA',
'UAP6' : 'U6-LR',
'UAP6MP' : 'U6-Pro',
'UASXG' : 'UAS-XG',
'UBB' : 'UBB',
'UBBXG' : 'UBB-XG',
'UCK' : 'UCK',
'UCK-v2' : 'UCK',
'UCK-v3' : 'UCK',
'UCKG2' : 'UCK-G2',
'UCKP' : 'UCK-G2-Plus',
'UASXG' : 'UAS-XG',
'UCMSH' : 'UAP-XG-Mesh',
'UCXG' : 'UAP-XG',
'UDC48X6' : 'USW-Leaf',
'UDM' : 'UDM',
'UDMB' : 'UAP-BeaconHD',
'UDMPRO' : 'UDM-Pro',
'UDMPROSE' : 'UDM-SE',
'UDR' : 'UDR',
'UDW' : 'UDW',
'UDWPRO' : 'UDWPRO',
'UFLHD' : 'UAP-FlexHD',
'UGW3' : 'USG-3P',
'UGW4' : 'USG-Pro-4',
'UGWHD4' : 'USG',
'UGWXG' : 'USG-XG-8',
'UHDIW' : 'UAP-IW-HD',
'ULTE' : 'U-LTE',
'ULTEPUS' : 'U-LTE-Pro',
'ULTEPEU' : 'U-LTE-Pro',
'ULTEPUS' : 'U-LTE-Pro',
'UP1' : 'USP-Plug',
'UP4' : 'UVP-X',
'UP5' : 'UVP',
'UP5c' : 'UVP',
'UP5t' : 'UVP-Pro',
'UP5tc' : 'UVP-Pro',
'UP6' : 'USP-Strip',
'USPPDUP' : 'USP - Power Distribution Unit Pro',
'UP7' : 'UVP-Executive',
'UP7c' : 'UVP-Executive',
'US16P150' : 'US-16-150W',
'US24' : 'USW-24-G1',
'US24P250' : 'US-24-250W',
'US24P500' : 'US-24-500W',
'US24PL2' : 'US-L2-24-PoE',
'US24PRO' : 'USW-Pro-24-PoE',
'US24PRO2' : 'USW-Pro-24',
'US48' : 'US-48-G1',
'US48P500' : 'US-48-500W',
'US48P750' : 'US-48-750W',
'US48PL2' : 'US-L2-48-PoE',
'US48PRO' : 'USW-Pro-48-PoE',
'US48PRO2' : 'USW-Pro-48',
'US624P' : 'USW-Enterprise-24-PoE',
'US648P' : 'USW-Enterprise-48-PoE',
'US68P' : 'USW-Enterprise-8-PoE',
'US6XG150' : 'US-XG-6PoE',
'US8' : 'US-8',
'US8P150' : 'US-8-150W',
'US8P60' : 'US-8-60W',
'USAGGPRO' : 'USW-Pro-Aggregation',
'USC8' : 'US-8',
'USC8P150' : 'US-8-150W',
'USC8P450' : 'USW-Industrial',
'USC8P60' : 'US-8-60W',
'USF5P' : 'USW-Flex',
'USFXG' : 'USW-Flex-XG',
'USL16LP' : 'USW-Lite-16-PoE',
'USL16P' : 'USW-16-PoE',
'USL24' : 'USW-24-G2',
'USL24P' : 'USW-24-PoE',
'USL48' : 'USW-48-G2',
'USL48P' : 'USW-48-PoE',
'USL8A' : 'USW-Aggregation',
'USL8LP' : 'USW-Lite-8-PoE',
'USL8MP' : 'USW-Mission-Critical',
'USMINI' : 'USW-Flex-Mini',
'USPPDUP' : 'USP-PDU-Pro',
'USPRPS' : 'USP-RPS',
'US624P' : 'UniFi6 Switch 24',
'UBB' : 'UBB',
'UXGPRO' : 'UniFi NeXt-Gen Gateway PRO'
'USXG' : 'US-16-XG',
'USXG24' : 'USW-EnterpriseXG-24',
'UXBSDM' : 'UWB-XG-BK',
'UXGPRO' : 'UXG-Pro',
'UXSDM' : 'UWB-XG',
'p2N' : 'PICOM2HP'
}
try:
@ -291,7 +304,7 @@ class unifi_device(unifi_object):
_k = _k.replace("-","_")
setattr(self,_k,_v)
self.model_name = UNIFI_DEVICE_TABLE.get(self.model)
if self.type in ("ugw","udm"):
if self.type in ("ugw","udm") and hasattr(self,"connect_request_ip"):
## change ip to local ip
self.wan_ip = self.ip
self.ip = self.connect_request_ip
@ -552,7 +565,11 @@ class unifi_controller_api(object):
def check_unifi_os(self):
_response = self.request("GET",url=self.url,allow_redirects=False)
self.is_unifios= _response.status_code == 200 and _response.headers.get("x-csrf-token")
_osid = re.findall('UNIFI_OS_MANIFEST.*?"id":"(\w+)"',_response.text)
if _osid and _osid[0] in ("UCKP","UNVR","UDMPRO","UDMENT","UDM","UDR"):
self.is_unifios = _osid[0]
else:
self.is_unifios = []
def get_sysinfo(self):
return self.get_data("/stat/sysinfo")
@ -586,14 +603,21 @@ class unifi_controller_api(object):
def get_data(self,path,site="default",method="GET",**kwargs):
_json = self.request(method=method,path=path,site=site,**kwargs).json()
_meta = _json.get("meta",{})
if _meta.get("rc") == "ok":
return _json.get("data",[])
if type(_json) == dict:
_meta = _json.get("meta",{})
if _meta.get("rc") == "ok":
return _json.get("data",[])
if _json.get("modelKey") == "nvr":
return _json
if type(_json) == list:
return _json
raise unifi_api_exception(_meta.get("msg",_json.get("errors",repr(_json))))
def request(self,method,url=None,path=None,site=None,json=None,**kwargs):
if not url:
if self.is_unifios:
if self.is_unifios == "UNVR":
url = f"{self.url}/proxy/protect/api"
elif self.is_unifios:
url = f"{self.url}/proxy/network/api"
else:
url = f"{self.url}/api"
@ -635,8 +659,6 @@ if __name__ == '__main__':
parser.add_argument("host",type=str,
help="""Host name or IP address of Unifi Controller""")
args = parser.parse_args()
print("<<<check_mk>>>")
print(f"Version: {__VERSION__}")
try:
_api = unifi_controller_api(**args.__dict__)
except socket.error as e:
@ -644,7 +666,14 @@ if __name__ == '__main__':
sys.exit(1)
if _api.is_unifios:
print("AgentOS: UnifiOS")
labels = {"cmk/os_family": "UnifiOS"}
print("<<<labels:sep(0)>>>")
print(json.dumps(labels))
if _api.is_unifios == "UNVR":
pprint(_api.get_data("/sensors",site=None))
pprint(_api.get_data("/cameras",site=None))
pprint(_api.get_data("/nvr",site=None))
sys.exit(0)
##pprint(_api.get_data("/stat/rogueap?within=4"))
##pprint(_api.get_data("/rest/user",site="default",method="GET"))
##pprint(_api.get_data("/stat/sta",site="default",method="GET"))