zbx-sadman / unifi_miner

UniFi Miner helps deliver data from UniFi Controller to Zabbix
66 stars 11 forks source link

Fail in line 861 #11

Open romoromor opened 6 years ago

romoromor commented 6 years ago

Hi, i have Unifi version 5.6.22. Your script works great, but when i get for example firmware version of AP, i get three lines of Use of uninitialized value in string eq at /etc/zabbix/scripts/unifiminer.pl line 861. and then is firmware version numbers. I'm not a python programmer, that mean, i don't know, what line 861 does. For this moment i fix this issue by delete , last if (@{$jsonData}[$i]->{$idKey} eq $[3]); from line 861. But i think, that isn't right solution:-) Please, can you help me? Thanks

zbx-sadman commented 6 years ago

I need to see JSON, which caused this error and command which you use.

File which contained JSON are placed in temporary catalog (/dev/shm on default) - it named like that: https___localhost_8443_api_s_default_stat_device_00_27_22_0a_16_a6\

You can send it to my email (placed on my profile).

martinonicolas commented 6 years ago

I have the same problem with Unifi Controller 5.6.26 I check the firmware version of various UAPs with de command: /opt/unifi_miner/unifi_miner.pl -a "get" -o "uap" -s "default" -k "serial" -i "UAP_ID" -c "0" -l "https://127.0.0.1:8443" -u 'xxxxxxxx' -p 'xxxxxxx' Use of uninitialized value in string eq at /opt/unifi_miner/unifi_miner.pl line 861. 802AA8028071

In some the result is ok, showing only the firmware version, but in others shows the mentioned error and then de firmware version.

Thanks!

zbx-sadman commented 6 years ago

Yes, this problem caused when a few unadopted devices exists on the UniFi Controller's Site. Seems that unadopted devices haven't "_id" key (may be since 5.5 branch started). If object that specified by -i option will be found in the list before object without "_id" key - all ok, otherwise - error is caused.

It was fixed, but in experimental release. Script must work ok, just i make long test with Zabbix 3.4 features.

rguy2001-zz commented 5 years ago

HI thanks for sharing. Do you have zabbix template that I can upload fro unifi aps?

zbx-sadman commented 5 years ago

Use this tempates: https://github.com/zbx-sadman/unifi_proxy/tree/master/Zabbix_Templates