I have a problem with some zabbix triggers not firing due to the fact that EnableRemoteCommands
hasn't been enabled on certain hosts. I tried to address this by adding a trigger specifically checking whether EnableRemoteCommands is set to 1 in the zabbix agent config:
{Template OS Linux:system.run["cat /etc/zabbix/zabbix_agentd.conf | grep EnableRemoteCommands=1"].str(EnableRemoteCommands=1)}=0
But, of course, this trigger itself relies on remote commands, so won't run on hosts which has them disabled.
For some reason, if zabbix can't run a remote command, then it leaves the trigger with an "OK" status. Is there any way to get this to switch to a "PROBLEM" status?
Best Answer
Use UserParameter which is working without
EnableRemoteCommands
enabled:UserParameter=<key>,<command>
In your case:
UserParameter=zabbix.remotecommands, egrep 'EnableRemoteCommands.*=.*1' /etc/zabbix/zabbix_agentd.conf
Then create an item
zabbix.remotecommands
with typeZabbix Agent
and following statement to check:{Template OS Linux:zabbix.remotecommands.strlen()}=0
It will fire if item will return nothing, e.g.
EnableRemoteCommands
is disabled. Please don't usesystem.run
when you absolutely don't need to, it's disabled by default by purpose — you can do anything using other ways Zabbix provides you with.