check_nrpe - monitor memory usage on windows server

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

check_nrpe - monitor memory usage on windows server

Postby soliberus » Thu Jan 13, 2011 7:02 am

Hello everybody

I'm stuck. I'm running Nagios on Fedora and I've installed (and configured) NSClient++ on my Windows 2003 server.

I would like to monitor the memory usage of this server.

This is what I found in the provided documentation:

Sample Command:
CheckMEM MaxWarn=80% MaxCrit=90% ShowAll type=physical
OK: OK: physical: 758M (795205632B)

Nagios Configuration:
define command {
command_name <<CheckMEM>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=$ARG1$% MaxCrit=$ARG2$% }
<<CheckMEM>> 80!90

From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical


Now when I run the "check_nrpe -H IP -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical" command from my Fedora server's command line it works fine.

However, the "define command" bits don't work. Nagios isn't happy with the code provided above.

Has anyone else been successful in getting this working?

Many thanks
soliberus
 
Posts: 6
Joined: Thu Jan 13, 2011 6:53 am

Re: check_nrpe - monitor memory usage on windows server

Postby mguthrie » Thu Jan 13, 2011 10:09 am

Can you show us what the command definition and also the service definition looks like? Usually in cases like this the problem lies in how the arguments are quoted and/or broken up.
mguthrie
 
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: check_nrpe - monitor memory usage on windows server

Postby soliberus » Thu Jan 13, 2011 10:49 am

That is part of my problem. According to the documentation included with the NSClient++ software the command definition should be this:

Code: Select all
define command {
command_name <<CheckMEM>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=$ARG1$% MaxCrit=$ARG2$% }
<<CheckMEM>> 80!90


That doesn't look right to me and the nagios service won't start when I put it in commands.cfg

I don't know how to construct the service definition with check_nrpe, because my other service definitions are using check_nt.
soliberus
 
Posts: 6
Joined: Thu Jan 13, 2011 6:53 am

Re: check_nrpe - monitor memory usage on windows server

Postby mguthrie » Thu Jan 13, 2011 1:03 pm

The format for your command definition is incorrect. Here's are some examples:

Command Defintion Examples:
check_nt
Code: Select all
$USER1$/check_nt -H $HOSTADDRESS$ -p $USER7$ -s $USER8$ -v $ARG1$ $ARG2$


check_nrpe
Code: Select all
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$


Service Definition using NRPE:
Code: Select all
define service {
   host_name         <hostname>
   service_description      / Disk Usage
   use            xiwizard_nrpe_service
   check_command         check_nrpe!check_disk!-a '-w 20% -c 10% -p /'


Take a look at the Core Documentation for more information:
http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html
mguthrie
 
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: check_nrpe - monitor memory usage on windows server

Postby soliberus » Fri Jan 14, 2011 7:11 am

Okay, I've narrowed it down a bit. It seems that no arguments are passed to the windows host.

I've started NSClient++ in test mode on the Windows server.

When I execute the check_nrpe command from the command line it succeeds:

Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 10.100.90.53 -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical

WARNING: physical memory: Total: 0.999G - Used: 876M (85%) - Free: 147M (15%) > warning|'physical memory %'=85%;80;90; 'physical memory'=876.39M;818.75;921.10;0;1023.44;


...and it reports the following on the windows server:

d NSClient++.cpp(1106) Injecting: CheckMEM: MaxWarn=80%, MaxCrit=90%, ShowAll,
type=physical


As you can see, check_nrpe passed the arguments to Client++

Now, when I configure my Nagios server like this...

commands.cfg

Code: Select all
define command{
        command_name    checkMem
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c checkMem -a MaxWarn=80% MaxCrit=90%
                                 ShowAll type=physical
        }


windows-host.cfg

Code: Select all
define service{
       use                          generic-service
       host_name               svr-busobj01
       service_description   Memory Usage
       check_command      check_nrpe!checkMem
       }


... I get this on the Windows host:

d NSClient++.cpp(1106) Injecting: checkMem:
d NSClient++.cpp(1142) Injected Result: WARNING 'ERROR: Missing argument exception.'


So it seems that my Nagios configuration is not passing any arguments.
soliberus
 
Posts: 6
Joined: Thu Jan 13, 2011 6:53 am

Re: check_nrpe - monitor memory usage on windows server

Postby mguthrie » Fri Jan 14, 2011 11:42 am

You have a typo in your check definition.

Working command:
/usr/local/nagios/libexec/check_nrpe -H 10.100.90.53 -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical


Your command definition:
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c checkMem -a MaxWarn=80% MaxCrit=90% ShowAll type=physical
mguthrie
 
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: check_nrpe - monitor memory usage on windows server

Postby soliberus » Mon Jan 17, 2011 10:09 am

I have changed my command line to "CheckMEM", but the problem remains the same. No arguments are passed to the Client++ windows client via my service/command definitions.
soliberus
 
Posts: 6
Joined: Thu Jan 13, 2011 6:53 am

Re: check_nrpe - monitor memory usage on windows server

Postby mguthrie » Mon Jan 17, 2011 11:16 am

In that case I'd try testing putting the arguments in quotes, try these and see if either works.

Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 10.100.90.53 -p 5666 -c CheckMEM -a 'MaxWarn=80% MaxCrit=90% ShowAll type=physical'

/usr/local/nagios/libexec/check_nrpe -H 10.100.90.53 -p 5666 -c 'CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical'

/usr/local/nagios/libexec/check_nrpe -H 10.100.90.53 -p 5666 -c CheckMEM '-a MaxWarn=80% MaxCrit=90% ShowAll type=physical'
mguthrie
 
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: check_nrpe - monitor memory usage on windows server

Postby soliberus » Tue Jan 18, 2011 7:49 am

I've tried them all, but the none of them worked.

I cannot spend more time on this though, so I've decided to stick with check_nt. It may be inferior to check_nrpe, but at least it works.

Thanks for your help.
soliberus
 
Posts: 6
Joined: Thu Jan 13, 2011 6:53 am

Re: check_nrpe - monitor memory usage on windows server

Postby ethantester123 » Fri Apr 08, 2011 2:53 am

After going through n no of steps and searching many sites i finally got my nrpe CheckMEM working. Thanks to this post i got to the final step.

Here are the steps that i had to follow - right from the beginning:
1. Configure the NSC.ini host file correctly on windows host machine with following parameters:
a. Enable module NRPEListener.dll
b. Enable CheckExternalScripts.dll
c. Enable [NRPE] port no i.e port=5666
d. Enable [NRPE] arguments i.e allow_arguments=3 (can be any number you want)

2. Execute the CheckMEM command from command line as follows
/usr/local/nagios/libexex/check_nrpe -H 12.345.567.890 -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll=long type=physical

3.Create the command and service definitions in nagios cfg files as follows:
define command{
command_name check_nrpe_mem
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll=long type=page
}

define service{
use generic-service
host_name myhost
service_description Memory Usage
check_command check_nrpe_mem
}

4. Saved and restarted nagios.. And it worked exactly as i want.

I hope this info helps any one facing such problem

Note: I am using a Fedora virtual machine for my nagios monitoring server.
ethantester123
 
Posts: 4
Joined: Thu Apr 07, 2011 8:19 am

Next

Return to Community Support

Who is online

Users browsing this forum: No registered users and 24 guests