Monitor Windows via WMI from Cacti on Linux

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

Moderators: Developers, Moderators

Post Reply
Thomas.Pacce
Posts: 23
Joined: Wed Apr 15, 2009 5:19 am
Location: Amsterdam

Post by Thomas.Pacce »

What happens when you use Process Stats General or Memory graph for let say IIS (w3wp.exe) as there are a bunch of processes running at the same time, does it compute the sum or choose one random w3wp.exe process in the pool?

Edit:
From the looks of it, the values returned are for all processes so graph are not created:
/usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php -h '10.130.16.187' -u '/usr/share/cacti/site/scripts/cactiwmi.pw' -w 'Win32_PerfRawData_PerfProc_Process' -n '' -k 'Name' -v 'w3wp' -c 'ThreadCount,HandleCount,PrivateBytes,VirtualBytes,PageFileBytes,PercentPrivilegedTime,PercentProcessorTime,PercentUserTime'

HandleCount0:1295 Name0:w3wp PageFileBytes0:80670720 PercentPrivilegedTime0:2703 12500 PercentProcessorTime0:711406250 PercentUserTime0:441093750 PrivateBytes0:8 0670720 ThreadCount0:29 VirtualBytes0:508416000 HandleCount1:721 Name1:w3wp Page FileBytes1:73519104 PercentPrivilegedTime1:32656250 PercentProcessorTime1:578125 00 PercentUserTime1:25156250 PrivateBytes1:73519104 ThreadCount1:28 VirtualBytes 1:412852224 HandleCount2:928 Name2:w3wp PageFileBytes2:69328896 PercentPrivilege dTime2:67656250 PercentProcessorTime2:172187500 PercentUserTime2:104531250 Priva teBytes2:69328896 ThreadCount2:27 VirtualBytes2:472924160 HandleCount3:937 Name3 :w3wp PageFileBytes3:67063808 PercentPrivilegedTime3:59843750 PercentProcessorTi me3:131093750 PercentUserTime3:71250000 PrivateBytes3:67063808 ThreadCount3:32 V irtualBytes3:475107328 HandleCount4:965 Name4:w3wp PageFileBytes4:63365120 Perce ntPrivilegedTime4:47031250 PercentProcessorTime4:94375000 PercentUserTime4:47343 750 PrivateBytes4:63365120 ThreadCount4:25 VirtualBytes4:472129536 HandleCount5: 1015 Name5:w3wp PageFileBytes5:63987712 PercentPrivilegedTime5:60156250 PercentP rocessorTime5:123125000 PercentUserTime5:62968750 PrivateBytes5:63987712 ThreadC ount5:31 VirtualBytes5:475680768 HandleCount6:969 Name6:w3wp PageFileBytes6:7661 9776 PercentPrivilegedTime6:45312500 PercentProcessorTime6:90312500 PercentUserT ime6:45000000 PrivateBytes6:76619776 ThreadCount6:28 VirtualBytes6:471732224 Han dleCount7:743 Name7:w3wp PageFileBytes7:49655808 PercentPrivilegedTime7:25781250 PercentProcessorTime7:43750000 PercentUserTime7:17968750 PrivateBytes7:49655808 ThreadCount7:27 VirtualBytes7:412577792 HandleCount8:653 Name8:w3wp PageFileByt es8:35958784 PercentPrivilegedTime8:22656250 PercentProcessorTime8:32187500 Perc entUserTime8:9531250 PrivateBytes8:35958784 ThreadCount8:24 VirtualBytes8:403222 528 HandleCount9:133 Name9:w3wp PageFileBytes9:3280896 PercentPrivilegedTime9:78 1250 PercentProcessorTime9:1718750 PercentUserTime9:937500 PrivateBytes9:3280896 ThreadCount9:13 VirtualBytes9:44097536 HandleCount10:965 Name10:w3wp PageFileBy tes10:55513088 PercentPrivilegedTime10:45000000 PercentProcessorTime10:70312500 PercentUserTime10:25312500 PrivateBytes10:55513088 ThreadCount10:31 VirtualBytes
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Yer its ideally for only unique proceses. It's easy enough to alter to look for PID but that would change each time the process is created :(

The only alternative is to do a data query but even then you'd have the same issue that when the app closes and relaunches it'd get a new PID.
palli
Posts: 10
Joined: Wed May 06, 2009 7:34 pm

What is the recommended revision ?

Post by palli »

Hi claymen,

Your script is awesome, i am using it to graph the performance of my HP EVA SAN.

