Hey people 
I have some strange issue on my zabbix installation, everything's going great apart from a thing. I have a dhcp server on a virtual machine and I want to monitor if this service is available or not, so I went on the VM and modified the zabbix agent configuration with something like that,
UserParameter=dhcp,ps -fu dhcpd | grep dhcpd | wc -l
Sounds simple enough, entering this on my command line prompt and I get the desired result. The problem is that Zabbix is always reporting me the value "0" which is not what I want since theses commands do not return that at the moment (they return 1 because it is actually running)
So I went debugging mode and found something interesting,
26936:20140719:014537.355 Run remote command [ps -fu dhcpd | grep dhcpd | wc -l] Result [1] [0]...
26936:20140719:014537.355 Sending back [0]
So Zabbix Agent did run my command but it seems like it's saying it returns two results, 0 and 1. What is that for?
Also he's sending the result I do not want: 0.
Could anyone explain me why did Zabbix had this behavior?
instead the simple,
UserParameter=dhcp,echo 1
works great and successfully return 1. I really do not understand...
Any help would be greatly appreciated
++

I have some strange issue on my zabbix installation, everything's going great apart from a thing. I have a dhcp server on a virtual machine and I want to monitor if this service is available or not, so I went on the VM and modified the zabbix agent configuration with something like that,
UserParameter=dhcp,ps -fu dhcpd | grep dhcpd | wc -l
Sounds simple enough, entering this on my command line prompt and I get the desired result. The problem is that Zabbix is always reporting me the value "0" which is not what I want since theses commands do not return that at the moment (they return 1 because it is actually running)
So I went debugging mode and found something interesting,
26936:20140719:014537.355 Run remote command [ps -fu dhcpd | grep dhcpd | wc -l] Result [1] [0]...
26936:20140719:014537.355 Sending back [0]
So Zabbix Agent did run my command but it seems like it's saying it returns two results, 0 and 1. What is that for?
Also he's sending the result I do not want: 0.
Could anyone explain me why did Zabbix had this behavior?
instead the simple,
UserParameter=dhcp,echo 1
works great and successfully return 1. I really do not understand...
Any help would be greatly appreciated

++
Thanks to the link you posted I tried vfs.file.exists on /var/run/dhcpd.pid. It won't work if the service is killed brutally but I don't think that is an issue.
Comment