plugin advice: cpu % idle and memory free

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
lyle
Posts: 158
Joined: Sun Nov 21, 2010 3:05 am

plugin advice: cpu % idle and memory free

Post by lyle »

This question is probably best asked on the nagiosplug-help list on Sourceforge, but someone here might have a bit of advice.

For political reasons, the most important data points on some of our servers are "cpu idle %" and "memory free %". "cpu load" isn't understood by some, and the idea that Oracle might sop up all available memory hasn't sunk in.

In any case, I'd like to monitor these metrics on Windows, Linux, and Solaris clients via nrpe or nsclient++

I've been looking through the options on Nagios Exchange, but wonder if someone here has a favorite client-side plugin or two.

Thanks...Lyle
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: plugin advice: cpu % idle and memory free

Post by tonyyarusso »

The attached files will do what you need for Linux & Solaris, and the Windows config wizard includes the proper parameters for NSClient++. The Linux Agent/Wizard include these checks as well, although with a different memory plugin.
Attachments
check_mem.pl
Memory check plugin (allows specifying how to count caches)
(8.42 KiB) Downloaded 135 times
check_cpu_stats.sh
CPU check plugin (requires sysstat package to be installed)
(5.46 KiB) Downloaded 124 times
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
lyle
Posts: 158
Joined: Sun Nov 21, 2010 3:05 am

Re: plugin advice: cpu % idle and memory free

Post by lyle »

Thanks for the plugin pointers, Tony. I've been poking around trying to see how this all would go together.

For the moment, I'm concentrating on getting these 2 service checks (cpu% used, and memory% used) working with a Windows Server 2008 R2, where I've got NSClient++ 0.3.8.76 installed.

If I understand you correctly, NSClient++ should be able to supply cpu% and memory% from it's internal checks, and not need any external plugins for these checks.

Testing interactively from our Core 3.0.3 installation, I get:

Code: Select all

root@asb-con-ngs-001:/usr/local/nagios/libexec #> ./check_nrpe -H 172.20.8.26 -c CheckMem -a MaxWarn=80% MaxCrit=90% type=physical ShowAll=long
OK: physical memory: Total: 4G - Used: 1.37G (34%) - Free: 2.63G (66%)|'physical memory %'=34%;80;90; 'physical memory'=1.36G;3.;3.;0;4; 
root@asb-con-ngs-001:/usr/local/nagios/libexec #> 
root@asb-con-ngs-001:/usr/local/nagios/libexec #> ./check_nrpe -H 172.20.8.26 -c CheckCPU -a warn=80% crit=90% ShowAll=long
OK CPU Load ok.
So I should be able to duplicate these under XI, using a manual configuration.

Only problem is, as you can see, the CheckCPU doesn't seem to be returning the actual values, like the CheckMem does. I'll take this up on the NSClient++ forum, but if you have any other ideas, or an external plugin I should investigate, I'd appreciate it.

Thanks...Lyle
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: plugin advice: cpu % idle and memory free

Post by tonyyarusso »

The easiest route would be to look at the Windows Server wizard code and see what arguments it uses.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
lyle
Posts: 158
Joined: Sun Nov 21, 2010 3:05 am

Re: plugin advice: cpu % idle and memory free

Post by lyle »

Thanks for the rapid reply, Tony.

Looks like XI is using the older NSClient (check_nt) transport. Here's what the XI config for the service check looks like:

Code: Select all

check_xi_service_nsclient!!CPULOAD!-l 5,85,95
check_xi_service_nsclient uses this command:

Code: Select all

 $USER1$/check_nt -H $HOSTADDRESS$ -s "$ARG1$" -p 12489 -v $ARG2$ $ARG3$ $ARG4$
and "check_nt -h" says, in part:

Code: Select all

Valid variables are:
 CPULOAD =  Average CPU load on last x minutes.
Although I haven't yet configured the NSClient++ to use both NRPE and NSClient transports, I don't think the canned XI checks will get me "% cpu" used or idle, just "load".

The NSClient++ forum responded that CheckCPU not returning performance data looked like a bug, and asked that I file a bug report.

In the meantime, maybe a script/plugin, external to NSClient++, will be a temporary workaround. Perhaps there's a Windows equivalent to the "check_cpu_stats.sh" that you provided for Linux. Any advice is appreciated.

BTW, the NSClient++ documentation says, when talking about which transport to choose:
check_nt only has some basic checks and is intended for backwards compatibility. You are limited to a handful of checks and there is no way to exploit the power of NSClient++ from here.
and:
check_nrpe: this is what I would think of the "normal" or prefered way to use NSClient++
Thanks again....Lyle
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: plugin advice: cpu % idle and memory free

Post by mguthrie »

We're currently working on some documentation for setting up checks with NSClient++ and nrpe, We should probably look at updating the windows wizard to use NRPE instead...
Locked