Coder Social home page Coder Social logo

bashclub / check-unifi-controller Goto Github PK

View Code? Open in Web Editor NEW
42.0 42.0 15.0 42 KB

Checkmk special agent for checking unifi controller

Home Page: https://sysops.tv

License: MIT License

Python 100.00%
checkmk checkmk-extension monitoring monitoring-plugins ubiquiti unifi unifi-controller

check-unifi-controller's People

Contributors

doctore74 avatar mo-ki avatar spille-edv avatar thorstenspille avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

check-unifi-controller's Issues

Double WWW checks

Hi, for one of my sites I get double WWW Statuses in the summary. One is ok the second one is CRIT. I can't find a way to get around this as everything is ok on the site. Where does the second WWW come from?

image

Is this a bug?

Add support for CheckMK password store

When the password store is enabled for this agent, the check fails and generates this error:

[special_unifi_controller]: agent_unifi_controller: error: unrecognized arguments: --pwstore=4@0@[redacted]

Looks like it might be straightforward to add a decryptor - https://github.com/Checkmk/checkmk/blob/master/cmk/utils/password_store.py

Might be able to PR this one myself if I get a few minutes to spare, just adding this issue for those coming in from Google.

For those who found this issue, the workaround is to set an explicit password in the agent configuration rather than using a password vault entry

[2.2.0] TypeError 'in_octets'

Hi!

I just updated my testing environment (using the cloud container) to 2.2.0p5, and sadly I get a TypeError for the interfaces:

Exception: 
TypeError (unifi_interface.__init__() got an unexpected keyword argument 'in_octets')

TraceBack: 
 File "/omd/sites/cmk/lib/python3/cmk/base/agent_based/checking/_checking.py", line 413, in get_aggregated_result
    consume_check_results(
  File "/omd/sites/cmk/lib/python3/cmk/base/api/agent_based/checking_classes.py", line 494, in consume_check_results
    for subr in subresults:
  File "/omd/sites/cmk/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 93, in filtered_generator
    for element in generator(*args, **kwargs):
  File "/omd/sites/cmk/local/lib/python3/cmk/base/plugins/agent_based/unifi_controller.py", line 534, in check_unifi_network_port_if
    _converted_ifs = _convert_unifi_counters_if(section)
  File "/omd/sites/cmk/local/lib/python3/cmk/base/plugins/agent_based/unifi_controller.py", line 481, in _convert_unifi_counters_if
    return [
  File "/omd/sites/cmk/local/lib/python3/cmk/base/plugins/agent_based/unifi_controller.py", line 482, in <listcomp>
    unifi_interface(

Local Variables:
{'.0': <dict_valueiterator object at 0x7f29dd13c860>,
 'netif': dictobject(<function <lambda> at 0x7f29defd7d80>,
                     {'admin_status': '1',
                      'aggregated_by': '0',
                      'autoneg': '1',
                      'bytes_r': '0',
                      'enable': '1',
                      'forward': 'all',
                      'full_duplex': '0',
                      'ifname': 'eth0',
                      'is_uplink': '0',
                      'mac': '78:45:58:e4:5f:e9',
                      'name': 'Port 1',
                      'network_name': 'lan',
                      'num_port': '1',
                      'op_mode': 'switch',
                      'oper_status': '2',
                      'poe_enable': '0',
                      'poe_power': '0.00',
                      'port_idx': '1',
                      'port_poe': '0',
                      'rx_broadcast': '57727',
                      'rx_bytes': '1550808226787',
                      'rx_bytes_r': '0',
                      'rx_dropped': '998076',
                      'rx_errors': '997677',
                      'rx_multicast': '997835',
                      'rx_packets': '1265629185',
                      'rx_rate': '0',
                      'rx_rate_max': '0',
                      'speed': '10',
                      'tx_broadcast': '15880848',
                      'tx_bytes': '1516011921884',
                      'tx_bytes_r': '0',
                      'tx_dropped': '0',
                      'tx_errors': '0',
                      'tx_multicast': '22713592',
                      'tx_packets': '1190856715',
                      'tx_rate': '0',
                      'tx_rate_max': '0',
                      'type': 'ethernet'})}

My Python isn't that great but from what I can tell in 2.1.0 the .utils Interfaces class used to have all those attributes and with 2.2.0 these are moved to a seperate Counters and Rates class (don't quite get why there are two now for InterfaceWithCounters and InterfaceWithRates).

So please take this as a kind request to update this extension for 2.2

Uplink: [WARN] state

Hi,

i looked at the code but still haven't figured out what the criteria are that make the check go to a WARNING state. It's happening on a few devices but I couldn't make out a pattern.
It's got a warning on 4 out of 120 devices, and they seem all to be reachable.

could you tell me about the intention of that check? i'll gladly write a proper check man page once I understand it.

version number 0.87 not consistent

Hi there,
in the 0.87 mkp release the version of the installed version is still 0.83 :-)

Installed extension package unifi_controller-0.83 (Unifi API with piggyback Devices)

Kind regards,
Constey

Check raises login error on "UniFi OS 3.2.7"

/share/check_mk/agents/special/agent_unifi_controller

 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")

Header x-csrf-token is no longer available, so it is not possible to correctly determine whether unifiOS is being used. The wrong login URL is therefore used in def login()

File "/omd/sites/XXX/local/share/check_mk/agents/special/agent_unifi_controller", line 641, in <module>
_api = unifi_controller_api(**args.__dict__)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/omd/sites/XXX/local/share/check_mk/agents/special/agent_unifi_controller", line 551, in __init__
self.login(username,password)
File "/omd/sites/XXX/local/share/check_mk/agents/special/agent_unifi_controller", line 585, in login
raise unifi_api_exception("Login failed")

After Console Update to Version 4, Checkmk Crashes.

I think the check_mk check crashes, after my Console did a major release Update from Version 3.x to Version 4.x some Minutes ago.

ValueError (invalid literal for int() with base 10: '')

File "/omd/sites/xxx/lib/python3/cmk/base/checking.py", line 581, in get_aggregated_result
result = _aggregate_results(check_function(**kwargs))
File "/omd/sites/xxx/lib/python3/cmk/base/checking.py", line 812, in _aggregate_results
perfdata, results = _consume_and_dispatch_result_types(subresults)
File "/omd/sites/xxx/lib/python3/cmk/base/checking.py", line 856, in _consume_and_dispatch_result_types
for subr in subresults:
File "/omd/sites/xxx/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 89, in filtered_generator
for element in generator(*args, **kwargs):
File "/omd/sites/xxx/local/lib/python3/cmk/base/plugins/agent_based/unifi_controller.py", line 123, in check_unifi_controller
if int(section.cloudkey_update_available) > 0:

UDM Pro with UniFi OS 3.2.7 always responds Login failed

I've tried a new (Synology) account, but always get a "Login Failed" error. If I change the local Python code, I find the script
url=f"{self.url}/api/login"
But that URL always returns a 403. With other tools I can POST to url=f"{self.url}/api/auth/login", which returns a valid session.

Am I doing something wrong? Is this a new update for UniFi which isn't supported, yet?

Duplicate Service When Combined with SNMP

When monitoring UniFi APs via piggyback and SNMP, there's a duplicate service: Uptime. Renaming "Uptime" to something else such as "Uptime (piggyback)" in lines 274 and 320 of ~/local/lib/check_mk/base/plugins/agent_based/unifi_controller.py resolves the issue.

Attribute has no 'connect_request_ip'

Agent exited with code 1: Traceback (most recent call last):
File "/omd/sites/monitoring/local/share/check_mk/agents/special/agent_unifi_controller", line 652, in
_controller = unifi_controller(_API=_api)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/omd/sites/monitoring/local/share/check_mk/agents/special/agent_unifi_controller", line 182, in init
self._init()
File "/omd/sites/monitoring/local/share/check_mk/agents/special/agent_unifi_controller", line 437, in _init
self._get_sites()
File "/omd/sites/monitoring/local/share/check_mk/agents/special/agent_unifi_controller", line 467, in _get_sites
self._UNIFI_SITES.append(unifi_site(_PARENT=self,_site))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/omd/sites/monitoring/local/share/check_mk/agents/special/agent_unifi_controller", line 182, in init
self._init()
File "/omd/sites/monitoring/local/share/check_mk/agents/special/agent_unifi_controller", line 398, in _init
self._get_devices()
File "/omd/sites/monitoring/local/share/check_mk/agents/special/agent_unifi_controller", line 414, in _get_devices
self._UNIFICONTROLLER._UNIFI_DEVICES.append(unifi_device(_PARENT=self,
_device))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/omd/sites/monitoring/local/share/check_mk/agents/special/agent_unifi_controller", line 182, in init
self._init()
File "/omd/sites/monitoring/local/share/check_mk/agents/special/agent_unifi_controller", line 297, in _init
self.ip = self.connect_request_ip
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'unifi_device' object has no attribute 'connect_request_ip'

[special_unifi_controller] Version: 0.83, OS: UnifiOS, unexpected agent version 0.83 (should be 2.0.0p12)

Hello,

Using this extension on CMK 2.0.0p12, when I run an inventory on the cloudkey it works, however the CMK inventory

[special_unifi_controller] Version: 0.83, OS: UnifiOS, unexpected agent version 0.83 (should be 2.0.0p12) UNKN, execution time 1.1 sec

I added this WATO rule: Setup > Agents > Access to AgentsCheck for correct version of Checkmk agent

Turned off the check for correct version, after this the check comes back healthy.

Just a FYI for anyone else that may run into this, otherwise great plugin thanks !!

manual

my issue is: how to use this plugin is there a manual? where to place the scripts? which permission? and so one.. am new to checkmk.
so how can i setup this plugin? :) thank you.

Get output when runnin from host but no agent output

Hi - I've installed the mkp and enabled it on my host. If I run

./agent_unifi_controller -u myunifiadmin -p somepass --ignore-cert --piggyback
mycontrollerurl:8443

I get output regarding my SSID's etc - so all looks good.

If I go to Setup > Other integrations > Unifi Controller via API and setup my controller details and then run a discovery on the monitored host I just get an error regarding agent_unifi_controller and no data output.

I should note that I am monitoring vCenter with piggback data enabled - not sure if that is causing any issues.

Also - Do I need to place anything in my plugins folder on the monitored host for this to work? - I copied agent_unifi_controller and chmod 755, but that didn't help.

Not quite sure where I'm going wrong here, any help would be much appreciated!

Running Checkmk Raw Edition 2.2.0p12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.