zbx-sadman / unifi_proxy

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

Lots of Unsupported Items - Zabbix Passive Checks Templates #33

Closed evertonbernardi closed 4 years ago

evertonbernardi commented 5 years ago

Hello,

First of all thank you so much for the amazing work done here! I've been facing more than 1000 unsupported items in Zabbix with the following message:

Preprocessing failed for:

  1. Failed: cannot convert value of type "string" from boolean format: invalid value format

I noticed the issue is being caused because Unifi Controller's API is returning the string 't' for the keys and the template is expecting a boolean value (Numeric (unsigned)). I assume they've changed it recently.

Here is an example of key and the return I receive from unifi_proxy:

_zabbix_agentd -t unifi.proxy[get,wlan,ibshgukd,schedule_enabled,588aa961c2dc433e74e46248] unifi.proxy[get,wlan,ibshgukd,scheduleenabled,588aa961c2dc433e74e46248] [t|]

What can I do to solve this issue?

Best regards,

Everton Bernardi

zbx-sadman commented 5 years ago

Hello

I guess that Unifi Controller's API can return nothing ( '', empty string ), because [t|return_value_there] - it zabbix agent's output format, when it called with -t option.

So, two possible cases there: 1) Unifi Controller's API return empty string (but that so strange); 2) This JSON key (_scheduleenabled, for example) is obsolete on your Unifi Controller release. Ubiquiti some times in the v5.x branch changed structure/keys of the API answer .

You need to check cache file or ask unifi.proxy for raw output: zabbix_get -s 192.168.0.1 -k unifi.proxy[raw,wlan,,*] . If you see no _scheduleenabled key, then just disable prototype in the discovery rule.

evertonbernardi commented 5 years ago

Hello @zbx-sadman . Thank you for your fast reply!

Unfortunately the Controller's API is returning an empty value. I have disabled those items and I can live without them. :)

I was investigating other "Not Supported" items and found the following:

_Item: WiFi client score average Key: unifi.proxy[get,wdg_health,9o82sesq,"wifi_score.client_scoreavg"] Status: Value "-1" of type "string" is not suitable for value type "Numeric (unsigned)"

zabbix_agentd -t unifi.proxy[get,wdg_health,9o82sesq,"wifi_score.client_score_avg"]
unifi.proxy[get,wdg_health,9o82sesq,wifi_score.client_score_avg] [t|-1]

This only seems to happen when negative numbers are returned (I think the "minus" signal makes Zabbix understand the value is a string instead of a number).

Is there any solution for this?

Regards

Everton Bernardi

zbx-sadman commented 5 years ago

Just change Item's data type to "Numeric (float)".

Ubiquiti do not publish API format - i can only guess about key's values range when create Item's prototype.

evertonbernardi commented 5 years ago

OK. That did the trick!

Thank you so much for your help.

Best regards,

Everton Bernardi