check appache

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
hanya.radwan
Posts: 194
Joined: Tue Feb 25, 2014 6:12 am
Location: palestine

check appache

Post 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,
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check appache

Post 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?
hanya.radwan
Posts: 194
Joined: Tue Feb 25, 2014 6:12 am
Location: palestine

Re: check appache

Post by hanya.radwan »

this service (check_init_service) not defined in NRPE.cfg file . also there is service named httpd on this server
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check appache

Post 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
hanya.radwan
Posts: 194
Joined: Tue Feb 25, 2014 6:12 am
Location: palestine

Re: check appache

Post by hanya.radwan »

I can't find the plugin of check_init_service
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check appache

Post 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).
hanya.radwan
Posts: 194
Joined: Tue Feb 25, 2014 6:12 am
Location: palestine

Re: check appache

Post 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;
You do not have the required permissions to view the files attached to this post.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check appache

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
hanya.radwan
Posts: 194
Joined: Tue Feb 25, 2014 6:12 am
Location: palestine

Re: check appache

Post by hanya.radwan »

it is working
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check appache

Post by tmcdonald »

Great! Thanks a ton, Box. Closing this one up.
Former Nagios employee
Locked