Win32_PerfFormattedData_W3SVC_WebService - WMI sample in Python

The foundations for Manageability in Windows 7/2008/Vista/XP/2000 and Millennium Edition/'98 are 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.

On this site, you can find many WMI samples.


Win32_PerfFormattedData_W3SVC_WebService

Description

Example(s)

import win32com.client
def WMIDateStringToDate(dtmDate):
    strDateTime = ""
    if (dtmDate[4] == 0):
        strDateTime = dtmDate[5] + '/'
    else:
        strDateTime = dtmDate[4] + dtmDate[5] + '/'
    if (dtmDate[6] == 0):
        strDateTime = strDateTime + dtmDate[7] + '/'
    else:
        strDateTime = strDateTime + dtmDate[6] + dtmDate[7] + '/'
        strDateTime = strDateTime + dtmDate[0] + dtmDate[1] + dtmDate[2] + dtmDate[3] + " " + dtmDate[8] + dtmDate[9] + ":" + dtmDate[10] + dtmDate[11] +':' + dtmDate[12] + dtmDate[13]
    return strDateTime

strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("SELECT * FROM Win32_PerfFormattedData_W3SVC_WebService")
for objItem in colItems:
    if objItem.AnonymousUsersPersec != None:
        print "AnonymousUsersPersec:" + ` objItem.AnonymousUsersPersec`
    if objItem.BytesReceivedPersec != None:
        print "BytesReceivedPersec:" + ` objItem.BytesReceivedPersec`
    if objItem.BytesSentPersec != None:
        print "BytesSentPersec:" + ` objItem.BytesSentPersec`
    if objItem.BytesTotalPersec != None:
        print "BytesTotalPersec:" + ` objItem.BytesTotalPersec`
    if objItem.Caption != None:
        print "Caption:" + ` objItem.Caption`
    if objItem.CGIRequestsPersec != None:
        print "CGIRequestsPersec:" + ` objItem.CGIRequestsPersec`
    if objItem.ConnectionAttemptsPersec != None:
        print "ConnectionAttemptsPersec:" + ` objItem.ConnectionAttemptsPersec`
    if objItem.CopyRequestsPersec != None:
        print "CopyRequestsPersec:" + ` objItem.CopyRequestsPersec`
    if objItem.CurrentAnonymousUsers != None:
        print "CurrentAnonymousUsers:" + ` objItem.CurrentAnonymousUsers`
    if objItem.CurrentBlockedAsyncIORequests != None:
        print "CurrentBlockedAsyncIORequests:" + ` objItem.CurrentBlockedAsyncIORequests`
    if objItem.Currentblockedbandwidthbytes != None:
        print "Currentblockedbandwidthbytes:" + ` objItem.Currentblockedbandwidthbytes`
    if objItem.CurrentCALcountforauthenticatedusers != None:
        print "CurrentCALcountforauthenticatedusers:" + ` objItem.CurrentCALcountforauthenticatedusers`
    if objItem.CurrentCALcountforSSLconnections != None:
        print "CurrentCALcountforSSLconnections:" + ` objItem.CurrentCALcountforSSLconnections`
    if objItem.CurrentCGIRequests != None:
        print "CurrentCGIRequests:" + ` objItem.CurrentCGIRequests`
    if objItem.CurrentConnections != None:
        print "CurrentConnections:" + ` objItem.CurrentConnections`
    if objItem.CurrentISAPIExtensionRequests != None:
        print "CurrentISAPIExtensionRequests:" + ` objItem.CurrentISAPIExtensionRequests`
    if objItem.CurrentNonAnonymousUsers != None:
        print "CurrentNonAnonymousUsers:" + ` objItem.CurrentNonAnonymousUsers`
    if objItem.DeleteRequestsPersec != None:
        print "DeleteRequestsPersec:" + ` objItem.DeleteRequestsPersec`
    if objItem.Description != None:
        print "Description:" + ` objItem.Description`
    if objItem.FilesPersec != None:
        print "FilesPersec:" + ` objItem.FilesPersec`
    if objItem.FilesReceivedPersec != None:
        print "FilesReceivedPersec:" + ` objItem.FilesReceivedPersec`
    if objItem.FilesSentPersec != None:
        print "FilesSentPersec:" + ` objItem.FilesSentPersec`
    if objItem.Frequency_Object != None:
        print "Frequency_Object:" + ` objItem.Frequency_Object`
    if objItem.Frequency_PerfTime != None:
        print "Frequency_PerfTime:" + ` objItem.Frequency_PerfTime`
    if objItem.Frequency_Sys100NS != None:
        print "Frequency_Sys100NS:" + ` objItem.Frequency_Sys100NS`
    if objItem.GetRequestsPersec != None:
        print "GetRequestsPersec:" + ` objItem.GetRequestsPersec`
    if objItem.HeadRequestsPersec != None:
        print "HeadRequestsPersec:" + ` objItem.HeadRequestsPersec`
    if objItem.ISAPIExtensionRequestsPersec != None:
        print "ISAPIExtensionRequestsPersec:" + ` objItem.ISAPIExtensionRequestsPersec`
    if objItem.LockedErrorsPersec != None:
        print "LockedErrorsPersec:" + ` objItem.LockedErrorsPersec`
    if objItem.LockRequestsPersec != None:
        print "LockRequestsPersec:" + ` objItem.LockRequestsPersec`
    if objItem.LogonAttemptsPersec != None:
        print "LogonAttemptsPersec:" + ` objItem.LogonAttemptsPersec`
    if objItem.MaximumAnonymousUsers != None:
        print "MaximumAnonymousUsers:" + ` objItem.MaximumAnonymousUsers`
    if objItem.MaximumCALcountforauthenticatedusers != None:
        print "MaximumCALcountforauthenticatedusers:" + ` objItem.MaximumCALcountforauthenticatedusers`
    if objItem.MaximumCALcountforSSLconnections != None:
        print "MaximumCALcountforSSLconnections:" + ` objItem.MaximumCALcountforSSLconnections`
    if objItem.MaximumCGIRequests != None:
        print "MaximumCGIRequests:" + ` objItem.MaximumCGIRequests`
    if objItem.MaximumConnections != None:
        print "MaximumConnections:" + ` objItem.MaximumConnections`
    if objItem.MaximumISAPIExtensionRequests != None:
        print "MaximumISAPIExtensionRequests:" + ` objItem.MaximumISAPIExtensionRequests`
    if objItem.MaximumNonAnonymousUsers != None:
        print "MaximumNonAnonymousUsers:" + ` objItem.MaximumNonAnonymousUsers`
    if objItem.MeasuredAsyncIOBandwidthUsage != None:
        print "MeasuredAsyncIOBandwidthUsage:" + ` objItem.MeasuredAsyncIOBandwidthUsage`
    if objItem.MkcolRequestsPersec != None:
        print "MkcolRequestsPersec:" + ` objItem.MkcolRequestsPersec`
    if objItem.MoveRequestsPersec != None:
        print "MoveRequestsPersec:" + ` objItem.MoveRequestsPersec`
    if objItem.Name != None:
        print "Name:" + ` objItem.Name`
    if objItem.NonAnonymousUsersPersec != None:
        print "NonAnonymousUsersPersec:" + ` objItem.NonAnonymousUsersPersec`
    if objItem.NotFoundErrorsPersec != None:
        print "NotFoundErrorsPersec:" + ` objItem.NotFoundErrorsPersec`
    if objItem.OptionsRequestsPersec != None:
        print "OptionsRequestsPersec:" + ` objItem.OptionsRequestsPersec`
    if objItem.OtherRequestMethodsPersec != None:
        print "OtherRequestMethodsPersec:" + ` objItem.OtherRequestMethodsPersec`
    if objItem.PostRequestsPersec != None:
        print "PostRequestsPersec:" + ` objItem.PostRequestsPersec`
    if objItem.PropfindRequestsPersec != None:
        print "PropfindRequestsPersec:" + ` objItem.PropfindRequestsPersec`
    if objItem.ProppatchRequestsPersec != None:
        print "ProppatchRequestsPersec:" + ` objItem.ProppatchRequestsPersec`
    if objItem.PutRequestsPersec != None:
        print "PutRequestsPersec:" + ` objItem.PutRequestsPersec`
    if objItem.SearchRequestsPersec != None:
        print "SearchRequestsPersec:" + ` objItem.SearchRequestsPersec`
    if objItem.ServiceUptime != None:
        print "ServiceUptime:" + ` objItem.ServiceUptime`
    if objItem.Timestamp_Object != None:
        print "Timestamp_Object:" + ` objItem.Timestamp_Object`
    if objItem.Timestamp_PerfTime != None:
        print "Timestamp_PerfTime:" + ` objItem.Timestamp_PerfTime`
    if objItem.Timestamp_Sys100NS != None:
        print "Timestamp_Sys100NS:" + ` objItem.Timestamp_Sys100NS`
    if objItem.TotalAllowedAsyncIORequests != None:
        print "TotalAllowedAsyncIORequests:" + ` objItem.TotalAllowedAsyncIORequests`
    if objItem.TotalAnonymousUsers != None:
        print "TotalAnonymousUsers:" + ` objItem.TotalAnonymousUsers`
    if objItem.TotalBlockedAsyncIORequests != None:
        print "TotalBlockedAsyncIORequests:" + ` objItem.TotalBlockedAsyncIORequests`
    if objItem.Totalblockedbandwidthbytes != None:
        print "Totalblockedbandwidthbytes:" + ` objItem.Totalblockedbandwidthbytes`
    if objItem.TotalBytesReceived != None:
        print "TotalBytesReceived:" + ` objItem.TotalBytesReceived`
    if objItem.TotalBytesSent != None:
        print "TotalBytesSent:" + ` objItem.TotalBytesSent`
    if objItem.TotalBytesTransfered != None:
        print "TotalBytesTransfered:" + ` objItem.TotalBytesTransfered`
    if objItem.TotalCGIRequests != None:
        print "TotalCGIRequests:" + ` objItem.TotalCGIRequests`
    if objItem.TotalConnectionAttemptsallinstances != None:
        print "TotalConnectionAttemptsallinstances:" + ` objItem.TotalConnectionAttemptsallinstances`
    if objItem.TotalCopyRequests != None:
        print "TotalCopyRequests:" + ` objItem.TotalCopyRequests`
    if objItem.TotalcountoffailedCALrequestsforauthenticatedusers != None:
        print "TotalcountoffailedCALrequestsforauthenticatedusers:" + ` objItem.TotalcountoffailedCALrequestsforauthenticatedusers`
    if objItem.TotalcountoffailedCALrequestsforSSLconnections != None:
        print "TotalcountoffailedCALrequestsforSSLconnections:" + ` objItem.TotalcountoffailedCALrequestsforSSLconnections`
    if objItem.TotalDeleteRequests != None:
        print "TotalDeleteRequests:" + ` objItem.TotalDeleteRequests`
    if objItem.TotalFilesReceived != None:
        print "TotalFilesReceived:" + ` objItem.TotalFilesReceived`
    if objItem.TotalFilesSent != None:
        print "TotalFilesSent:" + ` objItem.TotalFilesSent`
    if objItem.TotalFilesTransferred != None:
        print "TotalFilesTransferred:" + ` objItem.TotalFilesTransferred`
    if objItem.TotalGetRequests != None:
        print "TotalGetRequests:" + ` objItem.TotalGetRequests`
    if objItem.TotalHeadRequests != None:
        print "TotalHeadRequests:" + ` objItem.TotalHeadRequests`
    if objItem.TotalISAPIExtensionRequests != None:
        print "TotalISAPIExtensionRequests:" + ` objItem.TotalISAPIExtensionRequests`
    if objItem.TotalLockedErrors != None:
        print "TotalLockedErrors:" + ` objItem.TotalLockedErrors`
    if objItem.TotalLockRequests != None:
        print "TotalLockRequests:" + ` objItem.TotalLockRequests`
    if objItem.TotalLogonAttempts != None:
        print "TotalLogonAttempts:" + ` objItem.TotalLogonAttempts`
    if objItem.TotalMethodRequests != None:
        print "TotalMethodRequests:" + ` objItem.TotalMethodRequests`
    if objItem.TotalMethodRequestsPersec != None:
        print "TotalMethodRequestsPersec:" + ` objItem.TotalMethodRequestsPersec`
    if objItem.TotalMkcolRequests != None:
        print "TotalMkcolRequests:" + ` objItem.TotalMkcolRequests`
    if objItem.TotalMoveRequests != None:
        print "TotalMoveRequests:" + ` objItem.TotalMoveRequests`
    if objItem.TotalNonAnonymousUsers != None:
        print "TotalNonAnonymousUsers:" + ` objItem.TotalNonAnonymousUsers`
    if objItem.TotalNotFoundErrors != None:
        print "TotalNotFoundErrors:" + ` objItem.TotalNotFoundErrors`
    if objItem.TotalOptionsRequests != None:
        print "TotalOptionsRequests:" + ` objItem.TotalOptionsRequests`
    if objItem.TotalOtherRequestMethods != None:
        print "TotalOtherRequestMethods:" + ` objItem.TotalOtherRequestMethods`
    if objItem.TotalPostRequests != None:
        print "TotalPostRequests:" + ` objItem.TotalPostRequests`
    if objItem.TotalPropfindRequests != None:
        print "TotalPropfindRequests:" + ` objItem.TotalPropfindRequests`
    if objItem.TotalProppatchRequests != None:
        print "TotalProppatchRequests:" + ` objItem.TotalProppatchRequests`
    if objItem.TotalPutRequests != None:
        print "TotalPutRequests:" + ` objItem.TotalPutRequests`
    if objItem.TotalRejectedAsyncIORequests != None:
        print "TotalRejectedAsyncIORequests:" + ` objItem.TotalRejectedAsyncIORequests`
    if objItem.TotalSearchRequests != None:
        print "TotalSearchRequests:" + ` objItem.TotalSearchRequests`
    if objItem.TotalTraceRequests != None:
        print "TotalTraceRequests:" + ` objItem.TotalTraceRequests`
    if objItem.TotalUnlockRequests != None:
        print "TotalUnlockRequests:" + ` objItem.TotalUnlockRequests`
    if objItem.TraceRequestsPersec != None:
        print "TraceRequestsPersec:" + ` objItem.TraceRequestsPersec`
    if objItem.UnlockRequestsPersec != None:
        print "UnlockRequestsPersec:" + ` objItem.UnlockRequestsPersec`