Would it be possible to convert this template to be used in Zabbix 6.0 LTS?
Ad Widget
Collapse
Monitor UniFi Controller via API without additional scripts
Collapse
X
-
-
Thanks for this template.
I was able to import it on Zabbix 6.0 and it's working fine for Unifi Controller on linux servers.
I am trying to make it work against UDM or CloudKey Gen2
I know for a fact that,
1: Port is different, it uses 443 as default
2: Login URL API is different, it uses: /api/auth/login instead of /api/login
3: API for Network app (on cloud key) is reachable through: /proxy/network/api/stat/sites instead of /api/stat/sites
If i do not modify anything to the script, i have a 404 result.
If i modify the code
it returnsCode:var obj = JSON.parse(value); host = obj.host; port = obj.port; user = obj.user; password = obj.password; var response, login = new HttpRequest(); login.addHeader('Content-Type: application/x-www-form-urlencoded'); response = login.post( 'https://'+host+':'+port+'/api/auth/login', '{"username": "'+user+'", "password": "'+password+'"}' ); if (login.getStatus() !== 200) { throw 'Login failed with status code ' + login.getStatus() + ': ' + response; } try { response = login.get('https://'+host+':'+port+'/proxy/network/api/stat/sites'); response = JSON.parse(response); } catch (error) { throw 'No JSON Response'; } sites = response.data; return JSON.stringify(sites);
Cannot execute script: Error: cannot get URL: Timeout was reached.- at [anon] (httprequest.c:375) internal
- at [anon] () native strict preventsyield
- at [anon] (function:12) preventsyield
Does anyone knows why ?Comment
-
Hey guys!
It worked until the part where it discovers it on the website, but then it displays the error
Can't run the script, no Json response, any ideas how to resolve it?Comment
-
-
-
-
yes michael... the problem continue...tikoretech are you still facing this issue? Sorry for the late response.Comment
-
Comment
-
Comment
-
hi,
I got it working and it's awesome!,
Maybe a weird request, we have multiple sites and sometimes we are preparing AP or Switches for our customers, once prepped and provisioned they are taken offline till they are shipped / installed on site.
They now show up as offline, we had a script before in Zabbix that filtered the devices were the name started with "#" or "^".
Is there a small possibility that device filter can be implemented so we can select or name devices that are prepared or waiting for installation or is there an easy way to implement this ourselfs?Comment
-
Comment
-
are you removing the APs from the controller after you configured them? If you remove them, everything should be fine.hi,
I got it working and it's awesome!,
Maybe a weird request, we have multiple sites and sometimes we are preparing AP or Switches for our customers, once prepped and provisioned they are taken offline till they are shipped / installed on site.
They now show up as offline, we had a script before in Zabbix that filtered the devices were the name started with "#" or "^".
Is there a small possibility that device filter can be implemented so we can select or name devices that are prepared or waiting for installation or is there an easy way to implement this ourselfs?
The number about connected / adopted APs are returned by the UniFi Controller API and these values are not related to any name. So it is not possbile to filter these.
If you use different sites I can add a "filter" based on regex for sites to:- Option A: dont create triggers if the names patches the regex
- Option B: ignore the whole site

Comment
-
Comment
-
Comment
Comment