I could not get the svn version to work properly, but after downgrading to 0.0.5 i got lots of graphs working, that just made me wonder, what revision do you believe to be the most stable one at the moment?
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

The most stable is the latest version. Without it you can't do some of the graphs and it also means less hassle with escaping input.

0.0.6 is the latest "stable" version, not sure why you would have problems with it unless your templates were not setup properly or you were migrating from an older version without taking into account a few of the changes.
Thomas.Pacce
Posts: 23
Joined: Wed Apr 15, 2009 5:19 am
Location: Amsterdam

Post by Thomas.Pacce »

claymen wrote:Yer its ideally for only unique proceses. It's easy enough to alter to look for PID but that would change each time the process is created :(

The only alternative is to do a data query but even then you'd have the same issue that when the app closes and relaunches it'd get a new PID.
Strangely i got an intermittent graphing happening (a sum of all the w3wp processes actually!)
See attachment[/img]
Attachments
untitled222.JPG
untitled222.JPG (87.15 KiB) Viewed 6483 times
User avatar
wwwdrich
Cacti User
Posts: 91
Joined: Thu Feb 03, 2005 5:53 pm
Location: San Jose, CA
Contact:

Post by wwwdrich »

I've started working with this, and I have to say, it's great! It's something I've been looking to do myself for some time now (along with a Nagios plugin), and you saved me a lot of work. I already have a network traffic template that I'll post once I tweak it a bit more, but working with that led to a few questions:
  1. Does anyone know of a way to get any of the queried data into the graph title or description? Ex. I want the network interface name in my network graphs, and the drive name in my disk stats -- query_Name doesn't seem to work for script queries
  2. Does anyone have a working set of graph templates for Exchange2007 yet? I know that most of the stats moved out of WMI, but it looks like at least the hub servers have perf counters available, at least according to: http://technet.microsoft.com/en-us/libr ... 01704.aspx
  3. From reading through the thread, it looks like a few people have been working on patches to automatically graph multiple items that use the same template like indexed snmp data can currently do. For example, to graph all of the drives with a single template instead of having to manually add them one by one -- which requires the person setting up the monitoring know the drive layout, rather than the script discovering it like with snmp. Is there any hope of this being merged back into the main code? I would love to see it for multi-valued stats like drives, disk I/O, and the network template I'm working on.
- Dan
[i] "Step up to red alert!" "Are you sure, sir?[/i]
[i] It means changing the bulb in the sign..." - Red Dwarf[/i]
renrom
Posts: 6
Joined: Tue May 12, 2009 12:31 pm

Post by renrom »

Is there any plans to add support for SQL 2008? i manage to get the counters from SQL 2005, but it seems to be that with SQL2008 the wmi counters are moved :/
abdullahteke
Posts: 12
Joined: Thu Mar 05, 2009 7:55 am

wmi.php, wmic and win 2008_x64 server

Post by abdullahteke »

Hi;

I use the claymen's template and script, everything is working with win 2003 server. But when i try to use with win 2008 x_64 server i cant get any information from win 2008 server. I follow steps in the "http://www.solarwinds.com/support/apm/d ... Server.pdf" document to set up the wmi server. But when execute query

/usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php -h '172.18.3.85' -u '/usr/share/cacti/site/scripts/cacti.pwd' -w 'Win32_ComputerSystem' -n '' -k '' -v '' -c 'TotalPhysicalMemory', for host running win 2008 server it returned error message like "NTSTATUS: NT code 0xc002001b - NT code 0xc002001b". But same query run successfully for win 2003 server. Please help.
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Re: wmi.php, wmic and win 2008_x64 server

Post by claymen »

abdullahteke wrote:Hi;

I use the claymen's template and script, everything is working with win 2003 server. But when i try to use with win 2008 x_64 server i cant get any information from win 2008 server. I follow steps in the "http://www.solarwinds.com/support/apm/d ... Server.pdf" document to set up the wmi server. But when execute query

/usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php -h '172.18.3.85' -u '/usr/share/cacti/site/scripts/cacti.pwd' -w 'Win32_ComputerSystem' -n '' -k '' -v '' -c 'TotalPhysicalMemory', for host running win 2008 server it returned error message like "NTSTATUS: NT code 0xc002001b - NT code 0xc002001b". But same query run successfully for win 2003 server. Please help.
Run that command again from cmd line with -d1 it will give you the exact wmic query, try running that itself see what it does. It will likely give you a bit better error message. Are permissions ok for the user you are using to remotely WMI? We use this at work against 2008 x64 and have had no issues.
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

