Page 4 of 4
Re: Nsclient++ Check_Mem
Posted: Thu Mar 13, 2014 12:56 pm
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.
Re: Nsclient++ Check_Mem
Posted: Fri Mar 14, 2014 4:45 am
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.
Re: Nsclient++ Check_Mem
Posted: Fri Mar 14, 2014 9:50 am
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
Re: Nsclient++ Check_Mem
Posted: Fri Mar 14, 2014 9:55 am
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
Re: Nsclient++ Check_Mem
Posted: Fri Mar 14, 2014 10:20 am
by tenda21
Done
works, solved the problem changing NSClient + + 4.2.x, NSClient++ 3.9.x, and using alias mem.
Tanks for help
Re: Nsclient++ Check_Mem
Posted: Fri Mar 14, 2014 10:22 am
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
Re: Nsclient++ Check_Mem
Posted: Fri Mar 14, 2014 10:37 am
by lmiltchev
@tenda21
I am glad your issue has been resolved! I am locking this topic.
@FTL
Thanks for the help!