Performance Monitor Query [v1.1 - 2011-12-16]

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Performance Monitor Query [v1.1 - 2011-12-16]

Post by BSOD2600 »

This script is merely a wrapper around the Microsoft tool typeperf which is designed to query a single performance counter at a time. Typeperf leverages WMI, which requires user authentication, correct permission levels and of course only works from Windows. In the case of Cacti, typeperf will be executed with the permissions of the Cacti Scheduled Task. The query format typeperf requires can be somewhat confusing to figure out. The link above lists all the nitty-gritty details.

Full details and installation instructions are in the download. Sample screenshots below, demonstrating how customizable the templates are for all types of performance counter data.
Attachments
PerformanceMonitorQuery-1.1.zip
(48.31 KiB) Downloaded 697 times
PerformanceMonitorQuery-1.0.zip
script, templates, and readme
(47.6 KiB) Downloaded 450 times
Sample templates in action
Sample templates in action
sample.png (20.81 KiB) Viewed 11675 times
baribal
Posts: 6
Joined: Thu Mar 25, 2010 3:48 am

Post by baribal »

Looks like all work fine. But there is a problem with spine 0.8.7e under Windows. I use Cacti 0.8.7e and Spine http://www.cacti.net/downloads/spine/pa ... 0.8.7e.zip. For some counters result isn't shown:

"\Processor(_Total)\% Processor Time", output: RESULT:3.127480

"\MSSQL$TEST_SRV:Memory Manager\Total Server Memory (KB)", output: RESULT:

If I use cmd.php instead of Spine the result for MSSQL counter is shown. Is it a Spine bug? It can't handle "$" or ":"?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Possibly a spine bug.

Please post the output while using cmd.php

Also, for processor time, you really want to use the snmp implementation since its a LOT faster.
baribal
Posts: 6
Joined: Thu Mar 25, 2010 3:48 am

Post by baribal »

04/05/2010 10:08:40 AM - CMDPHP: Poller[0] Host[2] DS[69] CMD: D:/app/serv/apache2.2/htdocs/cacti/scripts/perfmon_query.cmd host "\MSSQL$TEST_SRV:General Statistics\User Connections", output: RESULT:20.000000
04/05/2010 10:08:42 AM - CMDPHP: Poller[0] Host[2] DS[70] CMD: D:/app/serv/apache2.2/htdocs/cacti/scripts/perfmon_query.cmd host "\MSSQL$TEST_SRV:Databases(_Total)\Data File(s) Size (KB)", output: RESULT:8929408.000000
04/05/2010 10:08:33 AM - CMDPHP: Poller[0] Host[2] DS[66] CMD: D:/app/serv/apache2.2/htdocs/cacti/scripts/perfmon_query.cmd host "\MSSQL$TEST_SRV:Memory Manager\Total Server Memory (KB)", output: RESULT:1638400.000000
04/05/2010 10:08:46 AM - CMDPHP: Poller[0] Host[3] DS[43] CMD: D:/app/serv/apache2.2/htdocs/cacti/scripts/perfmon_query.cmd host "\Processor(_Total)\% Processor Time", output: RESULT:3.000000
baribal
Posts: 6
Joined: Thu Mar 25, 2010 3:48 am

Post by baribal »

BSOD2600 wrote: Also, for processor time, you really want to use the snmp implementation since its a LOT faster.
Yes, I've noticed it. I sniffered packets and saw that typeperf got a lot of other performance counters and not only the one I've defined as command string parameter.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Yup, looks like buggy spine to me. Please file a report at http://www.cacti.net/bugs.php, summarize the problem and reference this thread.
nicoCn
Posts: 12
Joined: Sun Apr 17, 2011 11:29 pm

Re:

Post by nicoCn »

baribal wrote:Looks like all work fine. But there is a problem with spine 0.8.7e under Windows. I use Cacti 0.8.7e and Spine http://www.cacti.net/downloads/spine/pa ... 0.8.7e.zip. For some counters result isn't shown:

"\Processor(_Total)\% Processor Time", output: RESULT:3.127480

"\MSSQL$TEST_SRV:Memory Manager\Total Server Memory (KB)", output: RESULT:

If I use cmd.php instead of Spine the result for MSSQL counter is shown. Is it a Spine bug? It can't handle "$" or ":"?
I have the same problem :
04/18/2011 12:34:03 PM - SPINE: Poller[0] Host[5] DS[14] SCRIPT: C:/Cacti/Apache2/htdocs/cacti/scripts/perfmon_query.cmd 192.168.0.101 "\processor(_Total)\% Processor Time" , output: RESULT:44.919050
04/18/2011 12:34:04 PM - SPINE: Poller[0] Host[5] DS[15] SCRIPT: C:/Cacti/Apache2/htdocs/cacti/scripts/perfmon_query.cmd 192.168.0.101 "MSSQL$SQL2K8:General Statistics\User Connections", output: RESULT:

BSOD2600,colud you help me ,ths a lot.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Performance Monitor Query [v1.0 - 2010-01-28]

Post by BSOD2600 »

nicoCn: cacti/spine 0.8.7g is the latest. please give them a try. if there is still a problem, then a bug report needs to be filed.
nicoCn
Posts: 12
Joined: Sun Apr 17, 2011 11:29 pm

Re: Performance Monitor Query [v1.0 - 2010-01-28]

Post by nicoCn »

BSOD2600 wrote:nicoCn: cacti/spine 0.8.7g is the latest. please give them a try. if there is still a problem, then a bug report needs to be filed.
thanks for your reply, I will try cacti/spine 0.8.7g.
nicoCn
Posts: 12
Joined: Sun Apr 17, 2011 11:29 pm

Re: Performance Monitor Query [v1.0 - 2010-01-28]

Post by nicoCn »

Hi BSOD2600:

I just installed cacti/spine 0.8.7.g and tried cmd.php/spine.

used spine.exe
04/19/2011 04:14:02 PM - SPINE: Poller[0] Host[7] TH[1] DS[18] SCRIPT: C:/Apache2/htdocs/cacti/scripts/perfmon_query.cmd 192.169.0.1 "MSSQL$SQL2K8:General Statistics\User Connections", output: RESULT:

used cmdphp:
04/19/2011 04:15:02 PM - CMDPHP: Poller[0] Host[7] DS[18] CMD: C:/Apache2/htdocs/cacti/scripts/perfmon_query.cmd 192.169.0.1 "MSSQL$SQL2K8:General Statistics\User Connections", output: RESULT:94.000000


Is this a spine bug ?

ths a lot.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Performance Monitor Query [v1.0 - 2010-01-28]

Post by BSOD2600 »

yes, please file a bug.
nicoCn
Posts: 12
Joined: Sun Apr 17, 2011 11:29 pm

Re: Performance Monitor Query [v1.0 - 2010-01-28]

Post by nicoCn »

thanks a lot BSOD2600.
User avatar
terpmeister
Posts: 4
Joined: Fri Dec 16, 2011 11:29 am
Location: Oregon
Contact:

Re: Performance Monitor Query [v1.0 - 2010-01-28]

Post by terpmeister »

Has anybody gotten this query (.cmd) file to work on Windows 2008 R2? If I manually run the query from a DOS command prompt, I get the following:

RESULT:wait...

I can run it successfully on a Windows 2003 box. Just curious before I start picking apart the .cmd file if somebody else has already done this work.

Here is an example of what I am running from the command line:

perfmon_query.cmd aServerName "\Processor(_Total)\% Processor Time"

I have tried multiple different Performance Monitor queries as well (to eliminate it being the Query syntax). I have full permissions on this machine (and ones I try to monitor). If I manually do the typeperf command, I do get a result back. Only thing I can think that it would be is something in the .cmd file does not like Windows 2008.

Thanks.

A little more info, if I turn echo off to see what it is doing, I get this:

(set RESULT=1.563130 )

(set RESULT=wait... )

echo.RESULT:wait...


So it looks like it is getting a result, but then something is plunking in wait...
-------------------------------------
terpmeister
http://www.redmutt.com
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Performance Monitor Query [v1.0 - 2010-01-28]

Post by BSOD2600 »

I've got a newer PowerShell script for this purpose... but Cacti's string cleaning routines break some counters, hence it hasn't been released yet.

I do see what you mean about something inserting that additional wait... I'll see if I can fix the script.
User avatar
terpmeister
Posts: 4
Joined: Fri Dec 16, 2011 11:29 am
Location: Oregon
Contact:

Re: Performance Monitor Query [v1.0 - 2010-01-28]

Post by terpmeister »

Thanks for the help, I am still working it on my end as well. More info (not sure if it is useful) is if I change the token=3 variable it looks like I am getting different result. My DOS-fu is pretty rusty so I have been googling around to see if there is something I am missing.

Also, if you need any testers for the PowerShell script, my current environment is available. Using PS in this environment would be the preferred method anyways.

Thanks.

More info, changing token value to:

1 = Exiting
2 = please
3 = wait...
-------------------------------------
terpmeister
http://www.redmutt.com
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests