Page 1 of 1
Use Nagios Core to report number of CPUs
Posted: Thu Oct 22, 2015 5:11 am
by neworderfac33
Good morning,
Once again, a big thank you to everyone out there for your continuing support!
Now - is it possible to get Nagios Core to return the number of installed CPUs (and possibly their speeds) on a server without having to install any additional plugins?
Thanks in advance
Pete
Re: Use Nagios Core to report number of CPUs
Posted: Thu Oct 22, 2015 9:34 am
by hsmith
Thanks for the 'shoutout'
What do you have running on the remote server? Technically you could write your own batch script and you wouldn't have to install anything!

However, I assume that's not the route you want to take.
Re: Use Nagios Core to report number of CPUs
Posted: Thu Oct 22, 2015 10:00 am
by neworderfac33
I just have NSClient++ running on the remote servers.
No, not being THAT gifted, I'd just like to do it in a similar way to how I monitor memory, CPU load and disk space within nagios at the moment, if that's at all possible.
Cheers
Re: Use Nagios Core to report number of CPUs
Posted: Thu Oct 22, 2015 10:10 am
by hsmith
Can you read through
Troy's article on his website and let me know if that clears any of it up?
Re: Use Nagios Core to report number of CPUs
Posted: Tue Oct 27, 2015 8:47 am
by neworderfac33
Good afternoon,
Although this article is useful in terms of returning information about the processors' performance, what i was really after was just a value showing how many processors there are.
More worryingly, I seem to have lost check_nrpe - should it be in /usr/local/nagios/libexec/ with all the other plugins?
I had to re-unzip the plugins .tar file to provide SSL support and now check_nrps's not there. Trouble is, until I read the article, I'd never had need to use check_nrpe, so I don't even know if it was there beforehand!
Or, am I just being really, REALLY stupid and missing something obvious?
Cheers
Pete
Re: Use Nagios Core to report number of CPUs
Posted: Tue Oct 27, 2015 4:43 pm
by tmcdonald
I can't say I know of anything off-hand that counts the number of CPUs, that would likely need to be custom coded in Bash or PowerShell depending on the OS you want to monitor. Most everything I have seen deals with utilization.
Regarding check_nrpe, it should be in /usr/local/nagios/libexec on an XI, otherwise depending on how you installed Core it may or may not be in that location. If you are monitoring NSClient you might be using check_nt instead to grab info from it, which would explain why check_nrpe is missing and unfamiliar to you. Check the service definition and see what plugin is being used.
Re: Use Nagios Core to report number of CPUs
Posted: Wed Oct 28, 2015 11:00 pm
by Box293
If you lost check_nrpe, this guide will help:
http://sites.box293.com/nagios/guides/n ... centos-6-5
You should be able to pull this information using a WMI query in NSClient++.
You'll need version 0.4.3.147 as check_wmi is broken in 143.
https://nsclient.org/download/0.4.3/#0.4.3.147
After installing it, open a command prompt and:
Code: Select all
cd "\Program Files\NSClient++\"
nscp settings --activate-module CheckWMI --add-defaults
Then restart the NSClient++ service.
Then the NRPE command should be something like:
Code: Select all
Command:
./check_nrpe -H win2008r2-01 -c check_wmi -a "query=Select NumberOfLogicalProcessors from win32_Processor"
Output:
1|
OR
Code: Select all
Command:
./check_nrpe -H win2008r2-01 -c check_wmi -a "query=Select NumberOfCores from win32_Processor"
Output:
1|
This documentation should help identify the values you are after:
https://msdn.microsoft.com/en-us/librar ... 2147217396
Let us know how this works out for you.
Re: Use Nagios Core to report number of CPUs
Posted: Thu Nov 30, 2017 11:23 am
by neworderfac33
This was extremely useful - thank you!
I had to tweak it slightly to:
Code: Select all
define service{
use generic-service
#host_name MyServer1,MyServer2
hostgroup_name MyHostGroup
service_description Logical_Processors_XX
check_command check_nrpe!check_wmi! -a "query=Select NumberOfLogicalProcessors from Win32_Processor"
}
and
Code: Select all
define service{
use generic-service
#host_name MyServer1,MyServer2
hostgroup_name MyHostGroup
service_description Cores_XX
check_command check_nrpe!check_wmi! -a "query=Select NumberOfCores from Win32_Processor"
}
Both report the same - namely "1, 1, 1, 1"
Thanks very much for your assistance!
Pete
Re: Use Nagios Core to report number of CPUs
Posted: Thu Nov 30, 2017 11:55 am
by kyang
Sounds good! I'll be closing this thread!
If you have any more questions, feel free to create another thread.
Thanks for using the Nagios Support Forum!