Win32_PerfRawData_W3SVC python sample code
The foundations for Manageability in Windows is Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).
ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself. The Win32_PerfRawData_W3SVC WMI class can be used in ActiveXperts Network Monitor to monitor your servers.
Sample Code
from win32com.client import GetObject objWMI = GetObject('winmgmts:').InstancesOf('Win32_PerfRawData_W3SVC_WebService') for obj in objWMI: if obj.AnonymousUsersPersec != None: print("AnonymousUsersPersec:" + str(obj.AnonymousUsersPersec)) if obj.BytesReceivedPersec != None: print("BytesReceivedPersec:" + str(obj.BytesReceivedPersec)) if obj.BytesSentPersec != None: print("BytesSentPersec:" + str(obj.BytesSentPersec)) if obj.BytesTotalPersec != None: print("BytesTotalPersec:" + str(obj.BytesTotalPersec)) if obj.Caption != None: print("Caption:" + str(obj.Caption)) if obj.CGIRequestsPersec != None: print("CGIRequestsPersec:" + str(obj.CGIRequestsPersec)) if obj.ConnectionAttemptsPersec != None: print("ConnectionAttemptsPersec:" + str(obj.ConnectionAttemptsPersec)) if obj.CopyRequestsPersec != None: print("CopyRequestsPersec:" + str(obj.CopyRequestsPersec)) if obj.CurrentAnonymousUsers != None: print("CurrentAnonymousUsers:" + str(obj.CurrentAnonymousUsers)) if obj.CurrentBlockedAsyncIORequests != None: print("CurrentBlockedAsyncIORequests:" + str(obj.CurrentBlockedAsyncIORequests)) if obj.Currentblockedbandwidthbytes != None: print("Currentblockedbandwidthbytes:" + str(obj.Currentblockedbandwidthbytes)) if obj.CurrentCALcountforauthenticatedusers != None: print("CurrentCALcountforauthenticatedusers:" + str(obj.CurrentCALcountforauthenticatedusers)) if obj.CurrentCALcountforSSLconnections != None: print("CurrentCALcountforSSLconnections:" + str(obj.CurrentCALcountforSSLconnections)) if obj.CurrentCGIRequests != None: print("CurrentCGIRequests:" + str(obj.CurrentCGIRequests)) if obj.CurrentConnections != None: print("CurrentConnections:" + str(obj.CurrentConnections)) if obj.CurrentISAPIExtensionRequests != None: print("CurrentISAPIExtensionRequests:" + str(obj.CurrentISAPIExtensionRequests)) if obj.CurrentNonAnonymousUsers != None: print("CurrentNonAnonymousUsers:" + str(obj.CurrentNonAnonymousUsers)) if obj.DeleteRequestsPersec != None: print("DeleteRequestsPersec:" + str(obj.DeleteRequestsPersec)) if obj.Description != None: print("Description:" + str(obj.Description)) if obj.FilesPersec != None: print("FilesPersec:" + str(obj.FilesPersec)) if obj.FilesReceivedPersec != None: print("FilesReceivedPersec:" + str(obj.FilesReceivedPersec)) if obj.FilesSentPersec != None: print("FilesSentPersec:" + str(obj.FilesSentPersec)) if obj.Frequency_Object != None: print("Frequency_Object:" + str(obj.Frequency_Object)) if obj.Frequency_PerfTime != None: print("Frequency_PerfTime:" + str(obj.Frequency_PerfTime)) if obj.Frequency_Sys100NS != None: print("Frequency_Sys100NS:" + str(obj.Frequency_Sys100NS)) if obj.GetRequestsPersec != None: print("GetRequestsPersec:" + str(obj.GetRequestsPersec)) if obj.HeadRequestsPersec != None: print("HeadRequestsPersec:" + str(obj.HeadRequestsPersec)) if obj.ISAPIExtensionRequestsPersec != None: print("ISAPIExtensionRequestsPersec:" + str(obj.ISAPIExtensionRequestsPersec)) if obj.LockedErrorsPersec != None: print("LockedErrorsPersec:" + str(obj.LockedErrorsPersec)) if obj.LockRequestsPersec != None: print("LockRequestsPersec:" + str(obj.LockRequestsPersec)) if obj.LogonAttemptsPersec != None: print("LogonAttemptsPersec:" + str(obj.LogonAttemptsPersec)) if obj.MaximumAnonymousUsers != None: print("MaximumAnonymousUsers:" + str(obj.MaximumAnonymousUsers)) if obj.MaximumCALcountforauthenticatedusers != None: print("MaximumCALcountforauthenticatedusers:" + str(obj.MaximumCALcountforauthenticatedusers)) if obj.MaximumCALcountforSSLconnections != None: print("MaximumCALcountforSSLconnections:" + str(obj.MaximumCALcountforSSLconnections)) if obj.MaximumCGIRequests != None: print("MaximumCGIRequests:" + str(obj.MaximumCGIRequests)) if obj.MaximumConnections != None: print("MaximumConnections:" + str(obj.MaximumConnections)) if obj.MaximumISAPIExtensionRequests != None: print("MaximumISAPIExtensionRequests:" + str(obj.MaximumISAPIExtensionRequests)) if obj.MaximumNonAnonymousUsers != None: print("MaximumNonAnonymousUsers:" + str(obj.MaximumNonAnonymousUsers)) if obj.MeasuredAsyncIOBandwidthUsage != None: print("MeasuredAsyncIOBandwidthUsage:" + str(obj.MeasuredAsyncIOBandwidthUsage)) if obj.MkcolRequestsPersec != None: print("MkcolRequestsPersec:" + str(obj.MkcolRequestsPersec)) if obj.MoveRequestsPersec != None: print("MoveRequestsPersec:" + str(obj.MoveRequestsPersec)) if obj.Name != None: print("Name:" + str(obj.Name)) if obj.NonAnonymousUsersPersec != None: print("NonAnonymousUsersPersec:" + str(obj.NonAnonymousUsersPersec)) if obj.NotFoundErrorsPersec != None: print("NotFoundErrorsPersec:" + str(obj.NotFoundErrorsPersec)) if obj.OptionsRequestsPersec != None: print("OptionsRequestsPersec:" + str(obj.OptionsRequestsPersec)) if obj.OtherRequestMethodsPersec != None: print("OtherRequestMethodsPersec:" + str(obj.OtherRequestMethodsPersec)) if obj.PostRequestsPersec != None: print("PostRequestsPersec:" + str(obj.PostRequestsPersec)) if obj.PropfindRequestsPersec != None: print("PropfindRequestsPersec:" + str(obj.PropfindRequestsPersec)) if obj.ProppatchRequestsPersec != None: print("ProppatchRequestsPersec:" + str(obj.ProppatchRequestsPersec)) if obj.PutRequestsPersec != None: print("PutRequestsPersec:" + str(obj.PutRequestsPersec)) if obj.SearchRequestsPersec != None: print("SearchRequestsPersec:" + str(obj.SearchRequestsPersec)) if obj.ServiceUptime != None: print("ServiceUptime:" + str(obj.ServiceUptime)) if obj.Timestamp_Object != None: print("Timestamp_Object:" + str(obj.Timestamp_Object)) if obj.Timestamp_PerfTime != None: print("Timestamp_PerfTime:" + str(obj.Timestamp_PerfTime)) if obj.Timestamp_Sys100NS != None: print("Timestamp_Sys100NS:" + str(obj.Timestamp_Sys100NS)) if obj.TotalAllowedAsyncIORequests != None: print("TotalAllowedAsyncIORequests:" + str(obj.TotalAllowedAsyncIORequests)) if obj.TotalAnonymousUsers != None: print("TotalAnonymousUsers:" + str(obj.TotalAnonymousUsers)) if obj.TotalBlockedAsyncIORequests != None: print("TotalBlockedAsyncIORequests:" + str(obj.TotalBlockedAsyncIORequests)) if obj.Totalblockedbandwidthbytes != None: print("Totalblockedbandwidthbytes:" + str(obj.Totalblockedbandwidthbytes)) if obj.TotalBytesReceived != None: print("TotalBytesReceived:" + str(obj.TotalBytesReceived)) if obj.TotalBytesSent != None: print("TotalBytesSent:" + str(obj.TotalBytesSent)) if obj.TotalBytesTransferred != None: print("TotalBytesTransferred:" + str(obj.TotalBytesTransferred)) if obj.TotalCGIRequests != None: print("TotalCGIRequests:" + str(obj.TotalCGIRequests)) if obj.TotalConnectionAttemptsallinstances != None: print("TotalConnectionAttemptsallinstances:" + str(obj.TotalConnectionAttemptsallinstances)) if obj.TotalCopyRequests != None: print("TotalCopyRequests:" + str(obj.TotalCopyRequests)) if obj.TotalcountoffailedCALrequestsforauthenticatedusers != None: print("TotalcountoffailedCALrequestsforauthenticatedusers:" + str(obj.TotalcountoffailedCALrequestsforauthenticatedusers)) if obj.TotalcountoffailedCALrequestsforSSLconnections != None: print("TotalcountoffailedCALrequestsforSSLconnections:" + str(obj.TotalcountoffailedCALrequestsforSSLconnections)) if obj.TotalDeleteRequests != None: print("TotalDeleteRequests:" + str(obj.TotalDeleteRequests)) if obj.TotalFilesReceived != None: print("TotalFilesReceived:" + str(obj.TotalFilesReceived)) if obj.TotalFilesSent != None: print("TotalFilesSent:" + str(obj.TotalFilesSent)) if obj.TotalFilesTransferred != None: print("TotalFilesTransferred:" + str(obj.TotalFilesTransferred)) if obj.TotalGetRequests != None: print("TotalGetRequests:" + str(obj.TotalGetRequests)) if obj.TotalHeadRequests != None: print("TotalHeadRequests:" + str(obj.TotalHeadRequests)) if obj.TotalISAPIExtensionRequests != None: print("TotalISAPIExtensionRequests:" + str(obj.TotalISAPIExtensionRequests)) if obj.TotalLockedErrors != None: print("TotalLockedErrors:" + str(obj.TotalLockedErrors)) if obj.TotalLockRequests != None: print("TotalLockRequests:" + str(obj.TotalLockRequests)) if obj.TotalLogonAttempts != None: print("TotalLogonAttempts:" + str(obj.TotalLogonAttempts)) if obj.TotalMethodRequests != None: print("TotalMethodRequests:" + str(obj.TotalMethodRequests)) if obj.TotalMethodRequestsPersec != None: print("TotalMethodRequestsPersec:" + str(obj.TotalMethodRequestsPersec)) if obj.TotalMkcolRequests != None: print("TotalMkcolRequests:" + str(obj.TotalMkcolRequests)) if obj.TotalMoveRequests != None: print("TotalMoveRequests:" + str(obj.TotalMoveRequests)) if obj.TotalNonAnonymousUsers != None: print("TotalNonAnonymousUsers:" + str(obj.TotalNonAnonymousUsers)) if obj.TotalNotFoundErrors != None: print("TotalNotFoundErrors:" + str(obj.TotalNotFoundErrors)) if obj.TotalOptionsRequests != None: print("TotalOptionsRequests:" + str(obj.TotalOptionsRequests)) if obj.TotalOtherRequestMethods != None: print("TotalOtherRequestMethods:" + str(obj.TotalOtherRequestMethods)) if obj.TotalPostRequests != None: print("TotalPostRequests:" + str(obj.TotalPostRequests)) if obj.TotalPropfindRequests != None: print("TotalPropfindRequests:" + str(obj.TotalPropfindRequests)) if obj.TotalProppatchRequests != None: print("TotalProppatchRequests:" + str(obj.TotalProppatchRequests)) if obj.TotalPutRequests != None: print("TotalPutRequests:" + str(obj.TotalPutRequests)) if obj.TotalRejectedAsyncIORequests != None: print("TotalRejectedAsyncIORequests:" + str(obj.TotalRejectedAsyncIORequests)) if obj.TotalSearchRequests != None: print("TotalSearchRequests:" + str(obj.TotalSearchRequests)) if obj.TotalTraceRequests != None: print("TotalTraceRequests:" + str(obj.TotalTraceRequests)) if obj.TotalUnlockRequests != None: print("TotalUnlockRequests:" + str(obj.TotalUnlockRequests)) if obj.TraceRequestsPersec != None: print("TraceRequestsPersec:" + str(obj.TraceRequestsPersec)) if obj.UnlockRequestsPersec != None: print("UnlockRequestsPersec:" + str(obj.UnlockRequestsPersec)) print("") print("########") print("")