Skip to content

Commit

Permalink
Merge branch 'cmk2.2' of github.com:HeinleinSupport/check_mk-unifi-co…
Browse files Browse the repository at this point in the history
…ntroller into cmk2.2
  • Loading branch information
gurubert committed Aug 8, 2024
2 parents b2459e5 + 8718bf4 commit 8863966
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 89 deletions.
10 changes: 7 additions & 3 deletions ..._mk/agents/special/agent_unifi_controller → agents/special/agent_unifi_controller
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
## SOFTWARE.

###
__VERSION__ = 2.2.0
__VERSION__ = "2.2.0"

import sys
import socket
Expand Down Expand Up @@ -492,7 +492,7 @@ class unifi_controller(unifi_object):
def __str__(self):
_ret = ["<<<unifi_controller:sep(124)>>>"]
for _k,_v in self.__dict__.items():
if _k.startswith("_") or type(_v) not in (str,int,float):
if _k == "uptime" or _k.startswith("_") or type(_v) not in (str,int,float):
continue
_ret.append(f"{_k}|{_v}")

Expand All @@ -503,6 +503,10 @@ class unifi_controller(unifi_object):
_udm._piggy_back = False
_ret.append(str(_udm))

if "uptime" in self.__dict__:
_ret.append("<<<uptime>>>")
_ret.append(f"{self.uptime}")

_ret.append("<<<labels:sep(0)>>>")
_ret.append(f"{{\"unifi_device\":\"unifi-{self.type}\"}}")

Expand Down Expand Up @@ -645,7 +649,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"))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 0 additions & 10 deletions lib/check_mk/base/plugins/agent_based/unifi_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -271,7 +270,6 @@ def inventory_unifi_device_shortlist(section):
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")
Expand Down Expand Up @@ -317,14 +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 == "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,
Expand Down
76 changes: 0 additions & 76 deletions share/check_mk/inventory/unifi_controller

This file was deleted.

Binary file added unifi_controller-0.88.2.mkp
Binary file not shown.
File renamed without changes.
File renamed without changes.

0 comments on commit 8863966

Please sign in to comment.