Here is a simple example of a WhatsUp Gold public status page to show to end users. It will show the status of devices without giving them extra information they do not need.
<% @LANGUAGE="VBScript"%>
<%
publicview = "Group To Show"
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DSN=WhatsUp"
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM DeviceGroup where sGroupName = '" & publicview & "';"
rs.open strSQL,adoCon
groupid = rs("nDeviceGroupID")
rs.close
strSQL = "Select * from PivotDeviceToGroup where nDeviceGroupID = " & groupid
rs.open strSQL,adoCon
deviceswewant = ""
do while not rs.eof
if not deviceswewant = "" then
deviceswewant = deviceswewant & " OR "
end if
deviceswewant = deviceswewant & "(nDeviceID=" & rs("nDeviceID") & ")"
rs.movenext
loop
rs.close
strSQL = "select * from Device where " & deviceswewant & ";"
rs.open strSQL,adoCon
%>
| name | status | ||
|---|---|---|---|
| " & name & " | " if not isnull(maintenancemode) then response.write "" & "Maintenace Mode |
"
elseif status = "" then
response.write "
" & "Happy Camper |
"
else
response.write "
" & "Experiencing Problems |
"
end if
response.write "
–These directions assume some whatsup knowledge.
–ESXi does not support SNMP gets, only TRAPS.
Setup
- Install Python 2.6.x
- Install pywbem
- Download check_esx_wbem.py put it into c:\python26
- In Whatsup create new windows credentials, for the domain use esx. For example use esx\root for the username and the input the password.
- On the node make sure that its configured to use those credentials.
- Create a new active script monitor and paste the code below.
- Assign the active script monitor to your node and your all set.
I didn’t write the python script, if you have any problem please first test the python script from the command line. You have to use the windows installer for pywbem the latest version has a dependency that does not work in windows.
I have tested the script on IBM servers. Please let me know if you make any modifications to the script i would love to see them.
'Wbem ESX Monitor
'Stephen
Context.SetResult 0, "No Error"
sysAddress = Context.GetProperty("Address")
sysAdminUser = Context.GetProperty("CredWindows:DomainAndUserid")
sysAdminPass = Context.GetProperty("CredWindows:Password")
sysAdminUser = replace(sysAdminUser,"esx\","")
sysAddress = "https://" & sysAddress & ":5989"
esxcheck = "c:\python26\check_esx_wbem.py"
Set objShell = CreateObject("Wscript.Shell")
command = "python " & esxcheck & " " & sysAddress & " " & sysAdminUser & " " & sysAdminPass
returncode = objShell.run(command ,0 , True)
Select Case returncode
Case 0
context.SetResult 0, "OK! Return Code:" & returncode
Case 1
context.SetREsult 1, "Warning!! Return Code:" & returncode
Case 2
context.SetResult 1, "Critical!!! Return Code:" & returncode
Case 3
context.SetResult 1, "Unknown!!! Return Code:" & returncode
End select
Here is my ClassesToCheck block, I added Fan and power supply.
# define classes to check 'OperationStatus' instance ClassesToCheck = [ 'CIM_ComputerSystem', 'CIM_NumericSensor', 'CIM_Memory', 'CIM_Processor', 'CIM_RecordLog', 'OMC_DiscreteSensor', 'OMC_Fan', 'OMC_PowerSupply', 'VMware_StorageExtent', 'VMware_Controller', 'VMware_StorageVolume', 'VMware_Battery', 'VMware_SASSATAPort' ]

Recent Comments