Windows server check for physical memory

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Windows server check for physical memory

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Windows server check for physical memory

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

Re: Windows server check for physical memory

Post 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
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows server check for physical memory

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: Windows server check for physical memory

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows server check for physical memory

Post 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$.
Be sure to check out our Knowledgebase for helpful articles and solutions!
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: Windows server check for physical memory

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows server check for physical memory

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: Windows server check for physical memory

Post 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,
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Windows server check for physical memory

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked