'# Windows IIS monitorization plugin for Pandora FMS agent
'# Author: Manuel A. GulĂn Bejarano
'# Version: 1.0
'# Date: 22/04/2013
'#
'# 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, either version 3 of the License, or
'# (at your option) any later version.
'#
'# 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.
'#
'# You should have received a copy of the GNU General Public License
'# along with this program. If not, see .
'#
'#
'# Load with:
'# module_plugin cscript.exe //B "%ProgramFiles%\pandora_agent\util\iis_plugin.vbs"
Option Explicit
On Error Resume Next
' Variables
Dim objWMIService, objItem, colItems, argc, argv, i, Percent, query
' Parse command line parameters
argc = Wscript.Arguments.Count
Set argv = CreateObject("Scripting.Dictionary")
For i = 0 To argc - 1
argv.Add Wscript.Arguments(i), i
Next
Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")
query="Select Name, CurrentConnections, ServiceUptime, BytesTotalPersec, ConnectionAttemptsPersec " &_
"From Win32_PerfRawData_W3SVC_WebService " &_
"Where Name=""_Total"""
Set colItems = objWMIService.ExecQuery (query)
For Each objItem in colItems
If argc = 0 Or argv.Exists(objItem.Name) Then
If (objItem.ServiceUptime <> "") Then
Wscript.StdOut.WriteLine obj2Item.Name
'# Module to get the service uptime in seconds
Wscript.StdOut.WriteLine ""
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine " generic_data"
Wscript.StdOut.WriteLine " 0"
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine ""
Wscript.StdOut.WriteLine "Pepe: " & objItem.Name
Wscript.StdOut.flush
End If
If (objItem.BytesTotalPersec <> "") Then
'# Module to get the total bytes per second served
Wscript.StdOut.WriteLine ""
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine " generic_data"
Wscript.StdOut.WriteLine " 0"
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine ""
Wscript.StdOut.flush
End If
If (objItem.ConnectionAttemptsPersec <> "") Then
'# Module to get the total connections per second attempted
Wscript.StdOut.WriteLine ""
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine " generic_data"
Wscript.StdOut.WriteLine " 0"
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine ""
Wscript.StdOut.flush
End If
If (objItem.CurrentConnections <> "") Then
'# Module to get the number of current connections
Wscript.StdOut.WriteLine ""
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine " generic_data"
Wscript.StdOut.WriteLine " 0"
Wscript.StdOut.WriteLine " "
Wscript.StdOut.WriteLine ""
Wscript.StdOut.flush
End If
End If
Next