Solved

Problem with querying WMS perfmon counters with VBS/Nagios

Posted on 2009-03-31
6
851 Views
Last Modified: 2012-05-06
I have run into quite an odd problem today and wonder if someone else had observed it, or better - solved it. We have two Windows Media Servers - one with W2k3 Standard 32-bit edition server and second one with Wsk3 Enterprise x64 edition. Both have Nagios client installed, since we use Nagios Server to monitor them. The Standard edition one responds to Nagios monitoring all right, giving us data about all requested performance monitor counters including those associated with WMS, the second one (Enterprise x64) properly responds for querying the system counters (and any other afaik) _excluding_ all those associated with WMS.

We have tried another approach by runing attached query against those WMS counters via VBS scripts (automaticaly generated with Scriptomatic 2.0) - the same on both servers (forgive the long query but I am quite new to VBS and mostly use automaticly generated scripts). On the Standard 32-bit edition this went smoothly giving us output like:

==========================================
Computer: **-**-SERVER
==========================================
Caption:
CurrentConnectedPlayers: 0
CurrentFileReadRateKbps: 0
CurrentLateReadRate: 0
CurrentOutgoingDistributionAllocatedBandwidthKbps: 0
CurrentOutgoingDistributionConnections: 0
CurrentPlayerAllocatedBandwidthKbps: 0
CurrentStreamErrorRate: 0
CurrentStreamingHTTPPlayers: 0
CurrentStreamingMMSPlayers: 0
CurrentStreamingPlayers: 0
CurrentStreamingRTSPPlayers: 0
Description:
Frequency_Object:
Frequency_PerfTime:
Frequency_Sys100NS:
Name: /
PeakConnectedPlayers: 0
PeakOutgoingDistributionAllocatedBandwidthKbps: 0
PeakOutgoingDistributionConnections: 0
PeakPlayerAllocatedBandwidthKbps: 0
PeakStreamingPlayers: 0
Timestamp_Object:
Timestamp_PerfTime:
Timestamp_Sys100NS:
TotalAdvertisements: 0
TotalConnectedPlayers: 0
TotalFileBytesRead: 0
TotalLateReads: 0
TotalOutgoingDistributionBytesSent: 0
TotalOutgoingDistributionConnections: 0
TotalPlayerBytesSent: 0
TotalStreamDenials: 0
TotalStreamErrors: 0
TotalStreamingPlayers: 0
TotalStreamTerminations: 0

Caption:
CurrentConnectedPlayers: 0
CurrentFileReadRateKbps: 0
CurrentLateReadRate: 0
CurrentOutgoingDistributionAllocatedBandwidthKbps: 0
CurrentOutgoingDistributionConnections: 0
CurrentPlayerAllocatedBandwidthKbps: 0
CurrentStreamErrorRate: 0
CurrentStreamingHTTPPlayers: 0
CurrentStreamingMMSPlayers: 0
CurrentStreamingPlayers: 0
CurrentStreamingRTSPPlayers: 0
Description:
Frequency_Object:
Frequency_PerfTime:
Frequency_Sys100NS:
Name: Cache\Proxy On-Demand
PeakConnectedPlayers: 0
PeakOutgoingDistributionAllocatedBandwidthKbps: 0
PeakOutgoingDistributionConnections: 0
PeakPlayerAllocatedBandwidthKbps: 0
PeakStreamingPlayers: 0
Timestamp_Object:
Timestamp_PerfTime:
Timestamp_Sys100NS:
TotalAdvertisements: 0
TotalConnectedPlayers: 0
TotalFileBytesRead: 0
TotalLateReads: 0
TotalOutgoingDistributionBytesSent: 0
TotalOutgoingDistributionConnections: 0
TotalPlayerBytesSent: 0
TotalStreamDenials: 0
TotalStreamErrors: 0
TotalStreamingPlayers: 0
TotalStreamTerminations: 0

Caption:
CurrentConnectedPlayers: 0
CurrentFileReadRateKbps: 0
CurrentLateReadRate: 0
CurrentOutgoingDistributionAllocatedBandwidthKbps: 0
CurrentOutgoingDistributionConnections: 0
CurrentPlayerAllocatedBandwidthKbps: 0
CurrentStreamErrorRate: 0
CurrentStreamingHTTPPlayers: 0
CurrentStreamingMMSPlayers: 0
CurrentStreamingPlayers: 0
CurrentStreamingRTSPPlayers: 0
Description:
Frequency_Object:
Frequency_PerfTime:
Frequency_Sys100NS:
Name: Cache\Proxy Broadcast
PeakConnectedPlayers: 0
PeakOutgoingDistributionAllocatedBandwidthKbps: 0
PeakOutgoingDistributionConnections: 0
PeakPlayerAllocatedBandwidthKbps: 0
PeakStreamingPlayers: 0
Timestamp_Object:
Timestamp_PerfTime:
Timestamp_Sys100NS:
TotalAdvertisements: 0
TotalConnectedPlayers: 0
TotalFileBytesRead: 0
TotalLateReads: 0
TotalOutgoingDistributionBytesSent: 0
TotalOutgoingDistributionConnections: 0
TotalPlayerBytesSent: 0
TotalStreamDenials: 0
TotalStreamErrors: 0
TotalStreamingPlayers: 0
TotalStreamTerminations: 0

Caption:
CurrentConnectedPlayers: 320
CurrentFileReadRateKbps: 0
CurrentLateReadRate: 0
CurrentOutgoingDistributionAllocatedBandwidthKbps: 0
CurrentOutgoingDistributionConnections: 0
CurrentPlayerAllocatedBandwidthKbps: 43073
CurrentStreamErrorRate: 0
CurrentStreamingHTTPPlayers: 288
CurrentStreamingMMSPlayers: 13
CurrentStreamingPlayers: 301
CurrentStreamingRTSPPlayers: 0
Description:
Frequency_Object:
Frequency_PerfTime:
Frequency_Sys100NS:
Name: stream1
PeakConnectedPlayers: 572
PeakOutgoingDistributionAllocatedBandwidthKbps: 0
PeakOutgoingDistributionConnections: 0
PeakPlayerAllocatedBandwidthKbps: 259152
PeakStreamingPlayers: 529
Timestamp_Object:
Timestamp_PerfTime:
Timestamp_Sys100NS:
TotalAdvertisements: 0
TotalConnectedPlayers: 153558
TotalFileBytesRead: 73240395797
TotalLateReads: 258894
TotalOutgoingDistributionBytesSent: 0
TotalOutgoingDistributionConnections: 0
TotalPlayerBytesSent: 6489956438712
TotalStreamDenials: 0
TotalStreamErrors: 6
TotalStreamingPlayers: 235635
TotalStreamTerminations: 2249

Caption:
CurrentConnectedPlayers: 52
CurrentFileReadRateKbps: 0
CurrentLateReadRate: 0
CurrentOutgoingDistributionAllocatedBandwidthKbps: 0
CurrentOutgoingDistributionConnections: 0
CurrentPlayerAllocatedBandwidthKbps: 15776
CurrentStreamErrorRate: 0
CurrentStreamingHTTPPlayers: 46
CurrentStreamingMMSPlayers: 1
CurrentStreamingPlayers: 47
CurrentStreamingRTSPPlayers: 0
Description:
Frequency_Object:
Frequency_PerfTime:
Frequency_Sys100NS:
Name: stream2
PeakConnectedPlayers: 371
PeakOutgoingDistributionAllocatedBandwidthKbps: 0
PeakOutgoingDistributionConnections: 0
PeakPlayerAllocatedBandwidthKbps: 226807
PeakStreamingPlayers: 289
Timestamp_Object:
Timestamp_PerfTime:
Timestamp_Sys100NS:
TotalAdvertisements: 0
TotalConnectedPlayers: 160183
TotalFileBytesRead: 97916245687
TotalLateReads: 245359
TotalOutgoingDistributionBytesSent: 0
TotalOutgoingDistributionConnections: 0
TotalPlayerBytesSent: 4151974586958
TotalStreamDenials: 0
TotalStreamErrors: 0
TotalStreamingPlayers: 208552
TotalStreamTerminations: 890

