patricegautier/unifiZabbix

SERVER_DISCOVERY returns nothing

RainCaster opened this issue · 8 comments

This happens for me when clicking through the zabbix UI, and it also occurs when I run the mca-dump-short.sh script.
-t SWITCH / AP / UCK / UNVR4 works
-y SWITCH_FEATURE_DISCOVERY works too
-t SWITCH_DISCOVERY returns nothing

zabbix is running on Ubuntu LTS 22.04 with consistent updates.
My unifi network is managed by a UCKG2+ running 3.0.13 and Unifi Network is v7.3.76
The UNVR4 is running 3.0.13 with Protect v2.6.17

I have 5 switches all are running the latest FW.
USW 16 Poe
US 8 60W
USW Flex Mini (these don't show up- which is normal)

try to run mca-dump-short with -vw see if anything pops out..

Also, anything interesting in the zabbix server logs?

also, is the Switch Port Discovery discovery rule item in the unsupported state on those switches? If so, what's the error show (go to hosts > find a switch > discovery rules

The Switch Port Discovery rule is enabled, as is POE Discovery and POE Discovery by Port. The Fan Discovery is "not supported" and the error says: [Preprocessing failed for: [{"power":true,"total_power_consumed_key_name":"total_power_consumed","max_power_key_name":"max_p...

  1. Result: [{"power":true,"total_power_consumed_key_name":"total_power_consumed","max_power_key_name":"max_p...
  2. Failed: cannot extract value from json by path "$[?(@.has_fan=="true")]": no data matches the specified path]
  3. Same status for Temperature Discovery, and similar message.

Server logs show a number of different entries about timeouts. All t5he ones for SWITCH_DISCOVERY and SWITCH_FEATURE_DISCOVERY simply say "Timeout while executing a shell script." The SWITCH entries occasionally will show "became not supported: Timeout while executing a shell script." or "became supported".

Running the script manually with -vw shows:
ssh -o PubkeyAcceptedKeyTypes=+ssh-rsa -o HostKeyAlgorithms=+ssh-rsa -o LogLevel=Error -o StrictHostKeyChecking=accept-new tomf@192.168.0.253 mca-dump | jq del (.port_table[].mac_table)
Port replacement Program: /tmp/unifiSwitchDiscovery/switchPorts-192.168.0.253.jq
jqProgramFile: /tmp/unifiSwitchDiscovery/switchPorts-192.168.0.253.jq

Of course, the .jq files are erased by the script if they ever existed.

The script was taking about 3.7 to 4.8 sec to run. I changed the timeout to 10 in hopes of fixing the problems.

I have found several problems-

  1. My version of Ubuntu did not have the "expect" package installed by default. The fix is "sudo apt install expect"
  2. Once I took out the debug flags from my script, it is now sending me a nice big json file for SWITCH_DISCOVERY.
  3. This is using your new version of the mca-dump-short script.

Wait I just saw that you are now getting correct json.. so I think that closes the issue