Sunday, August 3, 2014

Debug a Nagios NRPE command



My nagios fail with fail2ban service. Whith an other command it's Ok:





nagios@server:/usr/lib/nagios/plugins$ /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c "check_load"



OK - load average: 0.00, 0.06, 0.08|load1=0.000;15.000;30.000;0; load5=0.060;10.000;25.000;0; load15=0.080;5.000;20.000;0;




With fail2ban service it don't work. This fail2ban script test this (see http://pastebin.com/1utP9iM6):



$(ps aux |grep "fail2ban.sock" |grep -v grep| wc -l)



If i test it with nagios user it correctly return 1. But when it's executed by NRPE it fail:




nagios@server:/usr/lib/nagios/plugins$ /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c "check_fail2ban" /var/log/fail2ban.log /etc/fail2ban/jail.conf 10 20



0



++++ Process is not running ++++





How can i debug more to found what is wrong ?


Answer



You could let the script log something to a file, e.g.:



ps aux > /tmp/debugfile


An alternative would be using the generic check_procs:




/usr/lib/nagios/plugins/check_procs -c 1:1 -C fail2ban-server

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...