Number of CPU cores with CPULOAD (nsclient)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Number of CPU cores with CPULOAD (nsclient)

Post by dlukinski »

Hello Nagios Team

How to report number of CPU cores with check_xi_service_nsclient ?

Thank you
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Number of CPU cores with CPULOAD (nsclient)

Post by rkennedy »

You should be able to do this with a powershell script. You'll need to create it, and then modify your nsclient configuration to include that external script as a command.

Here's the one liner powershell script. Create a file called check_cpu_cores.ps1 and place it in the C:\Program Files\NSClient++\scripts\powershell\ directory.

Code: Select all

Get-WmiObject -class Win32_processor | findstr NumberOfCores
Once you've created the file, open up your nsclient configuration and look for -

Code: Select all

[/settings/external scripts/scripts]
below that, add -

Code: Select all

;check_cpu_cores external script
check_cpu_cores = cmd /c echo scripts\powershell\check_cpu_cores.ps1; exit(0) | powershell.exe -command -
At this point you should be able to use the check_cpu_cores script. See an example output below -

Code: Select all

[root@suse11 libexec]# ./check_nrpe -H 192.168.5.47 -c check_cpu_cores
NumberOfCores               : 4
Former Nagios Employee
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: Number of CPU cores with CPULOAD (nsclient)

Post by dlukinski »

rkennedy wrote:You should be able to do this with a powershell script. You'll need to create it, and then modify your nsclient configuration to include that external script as a command.

Here's the one liner powershell script. Create a file called check_cpu_cores.ps1 and place it in the C:\Program Files\NSClient++\scripts\powershell\ directory.

Code: Select all

Get-WmiObject -class Win32_processor | findstr NumberOfCores
Once you've created the file, open up your nsclient configuration and look for -

Code: Select all

[/settings/external scripts/scripts]
below that, add -

Code: Select all

;check_cpu_cores external script
check_cpu_cores = cmd /c echo scripts\powershell\check_cpu_cores.ps1; exit(0) | powershell.exe -command -
At this point you should be able to use the check_cpu_cores script. See an example output below -

Code: Select all

[root@suse11 libexec]# ./check_nrpe -H 192.168.5.47 -c check_cpu_cores
NumberOfCores               : 4
Thank you, so either that or SNMP (which provides Cores information)
- we could now close this one.
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Number of CPU cores with CPULOAD (nsclient)

Post by bwallace »

Glad we were able to help. We'll lock this thread now and feel free to open another should you require assistance with anything else.
Be sure to check out the Knowledgebase for helpful articles and solutions!
Locked