However on the Enterprise x64 edition the same script has generated no more than this:

==========================================
Computer: **-**-STREAMSRV
==========================================

Obviously something does not work here. This goes for every possible query against WMS related object. All other, like system objects, works just fine. I assume that our Nagios application have the same problem as we have, probably using the same mechanism to collect data. Is this a bug in x64 wersion? Have anyone tried to query those objects on similar system version as we have with any luck?

Interestingly Windows Perfmon does not have any problem with querying those counters on both servers... Please help! :-)
On Error Resume Next
 

Const wbemFlagReturnImmediately = &h10

Const wbemFlagForwardOnly = &h20
 

arrComputers = Array("RM-STREAMSRV")

For Each strComputer In arrComputers

   WScript.Echo

   WScript.Echo "=========================================="

   WScript.Echo "Computer: " & strComputer

   WScript.Echo "=========================================="
 

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

   Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_WMServer_WindowsMediaPublishingPoints", "WQL", _

                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)
 

   For Each objItem In colItems

      WScript.Echo "Caption: " & objItem.Caption

      WScript.Echo "CurrentConnectedPlayers: " & objItem.CurrentConnectedPlayers

      WScript.Echo "CurrentFileReadRateKbps: " & objItem.CurrentFileReadRateKbps

      WScript.Echo "CurrentLateReadRate: " & objItem.CurrentLateReadRate

      WScript.Echo "CurrentOutgoingDistributionAllocatedBandwidthKbps: " & objItem.CurrentOutgoingDistributionAllocatedBandwidthKbps

      WScript.Echo "CurrentOutgoingDistributionConnections: " & objItem.CurrentOutgoingDistributionConnections

      WScript.Echo "CurrentPlayerAllocatedBandwidthKbps: " & objItem.CurrentPlayerAllocatedBandwidthKbps

      WScript.Echo "CurrentStreamErrorRate: " & objItem.CurrentStreamErrorRate

      WScript.Echo "CurrentStreamingHTTPPlayers: " & objItem.CurrentStreamingHTTPPlayers

      WScript.Echo "CurrentStreamingMMSPlayers: " & objItem.CurrentStreamingMMSPlayers

      WScript.Echo "CurrentStreamingPlayers: " & objItem.CurrentStreamingPlayers

      WScript.Echo "CurrentStreamingRTSPPlayers: " & objItem.CurrentStreamingRTSPPlayers

      WScript.Echo "Description: " & objItem.Description

      WScript.Echo "Frequency_Object: " & objItem.Frequency_Object

      WScript.Echo "Frequency_PerfTime: " & objItem.Frequency_PerfTime

      WScript.Echo "Frequency_Sys100NS: " & objItem.Frequency_Sys100NS

      WScript.Echo "Name: " & objItem.Name

      WScript.Echo "PeakConnectedPlayers: " & objItem.PeakConnectedPlayers

      WScript.Echo "PeakOutgoingDistributionAllocatedBandwidthKbps: " & objItem.PeakOutgoingDistributionAllocatedBandwidthKbps

      WScript.Echo "PeakOutgoingDistributionConnections: " & objItem.PeakOutgoingDistributionConnections

      WScript.Echo "PeakPlayerAllocatedBandwidthKbps: " & objItem.PeakPlayerAllocatedBandwidthKbps

      WScript.Echo "PeakStreamingPlayers: " & objItem.PeakStreamingPlayers

      WScript.Echo "Timestamp_Object: " & objItem.Timestamp_Object

      WScript.Echo "Timestamp_PerfTime: " & objItem.Timestamp_PerfTime

      WScript.Echo "Timestamp_Sys100NS: " & objItem.Timestamp_Sys100NS

      WScript.Echo "TotalAdvertisements: " & objItem.TotalAdvertisements

      WScript.Echo "TotalConnectedPlayers: " & objItem.TotalConnectedPlayers

      WScript.Echo "TotalFileBytesRead: " & objItem.TotalFileBytesRead

      WScript.Echo "TotalLateReads: " & objItem.TotalLateReads

      WScript.Echo "TotalOutgoingDistributionBytesSent: " & objItem.TotalOutgoingDistributionBytesSent

      WScript.Echo "TotalOutgoingDistributionConnections: " & objItem.TotalOutgoingDistributionConnections

      WScript.Echo "TotalPlayerBytesSent: " & objItem.TotalPlayerBytesSent

      WScript.Echo "TotalStreamDenials: " & objItem.TotalStreamDenials

      WScript.Echo "TotalStreamErrors: " & objItem.TotalStreamErrors

      WScript.Echo "TotalStreamingPlayers: " & objItem.TotalStreamingPlayers

      WScript.Echo "TotalStreamTerminations: " & objItem.TotalStreamTerminations

      WScript.Echo

   Next