renrom wrote:Is there any plans to add support for SQL 2008? i manage to get the counters from SQL 2005, but it seems to be that with SQL2008 the wmi counters are moved :/
I'm reasonably sure we use 2008 clustering at work and it works without any issues. As does 2005. 2000 is missing a few but still available.. You may just need to update the actuall class you are trying to query, this is especially true for multiple named instances. Use scriptomatic on the box itself to compare what my templates use to what is actually available.
renrom
Posts: 6
Joined: Tue May 12, 2009 12:31 pm

Post by renrom »

claymen wrote:
renrom wrote:Is there any plans to add support for SQL 2008? i manage to get the counters from SQL 2005, but it seems to be that with SQL2008 the wmi counters are moved :/
I'm reasonably sure we use 2008 clustering at work and it works without any issues. As does 2005. 2000 is missing a few but still available.. You may just need to update the actuall class you are trying to query, this is especially true for multiple named instances. Use scriptomatic on the box itself to compare what my templates use to what is actually available.
Hmm i did run scriptomatic on two SQL 2008 servers and didn't had the wmi counters in it. Maybe im missing something, or "forget" to install on the SQL 2008 servers, but on the 2005 servers it does running like it should be.

This is what i get when i run this:

Code: Select all

/usr/bin/php -q /var/www/html/cacti/scripts/wmi.php -h '***' -u '/etc/cacti/wmi.pw' -w 'Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager' -n '' -k '' -v '' -c 'Buffercachehitratio,Buffercachehitratio_Base'

NTSTATUS: NT code 0x80041010 - NT code 0x80041010

/usr/bin/wmic --namespace='root\CIMV2' --authentication-file=/etc/cacti/wmi.pw //*** "SELECT Buffercachehitratio,Buffercachehitratio_Base FROM Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager"
Exec Status: 1
ScritpOmatic doesnt show a Win32_PerfRawData_MSSQLSERVER at all.

It are 2003 64 bits machine's, maybe thats the difference?
Last edited by renrom on Mon May 18, 2009 9:28 am, edited 1 time in total.
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

renrom wrote:
claymen wrote:
renrom wrote:Is there any plans to add support for SQL 2008? i manage to get the counters from SQL 2005, but it seems to be that with SQL2008 the wmi counters are moved :/
I'm reasonably sure we use 2008 clustering at work and it works without any issues. As does 2005. 2000 is missing a few but still available.. You may just need to update the actuall class you are trying to query, this is especially true for multiple named instances. Use scriptomatic on the box itself to compare what my templates use to what is actually available.
Hmm i did run scriptomatic on two SQL 2008 servers and didn't had the wmi counters in it. Maybe im missing something, or "forget" to install on the SQL 2008 servers, but on the 2005 servers it does running like it should be.
Are there any? If you run scriptomatic2 does it return any SQL ones? wmiadap /f tends to fix missing WMI classes.
renrom
Posts: 6
Joined: Tue May 12, 2009 12:31 pm

Post by renrom »

claymen wrote:
renrom wrote:
claymen wrote: I'm reasonably sure we use 2008 clustering at work and it works without any issues. As does 2005. 2000 is missing a few but still available.. You may just need to update the actuall class you are trying to query, this is especially true for multiple named instances. Use scriptomatic on the box itself to compare what my templates use to what is actually available.
Hmm i did run scriptomatic on two SQL 2008 servers and didn't had the wmi counters in it. Maybe im missing something, or "forget" to install on the SQL 2008 servers, but on the 2005 servers it does running like it should be.
Are there any? If you run scriptomatic2 does it return any SQL ones? wmiadap /f tends to fix missing WMI classes.
Hi claymen, i just edited my previous posting while you replyd.. soz ;)..

I did tried wmiadap /f and it didnt resolve my issue :(
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

wmiadap /f and a reboot is all I can suggest. they should be there as its what we use at work with no issues. In fact we have a clustered setup as well and it reports fine.
renrom
Posts: 6
Joined: Tue May 12, 2009 12:31 pm

Post by renrom »

Can't reboot now tho, but after a wmiadap /f i see this in de wmiadap.log:

Code: Select all

(Mon May 18 18:45:30 2009.-440679452) : Collect for service MSSQLSERVER for Global counters failed
(Mon May 18 18:45:30 2009.-440679452) : Collect for service MSSQLSERVER returned 0-Size BLOBs
Funny thing is that its only with the 2003 64 bits machine's running SQL 2008.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests