mirror of
https://github.com/bashclub/check-unifi-controller.git
synced 2024-12-24 12:30:12 +01:00
Update to 0.87: Fix uptime
This commit is contained in:
parent
7c039651c2
commit
a38a85ef4d
@ -115,7 +115,6 @@ def check_unifi_controller(item,section):
|
||||
state=State.WARN,
|
||||
notice=_("Update available")
|
||||
)
|
||||
yield Metric("uptime",int(section.uptime))
|
||||
if item == "Cloudkey":
|
||||
yield Result(
|
||||
state=State.OK,
|
||||
@ -271,7 +270,6 @@ register.inventory_plugin(
|
||||
def discovery_unifi_device(section):
|
||||
yield Service(item="Device Status")
|
||||
yield Service(item="Unifi Device")
|
||||
yield Service(item="Uptime")
|
||||
yield Service(item="Active-User")
|
||||
if section.type != "uap": # kein satisfaction bei ap .. radio/ssid haben schon
|
||||
yield Service(item="Satisfaction")
|
||||
@ -317,14 +315,7 @@ def check_unifi_device(item,section):
|
||||
)
|
||||
yield Metric("user_sta",_active_user)
|
||||
yield Metric("guest_sta",_safe_int(section.guest_num_sta))
|
||||
if item == "Uptime":
|
||||
_uptime = int(section.uptime) if section.uptime else -1
|
||||
if _uptime > 0:
|
||||
yield Result(
|
||||
state=State.OK,
|
||||
summary=render.timespan(_uptime)
|
||||
)
|
||||
yield Metric("unifi_uptime",_uptime)
|
||||
|
||||
if item == "Satisfaction":
|
||||
yield Result(
|
||||
state=State.OK,
|
||||
|
@ -23,7 +23,7 @@
|
||||
## SOFTWARE.
|
||||
|
||||
###
|
||||
__VERSION__ = 0.83
|
||||
__VERSION__ = 0.87
|
||||
|
||||
import sys
|
||||
import socket
|
||||
@ -353,7 +353,7 @@ class unifi_device(unifi_object):
|
||||
"lcm_idle_timeout_override","lcm_brightness_override","uplink_depth","mesh_sta_vap_enabled","mesh_uplink_2",
|
||||
"lcm_tracker_enabled","model_incompatible","model_in_lts","model_in_eol","country_code","wifi_caps",
|
||||
"meshv3_peer_mac","element_peer_mac","vwireEnabled","hide_ch_width","x_authkey","x_ssh_hostkey_fingerprint",
|
||||
"x_fingerprint","x_inform_authkey","op_mode"
|
||||
"x_fingerprint","x_inform_authkey","op_mode","uptime"
|
||||
]
|
||||
for _k,_v in self.__dict__.items():
|
||||
if _k.startswith("_") or _k in _unwanted or type(_v) not in (str,int,float):
|
||||
@ -362,7 +362,10 @@ class unifi_device(unifi_object):
|
||||
|
||||
_ret.append("<<<labels:sep(0)>>>")
|
||||
_ret.append(f"{{\"unifi_device\":\"unifi-{self.type}\"}}")
|
||||
|
||||
_uptime = getattr(self,"uptime",None)
|
||||
if _uptime:
|
||||
_ret.append("<<<uptime>>>")
|
||||
_ret.append(str(_uptime))
|
||||
if self._NETWORK_PORTS:
|
||||
_ret += ["","<<<unifi_network_ports:sep(124)>>>"] + [str(_port) for _port in self._NETWORK_PORTS]
|
||||
if self._NETWORK_RADIO:
|
||||
@ -470,7 +473,7 @@ class unifi_controller(unifi_object):
|
||||
|
||||
_ret = []
|
||||
for _ssid,_obj in _dict.items():
|
||||
pprint(_obj)
|
||||
#pprint(_obj)
|
||||
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"):
|
||||
_ret.append("|".join([_ssid,_key,str(sum(map(lambda x: getattr(x,_key,0),_obj)))]))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user