Windows Perf Counters with WMI or NCPA

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Windows Perf Counters with WMI or NCPA

Post by krobertson71 »

I am trying to set up monitoring for Memory Pages/sec. I cannot seem to get the WMI Plus check to work. I can get NCPA, at the api page, to work, but failed at trying to convert it into the CLI check for check_ncpa.py.

I need to use either WMI or NCPA.

Does anyone have an example of one of these?
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Windows Perf Counters with WMI or NCPA

Post by bwallace »

To get some background info regarding WMI, did you follow the steps in this guide?
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

To confirm, is this the plugin you're using?
https://exchange.nagios.org/directory/P ... us/details

Do you receive any errors at all when the check does not work? Could you post those here?

-thanks-
Be sure to check out the Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows Perf Counters with WMI or NCPA

Post by lmiltchev »

You can probably download the "Check-Performance-Counters.ps1" script from here:
https://github.com/sreinhardt/Nagios_Pe ... e_Counters

place it in the "C:\Program Files (x86)\Nagios\NCPA\plugins" directory on the Windows machine, and call it from XI via check_ncpa.py.

Example:

Code: Select all

[root@localhost ~]# /usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t mytoken -M agent/plugin/Check-Performance-Counters.ps1 -a '-n "\Memory\Pages/sec"'
OK: Counter \Memory\Pages/sec returned results 31.6210516470387 | 'Counter 0'=32;;;;
Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Re: Windows Perf Counters with WMI or NCPA

Post by krobertson71 »

Thanks for the replies. The powershell plugin with NCPA is an option but was trying to avoid it.

I was hoping to utilize the wmiplus check to pull performance metrics, like memory pages/sec.

WMI Plus has a lot of built-ins but I dont see one that can go out and grab a specific performance metric.

I did read that you can create ini files for this but the only examples I could find as a guide I was unable to work.

Does anyone have a wmiplus check example I could go by?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Windows Perf Counters with WMI or NCPA

Post by Box293 »

Via WMI I don't think performance counters can be directly accessed.

Have a look at this and see if it helps:

http://edcint.co.nz/checkwmiplus/?q=Mak ... ClassCheck
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Re: Windows Perf Counters with WMI or NCPA

Post by krobertson71 »

I was able to get this working.

Best way, for me, was to create a custom command (learned from link you provided) win_cpu_proc. I then created a custom service for it.

Now I can return the CPU of any process on any machine.

What concerns me is that the credentials are in the command itself. I know wmi plus can use an Auth file but only at a certain version. The version that comes with Nagios XI 5.2.3 is a couple of revisions behind what the dev is up to.

Can the current version handle an AUTH file? If not, is there a way in Nagios to "Salt" the password or 'hash' it?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Windows Perf Counters with WMI or NCPA

Post by Box293 »

krobertson71 wrote:Best way, for me, was to create a custom command (learned from link you provided) win_cpu_proc. I then created a custom service for it.

Now I can return the CPU of any process on any machine.
Excellent.
krobertson71 wrote:What concerns me is that the credentials are in the command itself. I know wmi plus can use an Auth file but only at a certain version. The version that comes with Nagios XI 5.2.3 is a couple of revisions behind what the dev is up to.

Can the current version handle an AUTH file? If not, is there a way in Nagios to "Salt" the password or 'hash' it?
Looking at XI 5.2.3 I can see the version that it comes with is 1.60.

Looking at the help, this version supports the auth file:
-A AUTHFILE the full path to an authentication file. The file is passed directly to /usr/bin/wmic. Check WMI PLus does not read the file and hence you must get the file format as required by /usr/bin/wmic. You can override the settings in this file by using -u DOMAIN/USER -p PASSWORD.

Authentication File format is
username=USERNAME
password=PASSWORD
domain=DOMAIN

Set your own values for USERNAME, PASSWORD and DOMAIN. DOMAIN may be nothing.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Re: Windows Perf Counters with WMI or NCPA

Post by krobertson71 »

Looking in check_wmi_plus.pl I am seeing the version as:

Code: Select all

#==============================================================================
#================================= DECLARATIONS ===============================
#==============================================================================

my $VERSION="1.49";

# we are looking for the dir where utils.pm is located. This is normally installed as part of Nagios
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Re: Windows Perf Counters with WMI or NCPA

Post by krobertson71 »

just ran ./check_wmi_plus.pl --help | less

No mention of an option to use and -A AUTHFILE. Just the typical instructions for version 1.4.x.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows Perf Counters with WMI or NCPA

Post by lmiltchev »

What is the Nagios XI version that you are currently using? As Box293 mentioned:
Looking at XI 5.2.3 I can see the version that it comes with is 1.60.
The option "-A" is available in "/check_wmi_plus.pl" Version: 1.6.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked