1

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?

2 Answers 2

2

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 type Zabbix 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 use system.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.

3
  • This solution has the same problem as with remote commands: I have to configure it on all of the agents and I can't work out how to monitor which agents have been configured correctly and which haven't.
    – lucas
    Dec 25, 2015 at 17:18
  • You have to deliver /etc/zabbix/conf.d/somefile.conf to them once and restart zabbix-agent service, that's true. Dec 26, 2015 at 19:14
  • So how do I monitor whether that file has been delivered correctly? There's many reasons why one of the machines mightn't have been updated, or perhaps the file gets deleted later on. This solution doesn't answer my question, it's just a different mechanism for getting into the same problem.
    – lucas
    Dec 26, 2015 at 22:54
1

If the main agent configuration is done in one file only, we could probably make use of vfs.file.regexp item (or vfs.file.regmatch) here. For instance:

vfs.file.regexp[{$AGENT_CONFIG},^EnableRemoteCommands=1]

This is not perfect though, because it only searches the main configuration file for EnableRemoteCommands setting, but this setting may be overridden in an included file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .