Page 1 of 1

check appache

Posted: Mon Jun 16, 2014 8:39 am
by hanya.radwan
hi,

I tried to check apache on solaries server, but always the result as the following:
[root@nms ~]# /usr/local/nagios/libexec/check_nrpe -H 10.103.200.63 -t 120 -c check_init_service -a 'httpd'
NRPE: Unable to read output

thanks,

Re: check appache

Posted: Mon Jun 16, 2014 9:15 am
by slansing
How do you have "check_init_service" defined on the solaris server's nrpe.cfg? Can you verify there is actually a service called httpd running?

Re: check appache

Posted: Tue Jun 17, 2014 8:52 am
by hanya.radwan
this service (check_init_service) not defined in NRPE.cfg file . also there is service named httpd on this server

Re: check appache

Posted: Tue Jun 17, 2014 9:14 am
by slansing
You cannot run a check command through NRPE if it is not defined... Please read over the following document, it will show you how to add new commands in the NRPE.cfg file, for additional plugins:

http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf

Re: check appache

Posted: Wed Jun 18, 2014 8:09 am
by hanya.radwan
I can't find the plugin of check_init_service

Re: check appache

Posted: Wed Jun 18, 2014 9:23 am
by slansing
If you cannot find it on that server, then it does not exist, so you cannot call it... You will need to find a suitable plugin, either in the nagios plugins package, or via the exchange, then set it up with a new command in the nrpe.cfg file, and restart xinetd if that is what you use to initiate NRPE (default if you ran the xi agent installer).

Re: check appache

Posted: Sun Jun 22, 2014 7:12 am
by hanya.radwan
sorry for late:

I check about process java in remote host , but always the error as following, also I define check_procs command in nrpe.cfg as attached:-
COMMAND: /usr/local/nagios/libexec/check_nrpe -H 10.103.200.63 -t 120 -c \'check_procs "-c 1:40 -w 1:20" -a "java"\'
OUTPUT: CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

other nrpe service, it is Ok :

COMMAND: /usr/local/nagios/libexec/check_nrpe -H 10.103.200.63 -t 120 -c check_cpu_stats -a '-w 80,40,30 -c 95,60,40'
OUTPUT: CPU STATISTICS OK : user=1% system=0%, iowait=0%, idle=99%, nice=0.00%, steal=0.00% | CpuUser=1%;80;95;0; CpuSystem=0%;40;60;0; CpuIowait=0%;30;40;0; CpuIdle=99%;0;0;0; CpuNice=0.0%;0;0;0; CpuSteal=0.0%;0;0;0;

Re: check appache

Posted: Sun Jun 22, 2014 3:36 pm
by Box293
You have a couple of things that need fixing.

We'll be ignoring the java bit to start off with, it just makes it easier to explain.

In nrpe.cfg you have this defined:

Code: Select all

command[check_procs]=/opt/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
Which means the command needs to be:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.1.133 -t 120 -c check_procs -a 1:20 1:40 secret
Notice how the command does NOT include the -w -c and -s argument flags. NRPE only needs the values for the arguments.

Which outputs something like:

Code: Select all

PROCS CRITICAL: 141 processes
Now if you DON'T have a secret and you try and run this command:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.1.133 -t 120 -c check_procs -a 1:20 1:40
You will get this output:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.1.133 -t 120 -c check_procs -a 1:20 1:40
Usage: check_procs -w <range> -c <range> [-m metric] [-s state] [-p ppid]
 [-u user] [-r rss] [-z vsz] [-P %cpu] [-a argument-array]
 [-C command] [-t timeout] [-v]
Which is basically telling us one of the arguments was not correct (the value for -s was not supplied).

I assume you are not using a secret with NRPE. Also, to check a process the nrpe.cfg needs to know what argument will contain the process name. So this means your nrpe.cfg file needs the following line:

Code: Select all

command[check_procs]=/opt/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -a $ARG3$
Notice how we changed -s to -a

Edit nrpe, make the changes, save the file and restart the service

Code: Select all

service xinetd restart
Now the command you will execute from your Nagios host will be:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.1.133 -t 120 -c check_procs -a 1:20 1:40 java
Which will output something like:

Code: Select all

PROCS OK: 2 processes with args 'java'
This should sort your problem out, let us know how you go.

Re: check appache

Posted: Mon Jun 23, 2014 8:34 am
by hanya.radwan
it is working

Re: check appache

Posted: Mon Jun 23, 2014 8:51 am
by tmcdonald
Great! Thanks a ton, Box. Closing this one up.