From 4f54fd077c1868604ef56f971ec93d0e0e80219a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1ll=20Gu=C3=B0j=C3=B3n=20Sigur=C3=B0sson?= Date: Thu, 10 Jun 2010 19:05:47 +0000 Subject: [PATCH] Perfdata improved for NSclient --- .../trunk/scripts/wmi/get_computer_info.vbs | 2 +- nsclient/trunk/scripts/wmi/get_diskio.vbs | 4 +-- nsclient/trunk/scripts/wmi/get_netio.vbs | 35 +++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 nsclient/trunk/scripts/wmi/get_netio.vbs diff --git a/nsclient/trunk/scripts/wmi/get_computer_info.vbs b/nsclient/trunk/scripts/wmi/get_computer_info.vbs index 82e7be4..33399a8 100644 --- a/nsclient/trunk/scripts/wmi/get_computer_info.vbs +++ b/nsclient/trunk/scripts/wmi/get_computer_info.vbs @@ -325,7 +325,7 @@ strInfo="" Set colWMI = objWMIService.ExecQuery("Select * from Win32_PerfRawData_PerfDisk_LogicalDisk") for Each objWMI In colWMI strOut = strOut & objWMI.Name & ", " - strPerfdata = strPerfdata & "'disk_read_" & objWMI.Name & "'=" & objWMI.DiskReadBytesPerSec & " " & "'disk_write_" & objWMI.Name & "'=" & objWMI.DiskWriteBytesPerSec & " " & "'disk_queue_" & objWMI.Name & "'=" & objWMI.CurrentDiskQueueLength & " " + strPerfdata = strPerfdata & "'disk_read_" & objWMI.Name & "'=" & objWMI.DiskReadBytesPerSec & " " & "'disk_write_" & objWMI.Name & "'=" & objWMI.DiskWriteBytesPerSec & " " & "'disk_queue_" & objWMI.Name & "'=" & objWMI.CurrentDiskQueueLength & " " & "'disk_reads_" & objWMI.Name & "'=" & objWMI.DiskReadsPerSec & " " & "'disk_writes_" & objWMI.Name & "'=" & objWMI.DiskWritesPerSec & " " next strResultTemp = "; Logical Disks: " & strOut & " | " & strPerfdata Exit Function diff --git a/nsclient/trunk/scripts/wmi/get_diskio.vbs b/nsclient/trunk/scripts/wmi/get_diskio.vbs index d40179e..8eee772 100644 --- a/nsclient/trunk/scripts/wmi/get_diskio.vbs +++ b/nsclient/trunk/scripts/wmi/get_diskio.vbs @@ -1,4 +1,4 @@ -' Copyright 2007 GroundWork Open Source Inc. +' Copyright 2010 Opin Kerfi ehf ok.is. ' ' This program is free software; you can redistribute it and/or ' modify it under the terms of the GNU General Public License @@ -11,7 +11,7 @@ ' GNU General Public License for more details. ' ' -' Author Dr. Pall Sigurdsson +' Author Pall Sigurdsson '************************************************************************************************* strComputer = "." diff --git a/nsclient/trunk/scripts/wmi/get_netio.vbs b/nsclient/trunk/scripts/wmi/get_netio.vbs new file mode 100644 index 0000000..442a1df --- /dev/null +++ b/nsclient/trunk/scripts/wmi/get_netio.vbs @@ -0,0 +1,35 @@ +' Copyright 2010 Opin Kerfi ehf ok.is. +' +' 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. +' +' +' Author Pall Sigurdsson + +'************************************************************************************************* +strComputer = "." +Set objWMIService = GetObject("winmgmts:" _ + & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") +set objRefresher = CreateObject("WbemScripting.SWbemRefresher") +Set colDisks = objRefresher.AddEnum _ + (objWMIService, "Win32_PerfRawData_Tcpip_NetworkInterface"). _ + objectSet +objRefresher.Refresh +strOut = "Network Interfaces: " +strPerfdata = " | " + For Each objDisk in colDisks + objRefresher.Refresh + strOut = strOut & " " & objDisk.Name & " " + strPerfdata = strPerfData & " 'net_sent_" & objDisk.Name & "'=" & objDisk.BytesSentPerSec + strPerfdata = strPerfData & " 'net_recv_" & objDisk.Name & "'=" & objDisk.BytesReceivedPerSec + Next +Wscript.Echo strOut & strPerfdata + +