[python-win32] Win32pdhutil - GetFormattedCounterValue while
running python thu IIS
sebastien Pastor
spastor at center.com
Mon Mar 29 05:36:22 EST 2004
Thanx Thomas,
Thanx for the link, it does help already !
Here is the code i have been using
"import win32pdhutil
nbConnections=win32pdhutil.GetPerformanceAttributes("Web Service",
"Current Connections", instance="_Total")
"
quite straightforward really...
Since then i have been doing this as a test :
query = win32pdhquery.Query(["\\Memory\\Available Bytes"])
print "here is the query Object " + str(query)
res=query.rawaddcounter("Memory", "Available Bytes",machine="127.0.0.1")
print res
print query.collectdata()
In order to try to understand where i am failing ... but so far no much
of success . For instance when i run locally those lines i can see "Here
is the query Object <win32pdhquery.Query instance at 0x00811480> but
when i call the script from my web browser i have "Here is the query
Object " then nothing afterwards ... does it mean my object is not
created ? How can i access the object status and eventually the reason
of creation failure ? Moreover, i have added the machine parameter just
in case the code would get confused when ran from IIS .. but no improvement
Thanx again for helping me out with this !
Seb
Thomas HERVE wrote:
>>Hi guys,
>>
>>
>
>Hi,
>
>
>
>>I ve got a piece of script which basically retrieve the "Current
>>
>>
>Connections", given by the Web Service
>
>
>>object. I am using Win32pdhutil and it works smoothly when i run the
>>
>>
>script locally.
>
>
>>If i try to run thru IIS as a cgi i ve got this message :
>>
>>
>> File
>>
>>
>"E:\PROGRA~1\Python22\Lib\site-packages\win32\lib\win32pdhutil.py", line
>59, in GetPerformanceAttributes
>
>
>> type, val = win32pdh.GetFormattedCounterValue(hc, format)
>>pywintypes.error: (-2147481645, 'GetFormattedCounterValue', 'No error
>>
>>
>message is available')
>
>First one tip to understand win32pdh error codes :
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/perfmon/base/pdh_error_codes.asp
>-2147481645 ---> in hex = 0x800007D3. "The data item has been added to the query but has not been validated nor
>accessed. No other status information on this data item is available."
>Of course here, it's not very useful...
>
>
>
>>I guess it might be permissions error but cannot find out which one ...
>>
>>
>
>I don't think it's permissions because pdh interface allow simple user to
>gather information. I think it's more a problem with the creation of you
>counter. If you can paste how you get the counterpath and how you add it
>it would be helpful.
>
>
>
>>Any help will be highly appreciated .
>>
>>
>
>I'll try to be better next time ;).
>
>
>
>>Seb
>>
>>
>
>--
>Thomas
>
>
>_______________________________________________
>Python-win32 mailing list
>Python-win32 at python.org
>http://mail.python.org/mailman/listinfo/python-win32
>
>
>
>
More information about the Python-win32
mailing list