Need help on how to pass arguments for check_memory

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.
Locked
nagios102
Posts: 5
Joined: Thu Sep 26, 2019 12:47 pm

Need help on how to pass arguments for check_memory

Post by nagios102 »

Hello,

I'm trying to configure check_memory for a Windows server (nsclient++). It works fine on the command line
./check_nrpe -H <xxxx> -c check_memory -a "warn=used>95%" "crit=used>98%"

but it does not work as a define command and service. I've tried using escape character and also putting the arguments in double quotes but it's not working. It works fine as default (without any arguments). I've also tried to passing the arguments from define service but same issue. I think it has something to do with the = sign. When editing the commands.cfg file, everything after the = sign (=used>95% crit=used>98%") is red. I need help on how to pass arguments for check_memory. Thanks.

define service{
host_name xxxxxxxxxxxxx
...
check_command check_nrpe!check_memory
}

Working: no arguments
define command{
command_name check_memory
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_memory
}

Not working: with arguments. (looks like it skips everything after -a. I've tried -a type=physical but it doesn't work either)
define command{
command_name check_memory
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_memory -a "warn=used>95% crit=used>98%"
}
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Need help on how to pass arguments for check_memory

Post by mbellerue »

Does anything show up in the message field when you have the service check configured? Usually this field shows whatever the output of the command was.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
nagios102
Posts: 5
Joined: Thu Sep 26, 2019 12:47 pm

Re: Need help on how to pass arguments for check_memory

Post by nagios102 »

I don't have the Nagios config tool (GUI). Can you recommend which one to use?

I can only edit config file manually and the Status on the web interface is showing "OK: committed = 15.108GB, physical = 10.791GB". The problem with the default setting is that warning is 80% or above and 90% for critical. However the server admin wants to have 90% for warning and 95% for critical so I've to add argument to filter the higher % alert. It seems it does not process anything after -a, even though the command line works fine with -a.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Need help on how to pass arguments for check_memory

Post by mbellerue »

Yes, the Status Information field in the web interface usually shows the output of the command. Does it show anything when the command isn't working?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
nagios102
Posts: 5
Joined: Thu Sep 26, 2019 12:47 pm

Re: Need help on how to pass arguments for check_memory

Post by nagios102 »

The status is still showing the output, for example OK: committed = 15.108GB, physical = 10.791GB" or WARNING: committed ....

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_memory -a "warn=used>90%" "crit=used>95%"

The check_memory is working fine. Right now, it seems to ignore everything after -a and still sends out Warning alert if the memory used is above 80% (the default).

I just need help on how to format the custom warning/critical part in red: -a "warn=used>90%" "crit=used>95%" so that Nagios will send out Warning alert if and only if memory usage is 90% or above. Thanks
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Need help on how to pass arguments for check_memory

Post by mbellerue »

Ah, yes I'm sorry I misunderstood. I thought the command was just plain not working when run as a service check.

Check the nsclient.ini file on your Windows server, can you verify that you have the following settings,

Code: Select all

allow arguments = 1
allow nasty characters = true
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
nagios102
Posts: 5
Joined: Thu Sep 26, 2019 12:47 pm

Re: Need help on how to pass arguments for check_memory

Post by nagios102 »

Yes, verified I've the following settings in my nsclient.ini:

Code: Select all

allow arguments = 1
allow nasty characters = true
As mentioned, the command works correctly on CLI but not as service check.
./check_nrpe -H <xxxxxx> -c check_memory -a "warn=used>90%" "crit=used>95%"
OK: committed = 15.592GB, physical = 11.145GB|'committed'=15.59186GB;18.44955;19.47452;0;20.4995 'committed %'=76%;90;95;0;100 'physical'=11.14541GB;14.39955;15.19952;0;15.9995 'physical %'=70%;90;95;0;100
nagios102
Posts: 5
Joined: Thu Sep 26, 2019 12:47 pm

Re: Need help on how to pass arguments for check_memory

Post by nagios102 »

Got it working finally! Thanks. :)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Need help on how to pass arguments for check_memory

Post by scottwilkerson »

nagios102 wrote:Got it working finally! Thanks. :)
Great!

Locking
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked