zbx-sadman / unifi_miner

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

Still show data of deleted UAPs #7

Closed martinonicolas closed 6 years ago

martinonicolas commented 7 years ago

Hi, I Have a v5 Unifi controller with 4 UAPs conected. unifi_miner give me the correct answer when I search the amount of active UAPs ( ./unifi_miner.pl -a count -o uap -k "[state=1].state") and/or (./unifi_miner.pl -a sum -o uap -s default -k adopted).

But after I delete one UAP from the controller the discovery option still show me 4 UAPs connected to the controller. And show me the erased UAP at state=0 as it's disconected...

To compare this result I use https://github.com/malle-pietje/UniFi-API-browser and it show me the correct values.. (3 managed UAPs and 0 Disconected)

Thanks!

zbx-sadman commented 7 years ago

At first - try use -c 0 option to say Miner "use no cache". If it help to get right results - just decrease cache lifetime or do not rush so much.

On fail - you need to analyze cache file and looking for difference betweem JSON-objects of deleted and normal UAPs.

Just now i have used "Forget this UAP" button on v4 Controller and Miner show to me less number of records in LLD -JSON (-a discovery option).

martinonicolas commented 7 years ago

Thanks! It seams that if I use -l https://127.0.0.1:8443 the controller check from de cache. As you said, I have to use -c 0 to get the current values.

In spite of this I realized that if I use -l https://lan_ip:8443 I don't need to use -c 0. It seems that do not check the cache if you use de lan_ip.

Thanks a lot!

zbx-sadman commented 7 years ago

No any special handling for localhost or any other IP exists in the code.

Cache files for localhost may be owned by root / other non-zabbix account as a result of manual Miner running. In this case it is enough to clear cache dir or just reboot (if cache placed on RAM-disk) to get Miner works properly.