Page 1 of 2

Windows Performance Counters - Best Practices for Nagios?

Posted: Wed Feb 23, 2011 11:00 am
by mocjack
Is there a special document or helpfile on gathering Windows server performance counters? I notice there are few templates, and when I try to use the ones in the Windows Server Wizard as templates, I always fail. Right now I have a specific need to monitor the transaction log of a database on a MSSQL server?

I am running Nagios XI version 1.3G under CentOS. My remote Windows Servers all have NSCLient++ - 0.3.8.75 2010-05-27. It seems to do the job for most other things.

This is the specific performance counter I want to gather and alert on:

Image


Here is the configuration screen for the service:

Image

The command line I use above is cut off, so here is the full thing:

-l "\\SQLServer:Databases(BPM_Engine_PRD)\\Log File(s) Size (KB) %.f","BPM Production Transaction Log Size in KB is %.f" -w 1000 -c 3000

I notice in my NSCLIENT logs on the Windows server the following errors:

--
2011-01-27 11:23:47: error:modules\CheckSystem\CheckSystem.cpp:1084: ERROR: Counter not found: \SQLServer:Databases\BPM_Engine_PRD\Log File(s) Size (KB): The specified instance is not present. (800007D1)
2011-01-27 11:23:47: error:modules\CheckSystem\CheckSystem.cpp:1113: ERROR: \SQLServer:Databases\BPM_Engine_PRD\Log File(s) Size (KB): PdhAddCounter failed: Unable to parse the counter path. Check the format and syntax of the specified path. (C0000BC0) (\SQLServer:Databases\BPM_Engine_PRD\Log File(s) Size (KB)|\SQLServer:Databases\BPM_Engine_PRD\Log File(s) Size (KB))
2011-01-27 11:33:07: error:modules\CheckSystem\CheckSystem.cpp:1082: ERROR: Counter not found: \SQLServer:Databases\BPM_Engine_PRD\Log File(s) Size (KB): The specified instance is not present.
--


Can someone walk me step by step what I am doing wrong? This would clear up alot of issues for us and allow me to move forward with alot of other performance counters.

I have tried posting this on the general forum but I was not able to get it working.

Thanks in advance!

-Jack

Re: Windows Performance Counters - Best Practices for Nagios

Posted: Wed Feb 23, 2011 11:34 am
by rdedon
Lets try a few things here.

Code: Select all

-l '\\SQLServer:Databases(BPM_Engine_PRD)\\Log File(s) Size (KB) %.f","BPM Production Transaction Log Size in KB is %.f' -w 1000 -c 3000
I see that \\Log File may have an extra "\" unless this intentional and is the directory structure.



because of spaces as a single argument it could be causing a problem the whole thing may need to be wrapped in 'single-quotes' as in:

Code: Select all

-l '\\SQLServer:Databases(BPM_Engine_PRD)\Log File(s) Size (KB) %.f","BPM Production Transaction Log Size in KB is %.f' -w 1000 -c 3000
otherwise go to plugins directory /usr/local/nagios/libexec
and run

Code: Select all

./check_nt -H
and see what we can come up with

Re: Windows Performance Counters - Best Practices for Nagios

Posted: Wed Feb 23, 2011 11:57 am
by tonyyarusso
Some other possibilities:

Try removing the %.f on the first part, making it

Code: Select all

-l "\\SQLServer:Databases(BPM_Engine_PRD)\\Log File(s) Size (KB)","BPM Production Transaction Log Size in KB is %.f" -w 1000 -c 3000
Try escaping the colon, making it

Code: Select all

-l "\\SQLServer\:Databases(BPM_Engine_PRD)\\Log File(s) Size (KB) %.f","BPM Production Transaction Log Size in KB is %.f" -w 1000 -c 3000
Then try doing both of the above together, for

Code: Select all

-l "\\SQLServer\:Databases(BPM_Engine_PRD)\\Log File(s) Size (KB)","BPM Production Transaction Log Size in KB is %.f" -w 1000 -c 3000

Re: Windows Performance Counters - Best Practices for Nagios

Posted: Wed Feb 23, 2011 2:34 pm
by mocjack
Tony,

Your third suggestion did the trick. Everything is running perfectly now. Much appreciated guys!

-Jack

Re: Windows Performance Counters - Best Practices for Nagios

Posted: Wed Feb 23, 2011 2:36 pm
by tonyyarusso
Excellent!

Re: Windows Performance Counters - Best Practices for Nagios

Posted: Wed Mar 23, 2011 9:06 am
by mocjack
Well I am back in the same boat...seems very confusing to set up various normal performance counters offered by applications. I have one for Lotus Notes that I need to monitor. The counter reports a value of 252+ in windows performance monitor, but in Nagios I always get a "0".

Here is the counter:

Image

Here is what I have typed in Nagios for the check...

-l "\\Lotus Notes\\:Notes Statistics\\Replica.Cluster.Failed","Replica.Cluster.Failed is %.f" -w 3 -c 6000000

Can anyone assist? Or, does someone have a PDF somewhere that makes recommendations on how to set up W200X performance counters more easily?

-Jack

Re: Windows Performance Counters - Best Practices for Nagios

Posted: Thu Mar 24, 2011 1:04 am
by Box293
Hi mocjack,
I think your command should be formatted like this:

-l "\\Lotus Notes(Replica.Cluster.Failed)\\Notes Statistics","Replica.Cluster.Failed is %.f" -w 3 -c 6000000

Re: Windows Performance Counters - Best Practices for Nagios

Posted: Thu Mar 24, 2011 7:57 am
by mocjack
Well that didn't work :cry:

I still get returned a 0 from Nagios even though performance monitor now shows the value over 400.

Re: Windows Performance Counters - Best Practices for Nagios

Posted: Thu Mar 24, 2011 3:58 pm
by rdedon
I have downgraded this from "completed" to "ongoing problem" and will do some research on this.

Re: Windows Performance Counters - Best Practices for Nagios

Posted: Thu Mar 24, 2011 5:46 pm
by Box293
I do have access to a Lotus Notes server however it is not in a network with a Nagios monitoring server that I can test.

I might be going over something twice but I want to use pictures to show what I am seeing.

Using Perfmon, add the counter, right click it down the bottom and select properties.
01.png
Here you can see that this is the correct format that the counter needs to be typed, you just need to make sure all the backslash's are double.
02.png
The strange thing is when I was adding the counter to perfmon, it did not show each instance in the instances list, I had to add <All Instances>.
03.png
One last suggestion, double check that the spelling is correct.