1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-14 14:33:46 +01:00
nagios-plugins/nsclient/trunk/scripts/wmi/get_diskio.vbs

54 lines
2.4 KiB
Plaintext
Raw Normal View History

2010-06-10 21:05:47 +02:00
' Copyright 2010 Opin Kerfi ehf ok.is.
2010-05-31 20:17:30 +02:00
'
' This program is free software; you can redistribute it and/or
' modify it under the terms of the GNU General Public License
' as published by the Free Software Foundation; version 2
' of the License.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
'
2010-06-10 21:05:47 +02:00
' Author Pall Sigurdsson <palli at opensource.is>
2010-05-31 20:17:30 +02:00
'*************************************************************************************************
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set objRefresher = CreateObject("WbemScripting.SWbemRefresher")
Set colDisks = objRefresher.AddEnum _
(objWMIService, "win32_perfformatteddata_perfdisk_logicaldisk"). _
objectSet
objRefresher.Refresh
strOut = "Logical Disks: "
strPerfdata = " | "
2010-09-06 01:45:55 +02:00
'Shii.... I sure hope nobody is going to see how ugly this is
num_disks = 0
For Each objDisk in colDisks
num_disks = num_disks + 1
Next
2010-05-31 20:17:30 +02:00
For Each objDisk in colDisks
2010-09-06 01:45:55 +02:00
objRefresher.Refresh
strOut = strOut & " " & objDisk.Name & " "
strPerfdata = strPerfData & " 'ReadBytesPerSec_" & objDisk.Name & "'=" & objDisk.DiskReadBytesPerSec
strPerfdata = strPerfData & " 'WriteBytesPerSec_" & objDisk.Name & "'=" & objDisk.DiskWriteBytesPerSec
strPerfdata = strPerfData & " 'ReadsPerSec_" & objDisk.Name & "'=" & objDisk.DiskReadsPerSec
strPerfdata = strPerfData & " 'WritesPerSec_" & objDisk.Name & "'=" & objDisk.DiskWritesPerSec
if num_disks < 4 Then
strPerfdata = strPerfData & " 'PercentDiskReadTime_" & objDisk.Name & "'=" & objDisk.PercentDiskReadTime
strPerfdata = strPerfData & " 'SplitIOPerSec_" & objDisk.Name & "'=" & objDisk.SplitIOPerSec
strPerfdata = strPerfData & " 'PercentDiskTime_" & objDisk.Name & "'=" & objDisk.PercentDiskTime
strPerfdata = strPerfData & " 'AvgDiskBytesPerTransfer_" & objDisk.Name & "'=" & objDisk.AvgDiskBytesPerTransfer
End If
if num_disks < 6 Then
strPerfdata = strPerfData & " 'AvgDiskQueueLength_" & objDisk.Name & "'=" & objDisk.AvgDiskQueueLength
End If
2010-05-31 20:17:30 +02:00
Next
Wscript.Echo strOut & strPerfdata
2010-09-06 01:45:55 +02:00