Next

Open in new window

0
Comment
Question by:W3Team
  • 3
  • 3
6 Comments
 
LVL 8

Expert Comment

by:jwarnken
Comment Utility
Can you view the counters in perfmon?

Wmi uses the same counters so I would start by ensuring that the counters are usable in perfmon.
0
 

Author Comment

by:W3Team
Comment Utility
As I mentioned above:
"...Windows Perfmon does not have any problem with querying those counters on both servers.", so yes, I can view those counters in perfmon.
0
 
LVL 8

Accepted Solution

by:
jwarnken earned 250 total points
Comment Utility
2 suggestions
1-  run the script with On Error Resume Next commented out and check for errors

2- run the attached scipt to ensure you are getting data returned
Const wbemFlagReturnImmediately = &h10

Const wbemFlagForwardOnly = &h20

 

arrComputers = Array("RM-STREAMSRV")

For Each strComputer In arrComputers

   WScript.Echo

   WScript.Echo "=========================================="

   WScript.Echo "Computer: " & strComputer

   WScript.Echo "=========================================="

 

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

   Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_WMServer_WindowsMediaPublishingPoints", "WQL", _

                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)

 

   Wscript.Echo "Number of datapoints in Win32_PerfFormattedData_WMServer_WindowsMediaPublishingPoints is " & colItems.Count

Next

Open in new window

0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

Author Comment

by:W3Team
Comment Utility
Thank you for the response. I have tried my script with On Error commented out with this error as a result:

temp_script.vbs(17, 4) (null): 0x80041010

Your script gave me this:

temp_script.vbs(15, 4) SWbemObjectSet: Unspecified error

Looks like it can't display colItems.Count since when I had removed it, it completed without error displaying only static text.
0
 
LVL 8

Assisted Solution

by:jwarnken
jwarnken earned 250 total points
Comment Utility
This indicates there is a differance in the class between the two OS versions.
http://www.microsoft.com/technet/scriptcenter/topics/help/wmi.mspx#EHAAC

Try using scriptomatic on both versions and compare the results.
0
 

Author Comment

by:W3Team
Comment Utility
I have followed your link and try to match the information there to our problem. However it does not directly solve the problem, it somehow helped. Unfortunately I really do not know how :-). I have tried to perform some of the tests on this page, tried to perform some actions recommended there for similar problems and initially that has not help at all. But somehow on some level of further digging the problem mysteriously disappeared... First thing we have managed to do was querying counters on problematic x64 server from another one in the farm (the x86 one). Then we tried to do it locally on x64 again but it did not work. Then we tried to query it again from outside x86 machine to check if we were not mistaken at the first time  we werent :-). Then eventually we tried another time locally and... it worked. I cant point out any particular action we have done to make it work&

So... I can not confirm that what you referred me to solve the problem directly but obviously it helped us to do "something", at least we were motivated to digg more. Therefore the points are yours :-), thank you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now