Use Nagios Core to report number of CPUs

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
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Use Nagios Core to report number of CPUs

Post 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
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Use Nagios Core to report number of CPUs

Post 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! :P However, I assume that's not the route you want to take.
Former Nagios Employee.
me.
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Use Nagios Core to report number of CPUs

Post 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
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Use Nagios Core to report number of CPUs

Post by hsmith »

Can you read through Troy's article on his website and let me know if that clears any of it up?
Former Nagios Employee.
me.
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Use Nagios Core to report number of CPUs

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Use Nagios Core to report number of CPUs

Post 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.
Former Nagios employee
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Use Nagios Core to report number of CPUs

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Use Nagios Core to report number of CPUs

Post 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
kyang

Re: Use Nagios Core to report number of CPUs

Post 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!
Locked