Page 1 of 1

Nagios / NSclient 4.1 /NRPE Ignores parameters

Posted: Mon Jan 23, 2017 12:46 pm
by ndj
Hello everyone,

So today i've been setting up my nagios server and client to monitor their physical memory, I'm using a linux nagios box and a windows server 2012 with NSClient++

So i've went into my nsclient.ini and changed this;

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
this is how the default checkMem looks in my nsclient.ini

Code: Select all

; alias_mem - Alias for alias_mem. To configure this item add a section called: /settings/external scripts/alias/alias_mem
alias_mem = checkMem MaxWarn=80% MaxCrit=90% ShowAll=long type=physical type=virtual type=paged type=page

(and restarted the nsclient service)

I also defined my command in my commands.cfg

Code: Select all

# 'check_mem' command definition
define command{
        command_name    check_mem
        command_line   /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=$ARG1$ MaxCrit=$ARG2$ type=physical
       }
And this is how my windows.cfg looks like where I define the service:

Code: Select all

define service{
        use                     generic-service
        host_name               SEY-ERP03,SEY-ERP02
        service_description     Physical Memory Usage
        check_command           check_mem!85!95
        }
This is how it looks when I run it manually and I ask the errorcode = 2 according to the docs this is indeed critical

Code: Select all

[root@SEY-NAGIOS objects]# /usr/lib64/nagios/plugins/check_nrpe -H SEY-ERP03 -p 5666 -c CheckMEM -a MaxWarn=80 MaxCrit=90 ShowAll type=physical
CRITICAL: physical memory: Total: 16G - Used: 11.5G (71%) - Free: 4.55G (29%) > critical|'physical memory %'=71%;99;99 'physical memory'=12298706944B;80;90;0;17179398144
[root@SEY-NAGIOS objects]# echo $?
2
So my question is why is nagios ignoring my parameters ? I want them to only go on warning/critical when USED PHYSICAL MEM is 85% and 95%
Any help would be greatly appreciated

EDIT: some extra information this is what I can read from the webui :

Code: Select all

Current Status:	  CRITICAL   (for 0d 1h 6m 46s)
Status Information:	CRITICAL: physical memory: Total: 16G - Used: 11.5G (71%) - Free: 4.49G (29%) > critical
Performance Data:	'physical memory %'=71%;100;99 'physical memory'=12360978432B;0;90;0;17179398144
Current Attempt:	3/3  (HARD state)
Last Check Time:	01-23-2017 16:37:56
Check Type:	ACTIVE
Check Latency / Duration:	0,000 / 0,000 seconds
Next Scheduled Check:  	01-23-2017 16:47:56
Last State Change:	01-23-2017 15:38:53
Last Notification:	01-23-2017 15:42:53 (notification 1)
Is This Service Flapping?	  NO   (5,00% state change)
In Scheduled Downtime?	  NO  
Last Update:	01-23-2017 16:45:36  ( 0d 0h 0m 3s ago)
and this is something i've got from messing around with the nssclient ++
Image

Re: Nagios / NSclient 4.1 /NRPE Ignores parameters

Posted: Mon Jan 23, 2017 5:05 pm
by mcapra
It's worth mentioning that altering the NSClient++ alias alias_mem bears no weight on calling the actual CheckMEM command.

You might try upgrading to the latest version of NSClient++:
https://www.nsclient.org/download/

I was unable to reproduce this against the recommended bugfix versions of 0.4.1 and 0.4.3:

Code: Select all

[root@xi-stable ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.67.99
I (0,4,1,90 2013-02-04) seem to be doing fine...
[root@xi-stable ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.67.99 -c CheckMEM -a MaxWarn=75% MaxCrit=90% ShowAll type=physical
OK: physical memory: 2.63G|'physical memory %'=65%;75;90 'physical memory'=2.62G;3;3.58999;0;3.99
[root@xi-stable ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.67.99 -c CheckMEM -a MaxWarn=50% MaxCrit=60% ShowAll type=physical
CRITICAL: physical memory: Total: 4G - Used: 2.62G (65%) - Free: 1.38G (35%) > critical|'physical memory %'=65%;50;60 'physical memory'=2.62G;2;2;0;3.99

###

[root@xi-stable ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.67.99
I (0.4.3.143 2015-04-29) seem to be doing fine...
[root@xi-stable ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.67.99 -c CheckMEM -a MaxWarn=75% MaxCrit=90% ShowAll type=physical
OK: physical: Total: 3.999GB - Used: 2.628GB (65%) - Free: 1.371GB (34%)|'physical'=2.62804GB;2.99957;3.59949;0;3.99943 'physical %'=65%;75;89;0;100
[root@xi-stable ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.67.99 -c CheckMEM -a MaxWarn=50% MaxCrit=60% ShowAll type=physical
CRITICAL: physical: Total: 3.999GB - Used: 2.629GB (65%) - Free: 1.37GB (34%)|'physical'=2.62948GB;1.99971;2.39966;0;3.99943 'physical %'=65%;50;59;0;100
Can you share your specific NSClient++ and check_nrpe versions? These commands executed from the CLI of your Nagios Core machine should do the trick:

Code: Select all

/usr/lib64/nagios/plugins/check_nrpe -H SEY-ERP03
/usr/lib64/nagios/plugins/check_nrpe
Can you also share your complete NSClient++ configuration file from the remote machine?

Re: Nagios / NSclient 4.1 /NRPE Ignores parameters

Posted: Tue Jan 24, 2017 3:09 am
by ndj
So this is my NSclient++ version:

Code: Select all

[root@SEY-NAGIOS ~]# /usr/lib64/nagios/plugins/check_nrpe -H SEY-ERP03
I (0,4,1,73 2012-12-17) seem to be doing fine...
and this is my nrpe version

Code: Select all

[root@SEY-NAGIOS ~]# /usr/lib64/nagios/plugins/check_nrpe
Incorrect command line arguments supplied

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
and indeed I was thinking to maybe upgrade to a later version of NSClient ++ but that would mean I also have to change the command since they use diffrent commands ?

Re: Nagios / NSclient 4.1 /NRPE Ignores parameters

Posted: Tue Jan 24, 2017 10:21 am
by ndj
Fixed this issue by updating my NSCLIENT to 5.0

Re: Nagios / NSclient 4.1 /NRPE Ignores parameters

Posted: Tue Jan 24, 2017 11:47 am
by mcapra
Awesome! Did you have additional questions regarding this issue, or can we close this thread and mark it as resolved?