Before upgrade from Zabbix 6 to 7 I used the poorly documented feature of returning "ZBX_NOTSUPPORTED" in my custom scripts to let Zabbix server know that something wrong has happened to the item and it must switch to unsupported state instead of treating script's output as data.
Recently I was working on a new custom script and noticed that this no longer works: when my scripts return "ZBX_NOTSUPPORTED" Zabbix treats that as valid data in string format instead of displaying an error.
So, what's the trick to make it work in 7.0 ?
The usecase is the following: when an LLD script misbehaves it must signal to Zabbix server that its output is garbage and not to be treated as data.
Similarly, when a custom script used by Zabbix agent misbehaves, it must signal to server that it's now in unsupported state.
Steps to reproduce:
1. Create a new Discovery Rule with Type=Zabbix agent, Key=dummy;
2. In Zabbix agent settings define a new UserParameter=dummy,/path/to/script.sh, restart agent to apply the change;
3. Create a new bash script that does the following and make it readable and executable by Zabbix:
echo "ZBX_NOTSUPPORTED"; exit 1
4. In Zabbix server GUI open the discovery rule and press "Test", then "Get value and test".
Expected result:
There is a red banner on top of the Test item menu that reports that an error has occured;
Observed result:
The Value is populated with "ZBX_NOTSUPPORTED", - the string returned by the script is treated as valid data instead of an error signal.
Recently I was working on a new custom script and noticed that this no longer works: when my scripts return "ZBX_NOTSUPPORTED" Zabbix treats that as valid data in string format instead of displaying an error.
So, what's the trick to make it work in 7.0 ?
The usecase is the following: when an LLD script misbehaves it must signal to Zabbix server that its output is garbage and not to be treated as data.
Similarly, when a custom script used by Zabbix agent misbehaves, it must signal to server that it's now in unsupported state.
Steps to reproduce:
1. Create a new Discovery Rule with Type=Zabbix agent, Key=dummy;
2. In Zabbix agent settings define a new UserParameter=dummy,/path/to/script.sh, restart agent to apply the change;
3. Create a new bash script that does the following and make it readable and executable by Zabbix:
echo "ZBX_NOTSUPPORTED"; exit 1
4. In Zabbix server GUI open the discovery rule and press "Test", then "Get value and test".
Expected result:
There is a red banner on top of the Test item menu that reports that an error has occured;
Observed result:
The Value is populated with "ZBX_NOTSUPPORTED", - the string returned by the script is treated as valid data instead of an error signal.
Comment