Page 1 of 1

nrpe error with yum service check only in my host

Posted: Tue Mar 06, 2018 7:16 am
by dimsum
Hi,

I run check nrpe on centos every service is ok. but I got a yum service was return "CHECK_NRPE: Socket timeout after 30 seconds."

On another server with the same service check is fine. I have no idea on this issue.

Please advice.

Thank you.

Re: nrpe error with yum service check only in my host

Posted: Tue Mar 06, 2018 4:14 pm
by cdienger
What is the exact command that the check is running? What is returned if you run "/usr/local/nagios/libexec/check_services -p <service_name>" on the remote system?

Re: nrpe error with yum service check only in my host

Posted: Wed Mar 07, 2018 3:21 am
by dimsum
Hi,

Please find the picture that I run nrpe command check.

Thank you.

Re: nrpe error with yum service check only in my host

Posted: Wed Mar 07, 2018 1:32 pm
by npolovenko
@dimsum, What happens when you manually run the nrpe command from the nagios server?

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H remote_server_ip -t 30  -c check_yum
Actually, I think I know what the problem is. The check_yum command is not defined in /usr/local/nagios/etc/nrpe.cfg on the remote server. Open that file and scroll all the way down till you see the command definitions:

Code: Select all

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
Add a new one underneath:

Code: Select all

command[check_yum]=/usr/local/nagios/libexec/check_services -p yum
Exit out of the file and restart the nrpe with the appropriate command:

Code: Select all

service nrpe restart
or

Code: Select all

service xinetd restart
Depending on your installation.

Re: nrpe error with yum service check only in my host

Posted: Sun Mar 11, 2018 11:18 pm
by dimsum
I try to add the command line into nrpe.conf then restart service I found the return is 7 what is mean?

Thank you.

Re: nrpe error with yum service check only in my host

Posted: Mon Mar 12, 2018 9:56 am
by npolovenko
@dimsum, I believe it shows a number of processes currently running that contain the word "yum". Looks like its working.

Code: Select all

      amt=$(ps aax | egrep "$patern" | grep -v egrep | grep -v "$PROGNAME" | wc -l | sed 's| ||g')
                str="$patern: $amt"
                if [ $amt -lt 1 ]; then
                        str="*** $patern: Nok ***"
                        exitstatus=$STATE_CRITICAL
                fi
                res="$res  $str"