int_act_mon

How do I handle interface active monitors?

The problem

When you discover network devices using default settings, an active monitor is added for each interface the device has. Active monitors are enabled for the interfaces that were active during the discovery scan, and the others are sitting there disabled. The problem with this approach is that when an access switch is scanned, you may potentially end up with a bunch of monitors you do not care to be alerted about enabled on a device.

The solution(s)

Disable them all

You have many different options here. One of the options for you is to simply disable them. To do so, go to your ‘My Network’ tab and select your top level device group. From here, hit the checkbox to select all devices and then right-click any device in the list and go to ‘Edit Devices’ -> ‘Active Monitor Properties’. In the next dialog, simply specify ‘Interface’ for the active monitor and change ‘Enable Polling’ to ‘Off’. This will disable the interface active monitor across all devices. Note that, depending on your environment you *MAY* want to monitor certain interfaces for their administrative status. In those scenarios, you can either manually enable the monitors on a device by device basis *OR* you can could use a script do enable specific monitors for you. More details on those scripts later.

Use the ‘Filter library’ under device roles

One of the best options is to use the built-in option for filtering these interfaces. Doing so is simple, using WhatsUp Gold’s Device Roles and Sub Roles. You can access this once logged into the web interface under Settings > Libraries > Roles and Sub Roles. From here, you can access the switch, router, firewall, etc. roles and adjust your filters on the interfaces accordingly. You can then apply these filters to the interface active monitor within your roles and sub roles.

T-SQL: Disable monitors not in map views

In older releases of the solution, you were able to enable just interface active monitors shown in Layer-2 maps. I tried to reconstruct this functionality using T-SQL. Before you do anything with this T-SQL: Stop your services and backup your database just in case you are unhappy with the result. After the T-SQL is run, you can start your services again and you will see that all interface active monitors that are *NOT* shown in any map view are disabled and the monitors shown in maps are enabled. Notice it is broken up into sections, so you can run either enable/disable or both.

T-SQL

use whatsup;
--enable monitors that are disabled and in the map view
update pivotactivemonitortypetodevice
set bDisabled = 0 where (bDisabled = 1 and nActiveMonitorTypeID in (22) and nPivotActiveMonitorTypeToDeviceID in (select distinct(MonitorID_A) as 'nPivotActiveMonitorTypeToDeviceID' from WugMapLink WML join PivotActiveMonitorTypeToDevice PAMTD on PAMTD.nPivotActiveMonitorTypeToDeviceID = WML.MonitorID_A
union
select distinct(MonitorID_B) as 'nPivotActiveMonitorTypeToDeviceID' from WugMapLink WML join PivotActiveMonitorTypeToDevice PAMTD on PAMTD.nPivotActiveMonitorTypeToDeviceID = WML.MonitorID_B))
--disable monitors that are enabled and not in any map view
use whatsup;
update pivotactivemonitortypetodevice
set bDisabled = 1 where (bDisabled = 0 and nActiveMonitorTypeID in (22) and nPivotActiveMonitorTypeToDeviceID not in (select distinct(MonitorID_A) as 'nPivotActiveMonitorTypeToDeviceID' from WugMapLink WML join PivotActiveMonitorTypeToDevice PAMTD on PAMTD.nPivotActiveMonitorTypeToDeviceID = WML.MonitorID_A
union
select distinct(MonitorID_B) as 'nPivotActiveMonitorTypeToDeviceID' from WugMapLink WML join PivotActiveMonitorTypeToDevice PAMTD on PAMTD.nPivotActiveMonitorTypeToDeviceID = WML.MonitorID_B))

The scripted way

Using a script, you can cycle through these monitors and enable/disable them in bulk based off of any shared criteria. For example, maybe you label each of your important interface with a meaningful description and everything else is ‘GigabitEthernet’. Using a script you could simply disable all interface active monitors across all devices which have ‘GigabitEthernet’ as their comment on the monitor.

WhatsUp Gold Active Script Action (VBScript)

'This Action Script is NOT Device assigned and should be used as a global recurring action that could be scheduled or run manually as needed
Option Explicit
'***DO NOT MODIFY ABOVE THIS LINE AT RISK OF BREAKING THE SCRIPT**
' ******************* Configuration *************************
'Set to True if you want to *DISABLE* interfaces, Set to False if you do not want to *DISABLE* any interface active monitors
Dim bRunDisable : bRunDisable = True
'This should match a portion of the comment of the interface active monitors you'd like to *DISABLE*
Dim sDisableComment : sDisableComment = "GigabitEthernet"
Dim sDisableComment2 : sDisableComment2 = "" 'Optional: Enter second comment to match, leave blank if you don't need it
Dim sDisableComment3 : sDisableComment3 = "" 'Optional: Enter third comment to match, leave blank if you don't need it
Dim sDisableComment4 : sDisableComment4 = "" 'Optional: Enter fourth comment to match, leave blank if you don't need it


'Set to True if you want to *ENABLE* interfaces, Set to False if you do not want to *ENABLE* any interface active monitors
Dim bRunEnable : bRunEnable = True
'This should match a portion of the comment of the interface active monitors you'd like to *ENABLE*
Dim sEnableComment : sEnableComment = "Trunk" 'Enter first comment to match
Dim sEnableComment2 : sEnableComment2 = "VLAN" 'Optional: Enter second comment to match, leave blank if you don't need it
Dim sEnableComment3 : sEnableComment3 = "to switch" 'Optional: Enter third comment to match, leave blank if you don't need it
Dim sEnableComment4 : sEnableComment4 = "" 'Optional: Enter fourth comment to match, leave blank if you don't need it

'When disabling, 0 means disable all that match, 1 means disable only those that match and are down
Dim bDownDisable : bDownDisable = 0

'Device Group(s): Set to the device group you'd like to run the script against
'This can be either a device group or dynamic group name. It must match exactly!
'Leaving this variable blank is the equivalent of "All Devices"
Dim sDeviceGroup : sDeviceGroup = ""

'Do a dry run? If True, then SQL commands will not be executed, only logged.
Dim bDryRun : bDryRun = False
' ***************** End Configuration ***********************

'***DO NOT MODIFY BELOW THIS LINE AT RISK OF BREAKING THE SCRIPT***

'Variable declaration
Dim nPivotActiveMonitorTypeToDeviceID 'This will be used for tracking the nPivotActiveMonitorTypeToDeviceID
Dim sDisableQuery 'This will be used for settings the disable query depending on if you set bDisable to 1
Dim nCurrDevID : nCurrDevID = 0 'This will be used for tracking which nDeviceID we are working on
Dim nNewDevID 'This will be used for tracking which nDeviceID we are working on
Dim bContinue : bContinue = True 'This is a true/false flag to specifying whether to continue in the script or not
Dim sGroupQuery : sGroupQuery = "" 'This will be filled in later depending on what type of group is entered in the 'sDeviceGroup' variable
Dim nDisableCount : nDisableCount = 0 'This will be used to keep count of how many devices we disabled interfaces on
Dim nEnableCount : nEnableCount = 0 'This will be used to keep count of how many devices we enabled interfaces on
Dim sFinalEnableComment : sFinalEnableComment = "" 'This will set the final enable comment TSQL
Dim sFinalDisableComment : sFinalDisableComment = "" 'This will set the final disable comment TSQL

'Optional: TSQL adjustments: You can adjust the TSQL matching here by adjusting where % (wildcards) are placed
If Len(sEnableComment) > 0 Then
	sFinalEnableComment = "(sComment like '%" & sEnableComment & "%' "
End If
If Len(sEnableComment2) > 0 Then
	sFinalEnableComment = sFinalEnableComment & "or sComment like '%" & sEnableComment2 & "%' "
End If
If Len(sEnableComment3) > 0 Then
	sFinalEnableComment = sFinalEnableComment & "or sComment like '%" & sEnableComment3 & "%' "
End If
If Len(sEnableComment4) > 0 Then
	sFinalEnableComment = sFinalEnableComment & "or sComment like '%" & sEnableComment4 & "%' "
End If
sFinalEnableComment = sFinalEnableComment & ") "

If Len(sDisableComment) > 0 Then
	sFinalDisableComment = "(sComment like '%" & sDisableComment & "%' "
End If
If Len(sDisableComment2) > 0 Then
	sFinalDisableComment = sFinalDisableComment & "or sComment like '%" & sDisableComment2 & "%' "
End If
If Len(sDisableComment3) > 0 Then
	sFinalDisableComment = sFinalDisableComment & "or sComment like '%" & sDisableComment3 & "%' "
End If
If Len(sDisableComment4) > 0 Then
	sFinalDisableComment = sFinalDisableComment & "or sComment like '%" & sDisableComment4 & "%' "
End If
sFinalDisableComment = sFinalDisableComment & ") "

'Create DB Object
Dim oDB : Set oDB = Context.GetDB
'Create WUG Event Helper Object
Dim oEvent : Set oEvent = CreateObject("CoreAsp.EventHelper")

'****BEGIN MAIN SCRIPT****
'Get the device group type
GetDeviceGroupType sDeviceGroup
'If the continue flag is true, keep going
If bContinue = True Then
 Dim sSqlToEnable : sSqlToEnable = "SELECT nPivotActiveMonitorTypeToDeviceID, PAMTD2.nDeviceID FROM PivotActiveMonitorTypeToDevice PAMTD2" & _
 " join ActiveMonitorType on ActiveMonitorType.nActiveMonitorTypeID = PAMTD2.nActiveMonitorTypeID " & _
 " where (PAMTD2.nActiveMonitorTypeID = 22 and " & sFinalEnableComment & _
 " and bDisabled = 1) " & sGroupQuery
 Dim sSqlToDisable : sSqlToDisable = "SELECT nPivotActiveMonitorTypeToDeviceID, PAMTD2.nDeviceID FROM PivotActiveMonitorTypeToDevice PAMTD2" & _
 " join ActiveMonitorType on ActiveMonitorType.nActiveMonitorTypeID = PAMTD2.nActiveMonitorTypeID " & _
 " join Device D on D.nDeviceID = PAMTD2.nDeviceID " & _
 " where (PAMTD2.nActiveMonitorTypeID = 22 and " & sFinalDisableComment & _
 " and bDisabled = 0) " & sGroupQuery
 Dim sSqlToDisable1 : sSqlToDisable1 = "SELECT nPivotActiveMonitorTypeToDeviceID, PAMTD2.nDeviceID FROM PivotActiveMonitorTypeToDevice PAMTD2" & _
 " join ActiveMonitorType on ActiveMonitorType.nActiveMonitorTypeID = PAMTD2.nActiveMonitorTypeID" & _
 " where (PAMTD2.nActiveMonitorTypeID = 22 and " & sFinalDisableComment & _
 " and bDisabled = 0 and nPivotActiveMonitorTypeToDeviceID in (" & _
 " select nPivotActiveMonitorTypeToDeviceID from PivotActiveMonitorTypeToDevice PAMTD" & _
 " join MonitorState MS on MS.nMonitorStateID = PAMTD.nMonitorStateID" & _
 " where nInternalMonitorState = 1))" & sGroupQuery
 
 If bDownDisable = 0 Then sDisableQuery = sSqlToDisable
 If bDownDisable = 1 Then sDisableQuery = sSqlToDisable1
 'Run the disable/enable SQLs and send change events
 If bRunDisable Then
 	Context.NotifyProgress "Disable query: " & sDisableQuery
  DisableInterfacesSQL sDisableQuery
 Else
 	Context.NotifyProgress "*DISABLE* interfaces skipped due to bRunDisable flag"
 End If
 If bRunEnable Then
  Context.NotifyProgress "Enable query: " & sSqlToEnable
  EnableInterfacesSQL sSqlToEnable
 Else
 	Context.NotifyProgress "*ENABLE* interfaces skipped due to bRunDisable flag"
 End If
End If
Context.NotifyProgress nEnableCount & " devices had interfaces enabled"
Context.NotifyProgress nDisableCount & " devices had interfaces disabled"
'****END MAIN SCRIPT****

' **********************
' * GetDeviceGroupType *
' **********************
Sub GetDeviceGroupType(sDeviceGroup)
Context.NotifyProgress "****** GetDeviceGroupType sub procedure start." & vbCrLf
'This gets the device group ID
If Len(sDeviceGroup) > 0 Then
 Context.NotifyProgress "Finding group ID..."
 Dim nDeviceGroupID : nDeviceGroupID = GetSQLOutputToInt("select min(nDeviceGroupID) from DeviceGroup where sGroupName = '" & sDeviceGroup &"'")
 Context.NotifyProgress nDeviceGroupID & " is the group ID"
 If nDeviceGroupID > 0 Then
  'This gets whether that device group is dynamic or not
  Dim bDynamicGroup : bDynamicGroup = GetSQLOutputToBoolean("select bDynamicGroup from DeviceGroup where nDeviceGroupID = " & nDeviceGroupID)
  Context.NotifyProgress bDynamicGroup & " is the value of bDynamicGroup for nDeviceGroupID " & nDeviceGroupID
  If bDynamicGroup = 0 Then
 	 sGroupQuery = " and nPivotActiveMonitorTypeToDeviceID in (select nPivotActiveMonitorTypeToDeviceID from PivotDeviceToGroup PDTG join PivotActiveMonitorTypeToDevice PAMTD3 on PAMTD3.nDeviceID = PDTG.nDeviceID where nDeviceGroupID = " & nDeviceGroupID & ")"
  Else
 	 Dim sFilter : sFilter = GetSQLOutputToString("select sFilter from DeviceGroup where nDeviceGroupID = " & nDeviceGroupID)
 	 Context.NotifyProgress sFilter
	 sGroupQuery = " and PAMTD2.nDeviceID in ( " & sFilter &")"
  End If
Else
	Context.NotifyProgress "Group named " & sDeviceGroup & " was not found. Stopping script."
	bContinue = False
 End If
End If
Context.NotifyProgress "****** GetDeviceGroupType sub procedure end." & vbCrLf
End Sub

' ***********************
' * EnableInterfacesSQL *
' ***********************
Sub EnableInterfacesSQL(sSqlToEnable)
'Run the SQL statement
Dim sRS : Set sRS = oDB.Execute(sSqlToEnable)
If Not sRS.BOF And Not sRS.EOF Then
 sRS.moveFirst()
 While Not sRS.EOF
  nPivotActiveMonitorTypeToDeviceID = sRS("nPivotActiveMonitorTypeToDeviceID")
  nNewDevID = sRS("nDeviceID")
  Context.NotifyProgress "Processing device ID: " & nNewDevID
  EnableMonitor(nPivotActiveMonitorTypeToDeviceID)
  If nNewDevID <> nCurrDevID And nCurrDevID <> 0 Then
  	nEnableCount = nEnableCount + 1
  	SendChangeEvent(nCurrDevID)
  End If
  sRS.MoveNext()
  nCurrDevID = nNewDevID
  If sRS.EOF = True Then
   nEnableCount = nEnableCount + 1
   SendChangeEvent(nCurrDevID)
  End If
 Wend
End If
End Sub

' ************************
' * DisableInterfacesSQL *
' ************************
Sub DisableInterfacesSQL(sDisableQuery)
'Run the SQL statement
Dim sRS : Set sRS = oDB.Execute(sDisableQuery)
If Not sRS.BOF And Not sRS.EOF Then
 sRS.moveFirst()
 While Not sRS.EOF
  nPivotActiveMonitorTypeToDeviceID = sRS("nPivotActiveMonitorTypeToDeviceID")
  nNewDevID = sRS("nDeviceID")
  Context.NotifyProgress "Processing device ID: " & nNewDevID
  DisableMonitor(nPivotActiveMonitorTypeToDeviceID)
  If nNewDevID <> nCurrDevID And nCurrDevID <> 0 Then
  	nDisableCount = nDisableCount + 1
  	SendChangeEvent(nCurrDevID)
  End If
  sRS.MoveNext()
  nCurrDevID = nNewDevID
  If sRS.EOF = True Then
   nDisableCount = nDisableCount + 1
   SendChangeEvent(nCurrDevID)
  End If
 Wend
End If
End Sub

' *********************
' * GetSQLOutputToInt *
' *********************
Function GetSQLOutputToInt(sSql)
GetSQLOutputToInt = 0
Dim sRet, sRS
Context.NotifyProgress sSql
Set sRS = oDB.Execute(sSql)
If Not sRS.EOF And Not sRS.BOF Then
 sRet = Trim(sRS.GetString)
 If Len(sRet) > 0 Then
  If Right(sRet, 1) = vbCr Then
   sRet = Left(sRet, Len(sRet) - 1)
  End If
 End If
 If IsNumeric(sRet) Then
  GetSQLOutputToInt = CInt(sRet)
 End If
End If
End Function

' *************************
' * GetSQLOutputToBoolean *
' *************************
Function GetSQLOutputToBoolean(sSql)
GetSQLOutputToBoolean = 0
Dim sRet, sRS
Context.NotifyProgress sSql
Set sRS = oDB.Execute(sSql)
If Not sRS.EOF And Not sRS.BOF Then
 sRet = Trim(sRS.GetString)
 If Len(sRet) > 0 Then
 	If Right(sRet, 1) = vbCr Then
 		sRet = Left(sRet, Len(sRet) - 1)
 	End If
 End If
 If Len(sRet) > 0 Then
  GetSQLOutputToBoolean = CBool(sRet)
 End If
End If
End Function

' ************************
' * GetSQLOutputToString *
' ************************
Function GetSQLOutputToString(sSql)
GetSQLOutputToString = 0
Dim sRet, sRS
Context.NotifyProgress sSql
Set sRS = oDB.Execute(sSql)
If Not sRS.EOF And Not sRS.BOF Then
 sRet = Trim(sRS.GetString)
 If Right(sRet, 1) = vbCr Or Right(sRet, 1) = vbLf Then
  sRet = Left(sRet, Len(sRet) - 1)
 End If
 If Len(sRet) > 0 Then
  GetSQLOutputToString = Trim(sRet)
 End If
End If
End Function


' ******************
' * DisableMonitor *
' ******************
Sub DisableMonitor(nPivotID)
Dim sSql : sSql = "Update PivotActiveMonitorTypeToDevice set bDisabled = 1 where nPivotActiveMonitorTypeToDeviceID = " & nPivotID
If bDryRun = False Then 
 Dim sRS : Set sRS = oDb.Execute(sSql)
 Context.NotifyProgress sSql & " was run."
Else
 Context.NotifyProgress sSql & " would have run"
End If
End Sub

' ******************
' * EnableMonitor *
' ******************
Sub EnableMonitor(nPivotID)
Dim sSql : sSql = "Update PivotActiveMonitorTypeToDevice set bDisabled = 0 where nPivotActiveMonitorTypeToDeviceID = " & nPivotID
If bDryRun = False Then 
 Dim sRS : Set sRS = oDb.Execute(sSql)
 Context.NotifyProgress sSql & " was run."
Else
 Context.NotifyProgress sSql & " would have run"
End If
End Sub

' *******************
' * SendChangeEvent *
' *******************
Sub SendChangeEvent(nDeviceID)
'Variables for device change event
Const DCT_MODIFIED = 2
Const DCIT_DEVICE  = 1
If bDryRun = False Then 
 oEvent.SendChangeEvent DCT_MODIFIED, nDeviceID, DCIT_DEVICE
 Context.NotifyProgress nDeviceID & " was sent a change event."
Else
 Context.NotifyProgress nDeviceID & " would have been sent a change event."
End If
End Sub
cropped-Windows-PowerShell-ISE.png

How do I monitor all of my Windows services?

The problem

Out of the box, WhatsUp® Gold does not monitor any Windows services. There is a built-in active monitor type called “Service Monitor” which allows you to create monitors for each individual service that is critical to you. But, what if you want to monitor every service on every system without manually creating monitors for each unique service name?

The solution

I worked this script up in a hurry one day, finding that it’s not always effective as there are many services set to run automatically on my system which are stopped purposely after they do their thing following a reboot of the system. However, I accommodated for this by adding an ignore section.

###Configuration
#Put a comma separated list of the ones to ignore. 
#Example: "Service DisplayName 1","Service DisplayName 2"
$ServicesToIgnore = "Avira Mail Protection","Google Update Service (gupdate)","Software Protection","Backblaze Service","Microsoft .NET Framework NGEN v4.0.30319_X86","Microsoft .NET Framework NGEN v4.0.30319_X64"
###End Configuration

#Default to up
$bDown = 0
#Get device information
$ip = $Context.GetProperty("Address");
$DnsEntry = [System.Net.DNS]::GetHostByAddress($ip)
$DnsName = [string]$DnsEntry.HostName;
# Get the Windows credentials
$WinUser = $Context.GetProperty("CredWindows:DomainAndUserid");
$WinPass = $Context.GetProperty("CredWindows:Password");
$pwd = ConvertTo-SecureString $WinPass -asplaintext -force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $WinUser,$pwd
$Query = ""
$Query = "select * from win32_service where StartMode like '%Auto%' and State != 'Running'"
ForEach($Service in $ServicesToIgnore){
$Query = $Query + " and DisplayName != '$Service'"
}
#Get all services that are set to 'Auto' and are not in 'Running' state
$Services = (gwmi -ComputerName $DnsName -Credential $cred -Query $Query).DisplayName
If($Services.Length -gt 0){
$bDown = 1
ForEach($service in $Services){
$sMsg += "`r `n$service"
}
}
$Context.SetResult($bDown, $sMsg)


cropped-VMware-ESXi-Hardware.png

How do I monitor ESXi hardware?

The problem

Out of the box, WhatsUp® Gold does not monitor ESXi hardware in any capacity; even with the Virtualization monitoring add-on. However, there are many different ways you can use custom monitors in WhatsUp® Gold in order to effectively monitor ESXi hardware. Think about the ‘Health Status’ tab in your VMware environment. Wouldn’t it be great if you could have all of those things monitored in WhatsUp® Gold as well?

The solutions

Well, as I mentioned earlier there are many different potential solutions to this. One of my preferred ways to use to use a PowerShell script connecting to a CIM session on the host itself. WhatsUp® Gold has the ability to use PowerShell scripts as active or performance monitors. This particular monitor is an active monitor. The beauty of this monitor is that is aggregates EVERY sensor into a single monitor. This includes vendor specific sensors such as disk drives, power supplies, etc. Obviously that piece requires you install the vendor specific ESXi, or load their management agents.

Another solution I have used with success is to configure the ESXi hosts to send SNMP traps to the WhatsUp® Gold server. This method has a couple of different approaches. You can either create a specific SNMP trap passive monitor for each potential trap you’d like to alert on, or you could simply listen for Any SNMP trap from the host.

The script

To use the script, simply create a PowerShell active monitor and copy/paste the code below. This script will use whichever VMware credential is applied to the device in WUG.

import-module CimCmdlets
# Get the credentials
$VMuser = $Context.GetProperty("CredVMware:Username");
$VMpass = $Context.GetProperty("CredVMware:Password");
$pwd = ConvertTo-SecureString $VMpass -asplaintext -force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $VMuser,$pwd
# Get server
$esxi = $Context.GetProperty("Address");

#Heatlh State value translations
$HealthState0 = "Unknown"
$HealthState5 = "OK"
$HealthState10 = "Degraded/Warning"
$HealthState15 = "Minor failure"
$HealthState20 = "Major failure"
$HealthState25 = "Critical failure"
$HealthState30 = "Non-recoverable error"

#Set Session Options
$CIOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 -UseSsl
$Session = New-CimSession -Authentication Basic -Credential $cred -ComputerName $esxi -port 443 -SessionOption $CIOpt
#print device info to log
#$Chassis = Get-CimInstance -CimSession $Session -ClassName CIM_Chassis
#$sMessage = $sMessage + "`r`nModel:" + $Chassis.Manufacturer + " " + $Chassis.Model + "`r`n"
#$sMessage = $sMessage + "Serial:" + $Chassis.SerialNumber + "`r`n"; 
#Find sensors not in normal state
$bDown = 0
#Processors
$sensors = Get-CimInstance -CimSession $Session -ClassName CIM_Processor | Where {$_.HealthState -ge 0} | Select Caption, HealthState
foreach ($sensor in $sensors)
{
 If ($sensor.HealthState -ne 5) {
  $sensor.HealthState = $sensor.HealthState -replace "10", $HealthState10
  $sensor.HealthState = $sensor.HealthState -replace "15", $HealthState15
  $sensor.HealthState = $sensor.HealthState -replace "20", $HealthState20
  $sensor.HealthState = $sensor.HealthState -replace "30", $HealthState30
  $sensor.HealthState = $sensor.HealthState -replace "0", $HealthState0
  $sDownMessage = $sDownMessage + $sensor.Caption + ": " +  $sensor.HealthState + "`r`n"
  $sMessage = $sMessage + $sensor.Caption + ": " +  $sensor.HealthState + "`r`n"
  $bDown = 1 }
 Else {  
  $sMessage = $sMessage + $sensor.Caption + ": " + $HealthState5 + "`r`n" }
}

#Physical Memory
$sensors = Get-CimInstance -CimSession $Session -ClassName CIM_Memory | Where {$_.HealthState -ge 0 -and $_.ElementName -notlike '*Cache*'} | Select ElementName, HealthState
foreach ($sensor in $sensors)
{
 If ($sensor.HealthState -ne 5) {
  $sensor.HealthState = $sensor.HealthState -replace "10", $HealthState10
  $sensor.HealthState = $sensor.HealthState -replace "15", $HealthState15
  $sensor.HealthState = $sensor.HealthState -replace "20", $HealthState20
  $sensor.HealthState = $sensor.HealthState -replace "30", $HealthState30
  $sensor.HealthState = $sensor.HealthState -replace "0", $HealthState0
  $sDownMessage = $sDownMessage + $sensor.ElementName + ": " +  $sensor.HealthState + "`r`n"
  $sMessage = $sMessage + $sensor.ElementName + ": " +  $sensor.HealthState + "`r`n"
  $bDown = 1 }
 Else {
  $sMessage = $sMessage + $sensor.ElementName + ": " + $HealthState5 + "`r`n" }
}

#All vendor specific sensors
$sensors = Get-CimInstance -CimSession $Session -ClassName CIM_Sensor | Where {$_.HealthState -ge 0} | Select Caption, HealthState
foreach ($sensor in $sensors)
{
 If ($sensor.HealthState -ne 5) {
  $sensor.HealthState = $sensor.HealthState -replace "10", $HealthState10
  $sensor.HealthState = $sensor.HealthState -replace "15", $HealthState15
  $sensor.HealthState = $sensor.HealthState -replace "20", $HealthState20
  $sensor.HealthState = $sensor.HealthState -replace "30", $HealthState30
  $sensor.HealthState = $sensor.HealthState -replace "0", $HealthState0
  $sDownMessage = $sDownMessage + $sensor.Caption + ": " +  $sensor.HealthState + "`r`n"
  $sMessage = $sMessage + $sensor.Caption + ": " +  $sensor.HealthState + "`r`n"
  $bDown = 1 }
 Else {
  $sMessage = $sMessage + $sensor.Caption + ": " + $HealthState5 + "`r`n" }
}

#If down flag thrown, set down else set up
$sUpMessage = "All sensors were found to be in the 'OK' state."
If ($bDown -eq 1) {
 $Context.SetResult(1, "Down! One or more sensors was found to not be in the 'OK' state`r`n" + $sDownMessage); }
Else {
$Context.SetResult(0, $sMessage + "`r`nUP! " + $sUpMessage);
}

#Remove the CIMSession
$Remove = Remove-CimSession -CimSession $Session
cropped-WhatsUp-Gold-Dashboard-Utility.png

WhatsUp® Gold Dashboard Management

The problem

Since the days WhatsUp® Gold began having dashboards, there has always been one major shortcoming. That is, the impossibility to setup your own “default dashboards” through the GUI. Let’s say you wanted every user that logged into your WhatsUp® Gold environment to have a specific set of dashboards. You would need to ensure the user was created and/or logged into WhatsUp® Gold through Active Directory integration and then copy/share dashboards to that user. The big problem with this is time investment necessary from the WhatsUp® Gold administrator. What if the dashboards for all of your users needed to be updated? There is not even a workaround for this, as you can’t delete/replace users dashboards without logging in as that user and doing some cleanup work. In WhatsUp® Gold v2016 and below, you also couldn’t even copy a dashboard to multiple users at once. This problem was addressed with the v2017 release, and that could now be accomplished in the GUI. The other problems however apply to both v2016 and below as well as v2017 and up.

The solution

I created programs using AutoIt in order to help people struggling with this problem. Yes, programs with an S. This is because dashboards in v2016 and below are completely different than the redesigned dashboards in v2017 and up. The program works by interacting directly with the WhatsUp® Gold database which is not supported. If you encounter any problems with the program(s), you can reach out to me here or on my GitHub here. Yes, the source is open for you if you’re familiar with AutoIt you can modify as you please. Also feel free to request new features and I will work on them when I can. Note that I have done pretty extensive testing of the programs already but obviously I can’t cover every conceivable scenario out there as just one person.

iftttt16

How do I use IFTTT with WhatsUp® Gold?

You can do a lot with the If This Then That (IFTTT) integration which is now built into WhatsUp® Gold. This specific example has come up quite a bit recently, so I figured a write-up would come in handy. Keep in mind there are nearly limitless options with what you can do with IFTTT, with additional vendors hopping on-board on a monthly basis.

1. Begin by setting up your account on IFTTT.com You can sign up using any e-mail or create an account using Google/Facebook. Either type in your email and hit ‘Get Started’, click ‘Sign up’ in the top right, or click ‘Continue with Google/Facebook’.

2. Once your account is made, create a new applet. You’ll see it in the top right on the ‘My Applets’ page like in the image below.

3. When making a new applet, their interface isn’t obvious until after the first time you’ve done one. See below…click where it says +this in blue.

4. The ‘This’ in this scenario will be a webhook. There’s literally hundreds of options so typing in the search makes it easier as you see below. Once you see it, click it.

5. Once you select webhook, next left-click ‘Receive a Web Request’. This is easy, right?

6. You’ll need to give this a name (labeled Event Name). In my example below, you’ll see I called it wug_event. Note down somewhere whatever you name this, you’ll need it later. Keeping in mind, you can have many different event names to trigger off different things if need be. In my example, I am just making one for use all throughout WUG. Once you decide upon your name, note it, and type it in the field, click ‘Create Trigger’.

7. You’re done with your ‘This’ now it’s time for ‘That’. Left-click +that to proceed.

8. Once again you’re going to be prompted with what to do, with literally hundreds of options. If you just type phone in the search box you can easily find ‘Phone Call (US only)’ — note, that for International calling you’ll need to use the action called ‘VoIP Calls’. Just make a mental note here: THERE ARE LITERALLY HUNDREDS OF THINGS YOU CAN MAKE WUG DO — ANYTHING IN THE ENTIRE LIST IS POSSIBLE!….anyhow, left-click ‘Phone Call (US Only)’ to proceed.

9. Next you’re going to left-click ‘Connect’, and you will need to verify your phone number. Don’t worry…it’s easy. Your phone will ring and the robotic voice will say your username and then the 4-digit pin you need. Once you have your pin, verify it in the popup box to proceed.

10. If you’ve already verified your phone number or just completed step 9 above, you’ll next simply left-click ‘Call my phone’.

11. This part might be a bit confusing for some, so take my advice. Delete everything the ‘Message to say’ box. Then click ‘Add ingredient’ and select Value1 — repeat to add Value2 and Value3. You will be able to customize the message in WUG anyhow since we’ll be using variables. For those unaware: Value1, Value2, and Value3 are the variables! Anyhow…left-click ‘Create action’ when you’ve added the values.

12. Now, you’ll just click ‘Finish’. That’s it. You’ve made your first IFTTT applet.

13. There is one more step here, you’ll need your webhook key to put into WhatsUp® Gold. To get your webhook key, once logged into IFTTT, go to this page: https://ifttt.com/services/maker_webhooks/settings You’ll find the information at the end of the URL section (blacked out in the screenshot below)

14. Next, login to your WUG and go to Settings > Actions and Policies. From there, click the + and select the ‘Post To IFTTT’ action.


15. Fill in your webhook, event name, and the percent variables and/or text you want to be in your alert. Your phone will ring and when you pick up the message you typed in here will be spoken to you. Once completed, hit OK.

You now have a IFTTT action in WUG that can call your phone and read you a message. Especially useful for those middle of the night alerts that *NEED* to wake you up. You would now just add this action to an action policy and apply the policy to either devices or monitors in WhatsUp® Gold.

wug-geolocation

Geolocation in WUG using Leaflet.js

*THE LATEST FILES CAN BE FOUND ON MY GITHUB*

By now you’ve probably seen the Google Maps integration that was setup quite some time ago for WhatsUp® Gold. I decided since Google began requiring credit card information in order to obtain an API key, it was time to look into possible alternatives. What I found is that there are many alternatives ranging from free to ‘freemium’, none of which require a credit card being on file. This integration uses a few open source solutions

jsDelivr – fast, free, reliable open-source CDN
LeafletJS – an open-source JavaScript library for mobile-friendly interactive maps
Leaflet-providers – An extension to Leaflet that contains configurations for various free tile providers

The integration works very similar to the Google Maps integration — you provide latitude,longitude on either a device as a device attribute or on a group as the description. So, if you’ve already put this information into your WhatsUp® Gold you won’t need to re-do anything. There are many different quality of life improvements in this integration.

For those unfamiliar, you can use GetLatLong.net to easily get latitude and longitude values for any location. Once you have the information you would either:

  • Right-click a group -> Edit Group -> Set description to lat,lng for example 37.077979,-96.991419
  • Device Properties -> Attributes -> New Attribute -> Attribute Name: LatLong -> Set Attribute value to lat,lng for example 37.077979,-96.991419
  1. Zoom and map center are persisted throughout your session. If you move the map around, zoom in/out and the page refreshes the map will stay at the new area. This is done using SessionStorage. You can get the values of these using the browser console and these commands: sessionStorage.lng sessionStorage.lat sessionStorage.zoomLev — using the values from these, you can update the files defaults
  2. As opposed to the whole page refreshing every so often, just the markers on the map update. This is especially useful if you have a ton of markers. This is done using some JSON calls to the other files included in the .zip
  3. Reduced the amount of dependencies on WUG files, although there are still some files this  customization depends on, it has been drastically reduced which means better load times and compatibility. Noting that, there is no guarantee this will work in all previous/future versions of WhatsUp® Gold (it was tested in v2018 SP2)
  4. There is now one file which can display both groups and devices. There are options to toggle either one on/off. This was done using MarkerGroups in Leaflet
  5. When clicking on a device/group, a new tab opens as opposed to using the parent page to open device properties/group properties
  6. You now have the option to switch between map providers, set the default map provider, etc. Some of these providers do require either an API key or agreeing to their terms of service, these are noted in the file specifically and will be disabled if you do not provide an API key and/or agree to their terms of service

HERE: To acquire the appCode and appID sign-up for free here: https://developer.here.com/ (Freemium)
Thunderforest: In order to use Thunderforest maps, you must register. https://thunderforest.com/pricing/ (Freemium)
ArcGIS: In order to use ArcGIS maps, you must register at https://developers.arcgis.com/en/sign-up/ and abide by the terms of service.

I take *NO CREDIT* for any of the map tiles provided! Ensure to abide by the terms of service for each of the map tile providers.

To use this simply Download here and extract to InstallDir\Ipswitch\WhatsUp\HTML\NmConsole

Just like before, you can put this in a Dashboard using Free form text/html and this code:

<iframe style="border: 0px #FFFFFF none;" src="/NmConsole/wug-GEOLOCATION.asp" name="dash_frame" width="100%" height="1000px" frameborder="0" marginwidth="0px" marginheight="0px" scrolling="yes"></iframe>
ipswitch_logo

What is network monitoring?

A network monitoring solution is an application which ensures the availability of your systems. The network monitoring solution will notify you if there is any problems with your systems, so that your business can achieve the highest possible uptime.