Nsclient++ Check_Mem

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nsclient++ Check_Mem

Post by slansing »

Did you copy your nsclient/nsc.ini file? Or manually remove a large chunk of it, even for the unexpanded file yours is very bare. You may need to look at re-installing nsclient, perhaps version 3.9.x instead of 4.0.x as it will already be expanded and should work from the start.
FTL
Posts: 72
Joined: Fri Oct 21, 2011 7:23 am

Re: Nsclient++ Check_Mem

Post by FTL »

Steps you need to do:

On Windows remote client you are monitoring:
  • Install NSClient++ - do not start the service.
    Check whatever firewall is on the machine (if any) and make sure port 5666 is open. Do a telnet from your nagios machine to remote server ip 5666 to check.
    Open up a cmd prompt and type in "cd C:\Program Files\NSClient++" without the "" - hit enter
    type in "nscp settings --generate --add-defaults --load-all" - without the "" - hit enter
    Go into C:\program files\nsclient++ and open up the nsclient.ini file
Match the following lines i am giving you in your nsclient.ini file (do a ctrl+f and copy the top line in and find it, then change the value)[/list]

Code: Select all

; NRPE server - A simple server that listens for incoming NRPE connection and handles them.
NRPEServer = 1

Code: Select all

; ALLOWED HOSTS - A comaseparated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts = your nagios servers IP

Code: Select all

; Section for NRPE (NRPEServer.dll) (check_nrpe) protocol options.
[/settings/NRPE/server]

; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = true

; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = true

; PORT NUMBER - Port to use for NRPE.
port = 5666
You can leave everything else as default for now.

Start the NSClient service from services.msc


On your Nagios box

Install check_nrpe as the root user - so change to the root user in a terminal
Now configure your Nagios with the following (substitute "use" and host_name" to match your requirements)

The actual service check for the host

Code: Select all

define service{
    use            your template              ; See Service Templates section below    
    host_name        your host                    
    service_description    MEMORY USAGE                    
    check_command        check_memory                   ; See Commands section below
    }
The command check for check_memory

Code: Select all

# 'check_memory' command defintion
define command{
    command_name    check_memory
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c checkMEM -a MaxWarn=XX% MaxCrit=XX% type=physical
    }
This is it - you will now have your memory monitored using check_nrpe via NSClient.

You need to do no more.
tenda21
Posts: 37
Joined: Tue Feb 25, 2014 7:55 am

Re: Nsclient++ Check_Mem

Post by tenda21 »

but wrong result:

Error: /usr/local/nagios/libexec/check_nrpe -H 192.168.1.218 -c check_memory
UNKNOWN: No handler for that command

Have version 3.9. as recommended slansing
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nsclient++ Check_Mem

Post by slansing »

Excellent outline FTL,

By default, NSClient++ has a handful of NRPE definitions which are slotted with "alias_" in front of them, give this one a shot:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.1.218 -c alias_mem
If you look in your NSC.ini file, you should see this:

Code: Select all

alias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll=long type=physical type=virtual type=paged type=page
tenda21
Posts: 37
Joined: Tue Feb 25, 2014 7:55 am

Re: Nsclient++ Check_Mem

Post by tenda21 »

Done
works, solved the problem changing NSClient + + 4.2.x, NSClient++ 3.9.x, and using alias mem.
Tanks for help
FTL
Posts: 72
Joined: Fri Oct 21, 2011 7:23 am

Re: Nsclient++ Check_Mem

Post by FTL »

tenda21 wrote:but wrong result:

Error: /usr/local/nagios/libexec/check_nrpe -H 192.168.1.218 -c check_memory
UNKNOWN: No handler for that command

Have version 3.9. as recommended slansing
No..........."check_memory" is just what i have called my own command is isnt the actual command parameter.

The actual check_nrpe command is checkMEM

so its

Code: Select all

check_nrpe -H 192.168.1.218 -p 5666 -c checkMem -a Maxwarn=90% Maxcrit=95% type=physical
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Nsclient++ Check_Mem

Post by lmiltchev »

@tenda21
I am glad your issue has been resolved! I am locking this topic.

@FTL
Thanks for the help!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked