Skip to content

Commit c6f9b80

Browse files
Merge branch 'main' into patch-1
2 parents 519ee43 + 6813a7c commit c6f9b80

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
# check-unifi-controller
22
Checkmk special agent for checking unifi controller
3+
4+
### Usage:
5+
Login into your checkmk instnace user on your checkmk server (e.g. via SSH).
6+
Download and install the checkmk agent:
7+
~~~
8+
wget https://github.com/bashclub/check-unifi-controller/releases/download/v0.87/unifi_controller-0.87.mkp
9+
mkp install ./unifi_controller-0.87.mkp
10+
~~~
11+
12+
### Configure Agent
13+
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.
14+
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.
15+
Under "Conditions" assign an "Explicit host" with your Unifi Controller Machine.
16+
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).

lib/check_mk/base/plugins/agent_based/unifi_controller.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def check_unifi_controller(item,section):
115115
state=State.WARN,
116116
notice=_("Update available")
117117
)
118-
yield Metric("uptime",int(section.uptime))
119118
if item == "Cloudkey":
120119
yield Result(
121120
state=State.OK,

share/check_mk/agents/special/agent_unifi_controller

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
## SOFTWARE.
2424

2525
###
26-
__VERSION__ = 0.83
26+
__VERSION__ = 0.87
2727

2828
import sys
2929
import socket
@@ -353,7 +353,7 @@ class unifi_device(unifi_object):
353353
"lcm_idle_timeout_override","lcm_brightness_override","uplink_depth","mesh_sta_vap_enabled","mesh_uplink_2",
354354
"lcm_tracker_enabled","model_incompatible","model_in_lts","model_in_eol","country_code","wifi_caps",
355355
"meshv3_peer_mac","element_peer_mac","vwireEnabled","hide_ch_width","x_authkey","x_ssh_hostkey_fingerprint",
356-
"x_fingerprint","x_inform_authkey","op_mode"
356+
"x_fingerprint","x_inform_authkey","op_mode","uptime"
357357
]
358358
for _k,_v in self.__dict__.items():
359359
if _k.startswith("_") or _k in _unwanted or type(_v) not in (str,int,float):
@@ -362,7 +362,10 @@ class unifi_device(unifi_object):
362362

363363
_ret.append("<<<labels:sep(0)>>>")
364364
_ret.append(f"{{\"unifi_device\":\"unifi-{self.type}\"}}")
365-
365+
_uptime = getattr(self,"uptime",None)
366+
if _uptime:
367+
_ret.append("<<<uptime>>>")
368+
_ret.append(str(_uptime))
366369
if self._NETWORK_PORTS:
367370
_ret += ["","<<<unifi_network_ports:sep(124)>>>"] + [str(_port) for _port in self._NETWORK_PORTS]
368371
if self._NETWORK_RADIO:
@@ -470,7 +473,7 @@ class unifi_controller(unifi_object):
470473

471474
_ret = []
472475
for _ssid,_obj in _dict.items():
473-
pprint(_obj)
476+
#pprint(_obj)
474477
for _key in ("num_sta","ng_num_sta","na_num_sta","ng_tcp_packet_loss","na_tcp_packet_loss","ng_wifi_retries","na_wifi_retries","ng_wifi_latency","na_wifi_latency"):
475478
_ret.append("|".join([_ssid,_key,str(sum(map(lambda x: getattr(x,_key,0),_obj)))]))
476479

0 commit comments

Comments
 (0)