Page 1 of 2

Nagios shows incorrect RAM usage

Posted: Tue Jan 07, 2014 3:03 pm
by DiegoAnjos
Hi everyone!

'My' nagios shows incorrect RAM values.
I am using Nagios Core 4.0.2 and plugins version is 1.4.16.
To check RAM I use:

Code: Select all

check_command     check_nt!MEMUSE!-w 60 -c 80
I checked on internet but I got more confused... I really appreciate if you could help me how to fix this, step by step.
I wonder what I have to do, but I dont know how (install nrpe, change command.cfg).

Thanks!

Re: Nagios shows incorrect RAM usage

Posted: Tue Jan 07, 2014 3:16 pm
by abrist
You need to just check the physical memory (not the entire memory pool). check_nt does not support this, though nsclient does through nrpe. It's a known issue. I would recommend using CheckMem with NRPE:
http://www.nsclient.org/nscp/wiki/CheckSystem/checkMem

Re: Nagios shows incorrect RAM usage

Posted: Tue Jan 07, 2014 3:41 pm
by DiegoAnjos
Thanks abrist!

So...

What do I insert on:
- commands.cfg
- serverfile.cfg (define service)
(If so, could you paste the samples for me?)

Do I need to change anything on NSC.ini?

Re: Nagios shows incorrect RAM usage

Posted: Tue Jan 07, 2014 4:12 pm
by abrist
You will need to create an nrpe service check (you should already have the check_nrpe command in command.cfg).
Your service check should include:

Code: Select all

check_command     check_nrpe!CheckMEM!MaxWarn=5% MaxCrit=60% ShowAll type=physical
You will also need to enable the nrpe handler in your nsclient config:
http://www.nsclient.org/nscp/wiki/NRPEListener

Re: Nagios shows incorrect RAM usage

Posted: Tue Jan 07, 2014 4:22 pm
by DiegoAnjos
So far I changed this:
Added this to commands.cfg

Code: Select all

define command {
  command_name CheckMEM
  command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=$ARG1$% MaxCrit=$ARG2$% ShowAll type=physical
}
And this to serverfile.cfg:

Code: Select all

define service{
	use			generic-service
	host_name		SRV1
	service_description	Memory Usage2
	check_command     check_nrpe!CheckMEM!MaxWarn=60% MaxCrit=80% ShowAll type=physical
	}
I got an error message:
Error: Service check command 'check_nrpe!CheckMEM!MaxWarn=60% MaxCrit=80% ShowAll type=physical' specified in service 'Memory Usage2' for host 'SRV1' not defined anywhere!

What am I missing?

Re: Nagios shows incorrect RAM usage

Posted: Tue Jan 07, 2014 5:06 pm
by abrist
If you define the following:

Code: Select all

define command {
  command_name CheckMEM
  command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=$ARG1$% MaxCrit=$ARG2$% ShowAll type=physical
}
Then you do not need to define the nrpe command and nrpe arguments in the service check - just the threshold arguments:

Code: Select all

define service{
   use         generic-service
   host_name      SRV1
   service_description   Memory Usage2
   check_command     checkMEM!<warn>!<crit>
   }
Replace <warn> and <crit> with your desired threshold values.
My suggestion would be to test the check from the cli first, in order to make sure that nsclient is configured correctly and that the check actually works from the nagios server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <ip of windows server> -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical

Re: Nagios shows incorrect RAM usage

Posted: Tue Jan 07, 2014 5:07 pm
by slansing
command_name CheckMEM
You need to use CheckMEM as your check_command in the service config file instead of check_nrpe if following the above directions.

Re: Nagios shows incorrect RAM usage

Posted: Wed Jan 08, 2014 9:32 am
by DiegoAnjos
abrist

I tried it through CLI (using WinSCP) and got the message below:

Code: Select all

/usr/local/nagios/etc/objects/servers$ /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

My NSC.ini:

Code: Select all

[modules]
NRPEListener.dll
NSClientListener.dll
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
CheckEventLog.dll
CheckHelpers.dll
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
;  You will need to enable some of these for NSClient++ to work.
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
; *                                                               *
; * N O T I C E ! ! ! - Y O U   H A V E   T O   E D I T   T H I S *
; *                                                               *
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
;FileLogger.dll
;CheckSystem.dll
;CheckDisk.dll
;NSClientListener.dll
NRPEListener.dll
;SysTray.dll
;CheckEventLog.dll
;CheckHelpers.dll
;CheckWMI.dll
Whats the next step?

Re: Nagios shows incorrect RAM usage

Posted: Wed Jan 08, 2014 12:01 pm
by abrist
This is usually due to an argument configuration mismatch between the nagios server's check and the remote agents configuration. Could you post your entire nsclient config? You may need to enable arguments in the nsclient config:

Code: Select all

allow arguments = true
See the following link:
http://www.nsclient.org/nscp/wiki/doc/usage/nagios/nrpe

Re: Nagios shows incorrect RAM usage

Posted: Wed Jan 08, 2014 12:53 pm
by DiegoAnjos
Hi abrist

I removed the ; from the line allow_arguments=1 on NSC.ini, restarted it and now it's working!

Code: Select all

WARNING: physical memory: Total: 7.99G - Used: 5.79G (72%) - Free: 2.2G (28%) > warning
This server NSClient version is NSClient++ 0.3.8.76 2010-05-27 and I will test with the others, that use version NSClient++ 0,4,1,73 2012-12-17 then I will post the result.