zbx-sadman / unifi_proxy

Fast client-server version of UniFi Miner
45 stars 21 forks source link

UniFi Controller with Multiple Sites #47

Open rrosson opened 2 years ago

rrosson commented 2 years ago

My unifi controller manages multiple sites. I have read through both the proxy and miner English manuals and I see no mention on how to implement this for each site when you have multiple sites on your controller. These sites are also monitored via zabbix by utilizing zabbix proxy.

TIA

zbx-sadman commented 2 years ago

Try UniFi Sites discovery rule from this template: https://github.com/zbx-sadman/unifi_proxy/blob/master/Zabbix_Templates/UniFi%20Proxy%201.3.0/UBNT_UniFi_Controller_v_5_Passive_Checks/zbx_v2_4_passive_Template_UBNT_UniFi_Controller_v_5.xml

rrosson commented 2 years ago

I guess I am missing something here. Currently in my unifi_proxy.conf that is installed on my unifi controller I have one of my sites set. Do I remove that entry from the conf file and it will discover the remainder of my sites? Also can I group the sites so they can be reponded to the responsible/delegated party to action them. Sorry that I am a little confused on how to get this working.

zbx-sadman commented 2 years ago

UniFi Proxy, and UniFi Miner just deliver data from UniFi controller to Zabbix.

You can ask they for discovery all sites on controller. Reply contain site IDs. You can use it to get data of one of sites.

When you take site IDs, you can build huge template with item prototypes and link it to one host in the Zabbix. All metrics for all sites will be in a bunch.

Also you can create many hosts, and point all of they to the same UniFi proxy. For example: first host's items will be ask Proxy for data of site 'rabradu' instead default, second host uses site id 'omnonom' , and so.

rrosson commented 1 year ago

Ok, I assume I just add an entry to zabbix and associate the unifi passive templates to it. Just not sure what the actual macro would be for it to have each site monitored individually without having to have a unifi_proxy.conf file for each site hosted on the controller.

If you know where this is documented on how to do what I am apparently not getting please share.

zbx-sadman commented 1 year ago

First, you must decide monitoring scheme: all sites linked to one Zabbx host entry, or every site linked to his own host entry.

rrosson commented 1 year ago

The later, every site linked to his own host entry.

zbx-sadman commented 1 year ago

Unfortunately, at this time i can't test all of it, but:

1) https://github.com/zbx-sadman/unifi_proxy/wiki/UniFi-Proxy-Guide-in-English ->

Script using: _[action],[object_type],[sitename],[key],[id or mac],[null_replacer],[cache_maxage]

Integration to monitoring system: UserParameter=unifi.proxy[*],echo "$1,$2,$3,$4,$5,$6,$7" | nc 127.0.0.1 8448 -q 1

When you call from template item with key unifi.proxy[discovery,uap,zc6h0sgv], where zc6h0sgv is Site ID (was Site Name on UniFi v3 controller), Proxy return list of UAP ID's and you can poll directly every UAP. If no Site ID specified, 'default' site discovered.

2) For UAP u can get UAP Template, import it and change discovery rule's key: unifi.proxy[discovery,uap, {$SITEID}] . {$SITEID} usermacro will used on Zabbix host level.

3) You can create host entry, link template to it, and add on Macros tab usermacro: {$SITEID} -> zc6h0sgv. Discovery rule will ask Proxy for all UAPs in the zc6h0sgv site and make real items from prototypes.

You can create many additional hosts entries, every for one UniFi site like that.

4) How to know all sites ID's? Run zabbix_get -s ... -k unifi.proxy[discovery,site] from CLI.

Thats is all, i guess.