Scripts which are executed as zabbix UserParameter needs a way to return a temporary error gracefully. Currently if a script returns an empty response or other error message it's turned as "Not supported" in zabbix and thus the item is no longer updated. Currently Zabbix defines this as a feature as UserParameter scripts should always return some value and empty value indicates that the item is not supported. I think that current behavior is faulted and it needs to be changed some how to allow script to return a temporary error.
Few ideas how to fix this:
- Add a way how a script can gracefully return a value indicating a temporary error. This new type of error would not turn the item as "Not supported" in Zabbix. The error could be carried from script to zabbix_agent as a magic string or shell return code.
- Change Zabbix so that once an item has been marked as Active and working, any error returned by zabbix agent will not turn the item as "Not supported". If a item isn't no longer supported then a human operator needs to change the item status to "Not supported"
Current workarounds which have been suggested but aren't a good way to solve the problem:
- Add "| sed 's/^$/ERROR/'" to the end of the UserParameter which would change an empty response into a response indicating an error. This doesn't work in items which return value is a number. Also using some magic number to indicate error isn't a good solution because even if the error number wouldn't be in the range of accepted values it would pollute the graph visualization.
- Use .nodata() to detect errors states. If an item has been automaticly turned to "Not supported" by Zabbix then it's triggers are not longer executed and an alarm will not be raised.