Page 1 of 2

Windows server check for physical memory

Posted: Thu Feb 21, 2019 3:18 pm
by naranant
Hello Team,

The current memory check in Nagios XI is giving value which includes both physical and virtual. So i followed the below document to setup check for physical memory only.

https://support.nagios.com/kb/article/n ... l-169.html

So to Enable The NRPE Listener In NSClient++ 0.3.x i followed the below document.
https://assets.nagios.com/downloads/nag ... -0.3.x.pdf

When i try to test the connectivity from the Nagios XI to the client machine after following the above document. I am getting the below error.

"Could not construct return packet in NRPE handler check client side (nsclient.log) logs... " and when i check the log file it has an entry " 2019-02-21 15:10:23: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version."

Please advise on how to address this issue.

Re: Windows server check for physical memory

Posted: Thu Feb 21, 2019 4:29 pm
by cdienger
Try testing the check_nrpe command again but add the -2 option. This forces it to use nrpe version 2 - nsclient++ doesn't support version 3.

Re: Windows server check for physical memory

Posted: Thu Feb 21, 2019 5:33 pm
by SteveBeauchemin
You sure about version 3 support? NSClient 0.3.9 was -2 but 0.4.4 and 0.5x is okay with nrpe3 packets.
Check again...
I think OP may have a syntax error.
Steve B

Re: Windows server check for physical memory

Posted: Fri Feb 22, 2019 9:43 am
by lmiltchev
@naranant, can you show us the actual check, run from the command line along with the output of it?

Also, run the following commands on the Nagios XI server, and show the output:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <client ip>
/usr/local/nagios/libexec/check_nrpe -2 -H <client ip>
/usr/local/nagios/bin/nrpe -V
In addition to this, post the nsclient.ini file from the Windows machine on the forum.

Re: Windows server check for physical memory

Posted: Fri Feb 22, 2019 12:04 pm
by naranant
Hello,

I am attaching the screenshot of the output after running the command.

Also, I tried to set up the service in the configuration manager was not able to figure out where to put -2 parameter attaching those screenshot also.

When i use the below parameter by connecting to nagios server using putty i get the right output for the memory.

command: /usr/local/nagios/libexec/check_nrpe -H $host address$ -2 -p 5666 -c CheckMEM -a 'type=physical' MaxWarn=80% MaxCrit=90%
output recieved: OK memory within bounds.|'physical memory %'=30%;80;90 'physical memory'=2.48GB;6.4;7.2;0;8

Regards,
naranant

Re: Windows server check for physical memory

Posted: Fri Feb 22, 2019 1:14 pm
by lmiltchev
You are using an old version of NSClient++ that is not compatible with NRPE v3. Having said that, passing the "-2" flag works, so you could still use it (if you don't want to upgrade the NSClient++ version). However, in my opinion, 0.3.9 is a very old version, and you should upgrade the agent when you have a chance.

In order to add the "-2" flag to your command, you could change the check_nrpe command from this:

Code: Select all

define command {
    command_name    check_nrpe
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
to this:

Code: Select all

define command {
    command_name    check_nrpe
    command_line    $USER1$/check_nrpe -2 -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
Keep in mind that this will affect ALL of the checks that are using check_nrpe command! Depending on types of NRPE checks that you are using, you may want to create a custom check_nrpe command, e.g. check_nrpe_2, and use that one in this particular service. This way, you won't be affecting other checks.

Also, I noticed that in your service definition, you added "CheckMEM" to the $ARG2$ field, and "-a <args>" to $ARG3$ field. You need to use "CheckMEM" in $ARG1$ and "-a <args>" in $ARG2$.

Re: Windows server check for physical memory

Posted: Fri Feb 22, 2019 1:57 pm
by naranant
Thank you I will try this and will let you know. Meanwhile whats the process to upgrade the nsclient agent.. Do we need to resinstall the agent?

Re: Windows server check for physical memory

Posted: Fri Feb 22, 2019 2:25 pm
by lmiltchev
Here's some information on upgrading NSClient++:

https://docs.nsclient.org/howto/03x_migration/

https://forums.nsclient.org/t/upgrade-n ... r-0-5/4531

The syntax changed quite a bit in the newer versions of the agent. Even the config name changed from NSC.ini to nsclient.ini. I would recommend that you backup your NSC.ini file and any custom scripts that you might have in the NSClient++ scripts directory. Copy these in a safe location. Uninstall the old agent and install the new one. Make sure everything works with the "default" settings, then start copying over your "custom" commands/scripts to the new NSClient++. Some of the commands would need to be modified to work with the new version. If unsure, check the NSClient++ documentation.

Re: Windows server check for physical memory

Posted: Tue Feb 26, 2019 10:42 am
by naranant
Thank you.. i was able to test the physical memory usage by creating a new nrpe command.

Also was going through the documentation on nrpe agent installation. I am looking at the implementation of these on 1000+ client machine. So wanted to know if we have any automated way of doing this or is there way to upgrade rather than uninstall and fresh installation

Regards,

Re: Windows server check for physical memory

Posted: Tue Feb 26, 2019 3:41 pm
by npolovenko
@naranant, You could use Chef or Ansible to delete and deploy the new NSClient on 1000 servers. Once you install the new NSCLient you will likely need a modified nsclient.ini file that works with the latest version. I suggest upgrading one server first and coming up with the working version of the nsclient.ini. Once you come up with a working config you can deploy it to other servers.