Page 1 of 3

Windows Perf Counters with WMI or NCPA

Posted: Wed Mar 16, 2016 1:58 pm
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?

Re: Windows Perf Counters with WMI or NCPA

Posted: Wed Mar 16, 2016 3:51 pm
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-

Re: Windows Perf Counters with WMI or NCPA

Posted: Wed Mar 16, 2016 4:29 pm
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.

Re: Windows Perf Counters with WMI or NCPA

Posted: Thu Mar 17, 2016 3:31 pm
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?

Re: Windows Perf Counters with WMI or NCPA

Posted: Thu Mar 17, 2016 9:38 pm
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

Re: Windows Perf Counters with WMI or NCPA

Posted: Mon Mar 28, 2016 4:11 pm
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?

Re: Windows Perf Counters with WMI or NCPA

Posted: Mon Mar 28, 2016 6:23 pm
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.

Re: Windows Perf Counters with WMI or NCPA

Posted: Tue Mar 29, 2016 11:20 am
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

Re: Windows Perf Counters with WMI or NCPA

Posted: Tue Mar 29, 2016 12:04 pm
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.

Re: Windows Perf Counters with WMI or NCPA

Posted: Tue Mar 29, 2016 3:04 pm
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.