check_unifi.php

Category: nagios
Downloaded: 3313

 

Nagios Plugin  to check a Unifi Controller (Accesspoints and Switches).

API Version 1.1.83

You need to install php-curl and php Version above 7.4 

 
Note:
Support for UniFi OS-based controllers (UniFi Dream Machine Pro or Cloud Key Gen2/Cloud Key Gen2 Plus with firmware version 2.0.24 or higher) has been added as of API version 1.1.47. The class automatically detects UniFi OS devices and adjusts URLs and several functions/methods accordingly. If your own code applies strict validation of the URL that is passed to the constructor, please adapt your logic to allow URLs without a port suffix when dealing with a UniFi OS-based controller.

In case of my script use -P 443 and -s 

If you find a bug or have a request, write me.

 


Usage:

Usage: /usr/bin/php check_unifi.php -H [controller] -u [controlleruser] -p [controllerpassword] -P [controllerport] -m [mode] -a [Accesspoint/Switch/Client/SSID] -w [Warning] -c [Critical] ( -S [site] -s =https -C [configfile] -r [nagios result] -i =invers nagios result -d =debug)

 

-m

controller 
= Controller Version

site
= list all Site ID and Name

clients  
= list all clients (console)

clients_wifi
= list all wifi clients with connection speed (console)

devices_console
= list all devices (only use in console)

clients_all
= count all clients (wired/wifi)

clients_name ( + Accesspoint)
= count and list all wifi clients (or off one accesspoint)

clients_name_guest ( + Accesspoint)
= count list all wifi clients and guests (or off one accesspoint)

clients_count ( + Accesspoint)
= count wifi clients (or off one accesspoint)

clients_count_guest ( + Accesspoint)
= count wifi clients and guests (or off one accesspoint)

channels + Accesspoint
= channels 2GHz/5GHz off an accesspoint

client_transfer + Clientname or IP
= rx/tx transfer off a Client (KBit/MBit)

client_transfer+ + Clientname or IP
= rx/tx transfer off a Client (KByte/MByte)

client_uplink + Clientname or IP
= uplink off a wifi client

client_uptime
= uptime off a client (connection uptime)

transfer + Accesspoint
= rx/tx transfer off an accesspoint (Kbit/Mbit)  

transfer+ + Accesspoint
= rx/tx transfer off an accesspoint (Kbyte/Mbyte)

swtich_transfer + Switch
= rx/tx transfer off a swtich (KBit/MBit)

switch_transfer+ + Switch
= rx/tx transfer off a switch (KByte/MByte)

uptime + Accesspoint/Switch
= uptime off an accesspoint/switch

update + Accesspoint/Switch
= update firmware is available off an accesspointi/switch (point release, major version, minor version)

uplink + Accesspoint warn crit
= uplink off an accesspoint (wireless: with connection speed and warn/critical)

experience + Accesspoint warn crit
= wireless experience off an accesspoint with warn/critical

utilisation + Accesspoint warn crit
= wireless utilisation off an accesspoint with warn/critical (2GHz,5GHz)

mem + Accesspoint warn crit
= memory usage output Mb off an accesspoint or a switch with warn/critical percent

mem% + Accesspoint warn crit
= memory usage output percent off an accesspoint or a switch with warn/critical percent

cpu + Accesspoint/Switch warn crit
= cpu and load combination usage off an accesspoint or a switch with warn/critical procent

cpu% + Accesspoint/Switch warn crit
= cpu usage off an accesspoint or a switch with warn/critical procent

load + Accesspoint/Switch warn crit
= linux_load usage off an accesspoint or a switch with warn/critical 1,5,15

temperature + Switch
= temperature off a switch with warn/critical

ap warn crit
= count Accesspoint (Online and Offline) with warn and critical offline Accesspoints

switch warn crit
= count Switch (Online and Offline) with warn and critical offline Switch

clients_ssid ( + SSID Name)
= count all ssid clients for every ssid or one ssid

clients_count_ssid + SSID Name
= count all wifi clients for one ssid

clients_count_guest_ssid + SSID Name
= count all wifi clients and guests for one ssid

clients_wifi                             
= count all clients WiFi standards for one site

 

Count over all sites:
ap_unifi warn crit
= count Accesspoint (Online and Offline) with warn and critical offline Accesspoints

switch_unifi warn crit
= count Switch (Online and Offline) with warn and critical offline Switch

ap_unifi_name warn crit
= count Accesspoint (Online and Offline) with warn and critical named offline Accesspoints

switch_unifi_name warn crit
= count Switch (Online and Offline) with warn and critical named offline Switch

clients_unifi
= count all clients

clients_count_unifi
= count all wifi clients

clients_count_guest_unifi
= count all wifi clients and guests

clients_wifi_unifi
= count all clients WiFi standards

lte_uplink
= lte uplink off a LTE AP with warn and critical rssi,rsrq,rsrp

lte_failover
= lte failover off a LTE AP

lte
= lte connection off a LTE AP

alarms_count
= count all alarm messages

-r   controller/client_transfer/client_transfer+/client_uplink/clients_ssid
result nagios - new controller version/if a client not present/or if a guest ssid is enabled or disabled
0 - OK (default)
1 - WARNING
2 - CRITICAL

-i inverse -r (only clients_ssid, if the guest ssid is enabled or disabled)
-C config file (default=unifi.php) instead off the controller parameters -H, -u, -p, -P, -s, -S (you can specify any file with path)
-php  no check of php Version

 


MIT-Lizenz


 

Would you like to support me?
Then donate to PayPal...