UniFi plugin: What, How, Where

Posted on
Tue Oct 31, 2017 4:14 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

UniFi plugin: What, How, Where

About this plugin:


Where to download and check for new versions / options :
https://www.indigodomo.com/account/plugins

What:
The plugin gets and uses information from the Unifi devices to create/ update indigo devices/states, events ....

== the information from the Unifi device DB's are e.g.: name, ip#, WifiChannel, signal strength, noise, temperature, #bytes, error rates ,Port info, POE, age, uptime, ,... of the "Clients" and also the Unifi devices and will create / update indigo devices / states.

== the plugin can connect to each Unifi device and restart it. You can use a menu item or an action

== the plugin can connect to switches and power cycle POE for each individual port on a switch. You can use a menu item or an action

==you can the create reports on devices, track specific devices, set global parameters for all devices, or set individual expiration time or Up/Down algorithms for each device separately
--for WiFi devices options are:
..."FastDown" use ONLY log file info. When a device actively connects or disconnects. the AP's will log that
... use "Idle time" < xx seconds. idea time are the seconds since last connection from/to the Wifi Client
... "uptime" changed. As long as the AP thinks the device is alive it will increment uptime
... Optimized: use all available info, including DHCP log file info
==> for all: if new info reset exp timer and set Status --> up if not yet

-- for Non wifi devices you cans elect to use DHCP(GW) and / or Switch info to determine
... if age < max age or uptime has changed etc (same as form WiFI info from the AP's)
==> if new info reset exp timer and set Status --> up if not yet

for the default = no other selection: reset exp-timer if device is present in the Dict

Then every 5 secs check:
==> if exp-timer > expiration-time indigoParameter ==> set Status up--> down and after 2* exp-time down --> expired

== you can group individual devices into groups 0-9. then set a trigger on events for each group : all devices up/ down or at least one device up/down

The plugin supports up to 5 Access-points and up to 10 Switches and ONE Router (USG 3 or 4 ).

!! each UNIFI device (switch, router, AP) will be represented by several indigo devices:
First the normal UNIFI dev type like any other "client" on the network. Some of the UNIFI devices have several MAC number ie the router. There the plugin might create several std UNIFI devices as they appear in the log files and dicts as normal clients.
In addition each UNIFI dev type (router, Switch, AP) will have its own device type. There you can see the dev specific information like byes/sec on ports etc. In addition you can select to have a "neighbor" type device. those are the access point of your neighbors, unfortunately also many cars and phone now offer their services as AP. so when they walk by they get registered as a neighbor. You can swith them off in config.!!



How:
== YOU need to configure the plugin with IP# and userID/password of the Unifi devices and set Expiration-Time, refresh rates etc parameters in config and if desired individually for each device.
!!! make sure you configure the web page correctly depending on your UNIFI controller type (regular software, UDM,UDMPro ..)!!!


==Then the plugin will connect to UniFi devices (AP, Switches, USG, >> NOT EDGE types) and gather information about the UniFi devices and regular Devices ("Clients") attached to the network.
It will use "ssh unifiUserID@x.x.x.x " to connect to the UniFi devices through EXPECT scripts.
- one connection will listen to the "/var/log/messages" log file and select the relevant log file lines to determine if a devices has connected or disconnected
- the second connection will create every xx secs / minutes a dump of the mongo-DB of the UniFi devices and send the resulting DICT to the plugin. Then the plugin will check the DICT and will create update indigo devices / states and events accordingly


Karl

examples for device states:
switches:
Screen Shot 2017-10-31 at 18.09.08.png
Screen Shot 2017-10-31 at 18.09.08.png (64.09 KiB) Viewed 14976 times
Screen Shot 2017-10-31 at 18.10.55.png
Screen Shot 2017-10-31 at 18.10.55.png (106.16 KiB) Viewed 14976 times

regular devices w and w/o Wifi:
Screen Shot 2017-10-31 at 18.12.03.png
Screen Shot 2017-10-31 at 18.12.03.png (37.66 KiB) Viewed 14976 times

Screen Shot 2017-10-31 at 18.11.41.png
Screen Shot 2017-10-31 at 18.11.41.png (33.02 KiB) Viewed 14976 times

config:
unifi1.png
unifi1.png (141.7 KiB) Viewed 8910 times
unifi2.png
unifi2.png (141.8 KiB) Viewed 8907 times
unifi3.png
unifi3.png (114.36 KiB) Viewed 8910 times
unifidebug.png
unifidebug.png (89.82 KiB) Viewed 8910 times

!!! make sure you configure the web page correctly depending on your UNIFI controller type (regular software, UDM,UDMPro ..)!!!


menus:
unifmenus.png
unifmenus.png (200.85 KiB) Viewed 8910 times

device edit:
Screen Shot 2017-10-31 at 18.15.34.png
Screen Shot 2017-10-31 at 18.15.34.png (96.38 KiB) Viewed 14976 times

power cycle a POE port menu:
Screen Shot 2017-10-31 at 18.26.02.png
Screen Shot 2017-10-31 at 18.26.02.png (26.5 KiB) Viewed 14976 times

stats report
Code: Select all
Oct 31, 2017, 18:18:01
   data stats === START            === data stats for received messages ====  collection started at 2017-10-29 01:37:10
   dev type                        ipNumber            msgcount;    msgBytes;  errCount;  restarts;aliveCount;   msg/min; bytes/min;   err/min; aliveC/min
     APdict-0                      192.168.1.3             7523;    29990679;         0;         0;         0;     1.938;    7727.9; 0.0000000;     0.000;
     APdict-1                      192.168.1.4             7781;    33225421;         0;         0;         0;     2.005;    8561.4; 0.0000000;     0.000;
     APdict-2                      192.168.1.5             7417;    30490420;         1;         0;         0;     1.911;    7856.6; 0.0002577;     0.000;
     APtail-0                      192.168.1.3             3737;      392048;         0;         0;      3420;     0.963;     101.0; 0.0000000;     0.881;
     APtail-1                      192.168.1.4             3923;      476745;         0;         0;      3418;     1.011;     122.8; 0.0000000;     0.881;
     APtail-2                      192.168.1.5             3756;      397826;         0;         0;      3422;     0.968;     102.5; 0.0000000;     0.882;
     GWdict-GW                     192.168.1.1            14305;   114421797;         0;         0;         0;     3.686;   29483.7; 0.0000000;     0.000;
     GWtail-GW                     192.168.1.1             9537;     3627563;         0;         0;         0;     2.457;     934.7; 0.0000000;     0.000;
     SWdict-5                      192.168.1.10            5599;    21716676;         2;         6;         0;     1.443;    5595.9; 0.0005154;     0.000;
     SWdict-3                      192.168.1.11            5602;    21030671;         0;         6;         0;     1.443;    5419.1; 0.0000000;     0.000;
     SWdict-4                      192.168.1.12            5584;    21632975;         0;         6;         0;     1.439;    5574.3; 0.0000000;     0.000;
     SWdict-6                      192.168.1.13            5629;    21967817;         0;         6;         0;     1.450;    5660.6; 0.0000000;     0.000;
     SWdict-7                      192.168.1.14            5521;    21370121;         0;         6;         0;     1.423;    5506.6; 0.0000000;     0.000;
     SWdict-8                      192.168.1.17             732;     2953790;         0;         0;         0;     1.602;    6466.1; 0.0000000;     0.000;
     SWdict-2                      192.168.1.6             5817;    24501326;         0;         0;         0;     1.499;    6313.4; 0.0000000;     0.000;
     SWdict-1                      192.168.1.7             5806;    23997880;         0;         0;         0;     1.496;    6183.7; 0.0000000;     0.000;
     SWdict-0                      192.168.1.8             7527;    50497572;         0;         0;         0;     1.940;   13012.0; 0.0000000;     0.000;
   T O T A L S                     total                 105796;   422691327;         3;        30;     10260;    27.261;  108917.2; 0.0007730;     2.644;
   data stats === END              ===  total time measured: 2 16:40:51
                                   
   indigo update stats ===         ===  measuring started at: 01:37:10
      device                       updates:      85637;  updates/sec:       0.37;  updates/minute:      22.07
      states                       updates:     163452;  updates/sec:       0.70;  updates/minute:      42.12
   indigo update stats === END     ===  total time measured: 2  16:40:51

device props overview:
Code: Select all
                                                                    curr.;  exp;   use ping  ;   use what 4;       WiFi;         WiFi;    DHCP;         SWITCH;
   dev Name                        id:         MAC#             ;  status; time;    up;  down;       Status;     Status;max-idle Time;  ax-AGE; UPtime changed;
   AP-3-unifi                      83367414    44:d9:e7:02:4e:9e;      up;  150; False; False;       SWITCH;           ;             ;      60;           True;
   AP-4-unifi                      713090476   44:d9:e7:02:52:54;      up;  150; False; False;       SWITCH;           ;             ;      60;           True;
   AP-5-unifi                      1748250272  44:d9:e7:f9:c5:43;      up;  150; False; False;       SWITCH;           ;             ;      60;           True;
   SW_4_1_Dad                      934745187   f0:9f:c2:c5:b1:26;      up;  150; False; False;       SWITCH;           ;             ;      60;           True;
   UniFi-00:22:b0:e5:d4:c8         71719744    00:22:b0:e5:d4:c8;      up;  150; False; False;       SWITCH;           ;             ;      60;           True;
   UniFi-5c:cf:7f:88:c1:9b         453811651   5c:cf:7f:88:c1:9b; expired;  100; False; False;         WiFi;     UpTime;           30;        ;               ;
   UniFi-ac:29:3a:ec:a9:9e         1395386701  ac:29:3a:ec:a9:9e; expired;  150; False; False;       SWITCH;           ;             ;      60;           True;
   UniFi-alarmarduino              23019907    de:ad:be:ef:fe:ee;      up;  150; False; False;       SWITCH;           ;             ;      60;           True;

Posted on
Tue May 24, 2022 3:39 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: UniFi plugin: What, How, Where

Attention:
with MAC os 12.2 and higher you need to enable terminal to access directories.
in system prefs / security / privacy / full disk access / check terminal

This is needed as several functions to manage files for several functions ie camera pictures are launched in a terminal session.

Karl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests

cron