[mrtg] Re: Hand up to Microsoft.
Davey.Rance at sungard.com
Davey.Rance at sungard.com
Thu Dec 5 18:03:44 MET 2002
The best way that I have found to get around this is to use WMI.
Using WMI you can access the raw perfmon counters and these allow you to
get the raw data. As there are small bugs in MS SNMP or there were a
couple in early W2k that meant disk space counters would never go down
until the service was restarted and then it would be fine until the disk
space went down again.
Here is a small sample script that will get the CPU total from WMI It
is a counter object that has a base time of 100ns ticks. The best way
to use this I found out was to log both the counter and the number of
ticks to RRDTOOL then you can do math's with the number of ticks and
such at graphing time.
But if you wanted to display number of ticks for a individual processor
change the script to use this line for the query
Set SystemSet = GetObject("winmgmts:!\\" &
strServerName).ExecQuery("select PercentProcessorTime,Timestamp_Sys100NS
from Win32_PerfRawData_PerfOS_Processor where name="&strValue&"")
Where strServerName = name of the server that you wish to query
And strValue = number of CPU that you want the total for.
I have been using VBScript for scripts but if some one is a c++
programmer I would be more than willing to assist to help with
developing a .exe version.
********************************************* cut from here
****************************************
strResult = Perfstats (strServerName,
strPercentProcessorTime,strTimestamp_Sys100NS)
if strResult <> "Error" then
wscript.Echo strPercentProcessorTime
wscript.Echo strTimestamp_Sys100NS
end if
set strPercentProcessorTime = nothing
set strTimestamp_Sys100NS = nothing
set objArgs = nothing
set strResult = nothing
set strServerName = nothing
function PerfStats(strServerName,
strPercentProcessorTime,strTimestamp_Sys100NS)
dim SystemSet
dim item
Set SystemSet = GetObject("winmgmts:!\\" &
strServerName).ExecQuery("select PercentProcessorTime,Timestamp_Sys100NS
from Win32_PerfRawData_PerfOS_Processor")
if err.Number <> 0 then
perfStats = "Error"
else
for each item in SystemSet
strPercentProcessorTime=item.PercentProcessorTime
strTimestamp_Sys100NS=item.Timestamp_Sys100NS
next
end if
set systemSet = nothing
set item = nothing
end function
********************************************* cut from here
****************************************
That
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the mrtg
mailing list