Dynamic Group Examples

WhatsUp Gold is pre-configured with dynamic group examples, which you can see in the Devices view, under Device Groups. For more information on these groups, see Using Dynamic Groups.

The following examples show several dynamic group filters that you can use to create some interesting dynamic groups for your devices. To use these examples, select the text of the filter, and then copy and paste the text into the Filter box of the Dynamic Group dialog.

Note: You may have to remove the copyright information from the cut and paste if it appears when you copy from this help file.

To show all devices that have had a state change in the last three hours:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Pivotactivemonitortypetodevice
ON Device.Ndeviceid = Pivotactivemonitortypetodevice.Ndeviceid
JOIN Activemonitorstatechangelog
ON Pivotactivemonitortypetodevice.Npivotactivemonitortypetodeviceid=
Activemonitorstatechangelog.Npivotactivemonitortypetodeviceid
WHERE Device.Bremoved = 0
AND DATEDIFF(Hh,Activemonitorstatechangelog.Dstarttime,GETDATE()) <= 3

To show all devices with multiple interfaces:

SELECT DISTINCT Networkinterface.Ndeviceid
FROM Device
JOIN Networkinterface
ON Device.Ndeviceid = Networkinterface.Ndeviceid
WHERE Device.Bremoved = 0
GROUP BY Networkinterface.Ndeviceid
HAVING COUNT(Networkinterface.Ndeviceid) > 1

To show all devices that have gone down in the last two hours and are still down:

SELECT DISTINCT Device.nDeviceID
FROM Device
JOIN PivotActiveMonitorTypeToDevice
ON Device.nDeviceID = PivotActiveMonitorTypeToDevice.nDeviceID
JOIN ActiveMonitorStateChangeLog
ON PivotActiveMonitorTypeToDevice.nPivotActiveMonitorTypeToDeviceID =
ActiveMonitorStateChangeLog.nPivotActiveMonitorTypeToDeviceID
JOIN MonitorState
ON Device.nWorstStateID = MonitorState.nMonitorStateID
WHERE Device.bRemoved = 0
PivotActiveMonitorTypeToDevice.bDisabled = 0
AND DATEDIFF(hh, ActiveMonitorStateChangeLog.dStartTime, GETDATE()) <= 2
AND MonitorState.nInternalMonitorState = 1

To show all the devices (in one specific group) that have had an action fire in the last two days:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Actionactivitylog
ON Device.Ndeviceid = Actionactivitylog.Ndeviceid
JOIN Pivotdevicetogroup
ON Device.Ndeviceid = Pivotdevicetogroup.Ndeviceid
JOIN Devicegroup
ON Pivotdevicetogroup.Ndevicegroupid = Devicegroup.Ndevicegroupid
WHERE Device.Bremoved = 0
AND DATEDIFF(Dd,Actionactivitylog.Ddatetime,GETDATE()) <= 2
AND Devicegroup.Sgroupname = 'My Key Resources Group'

To show all devices that need acknowledgement:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Pivotactivemonitortypetodevice
ON Device.Ndeviceid = Pivotactivemonitortypetodevice.Ndeviceid
JOIN Activemonitorstatechangelog
ON Pivotactivemonitortypetodevice.Npivotactivemonitortypetodeviceid =
Activemonitorstatechangelog.Npivotactivemonitortypetodeviceid
WHERE Device.Bremoved = 0
AND Activemonitorstatechangelog.Backnowledged = 0
AND Pivotactivemonitortypetodevice.Bremoved = 0

To show all devices with disks that are 90% full or fuller:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Pivotstatisticalmonitortypetodevice
ON Device.Ndeviceid = Pivotstatisticalmonitortypetodevice.Ndeviceid
JOIN Statisticaldiskidentification
ON Pivotstatisticalmonitortypetodevice.Npivotstatisticalmonitortypetodeviceid =
Statisticaldiskidentification.Npivotstatisticalmonitortypetodeviceid
JOIN Statisticaldiskcache
ON Statisticaldiskidentification.Nstatisticaldiskidentificationid =
Statisticaldiskcache.Nstatisticaldiskidentificationid
WHERE Device.Bremoved = 0
AND Pivotstatisticalmonitortypetodevice.Benabled = 1
AND Statisticaldiskcache.Ndatatype = 1
AND (((Nused_avg / Nsize) > 0.90)
AND (NOT Nsize = 0
OR Nsize IS
NULL))

To show all devices in maintenance or with at least one down Active Monitor and match the specified device types:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Monitorstate
ON Device.Nworststateid = Monitorstate.Nmonitorstateid
WHERE Device.Bremoved = 0
AND Monitorstate.Ninternalmonitorstate IN (1,2)
AND Device.Ndevicetypeid IN (3,4,38,63,64,65,66,67,68,71,72)

To show only devices on which all active monitors are down:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Monitorstate
ON Device.Nworststateid = Monitorstate.Nmonitorstateid
WHERE Device.Bremoved = 0
AND Monitorstate.Ninternalmonitorstate = 1
AND Device.Nworststateid = Device.Nbeststateid

To show only those devices on which all active monitors have been down for 20 minutes or more:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Pivotactivemonitortypetodevice
ON Device.Ndeviceid = Pivotactivemonitortypetodevice.Ndeviceid
JOIN Activemonitorstatechangelog
ON Pivotactivemonitortypetodevice.Npivotactivemonitortypetodeviceid =
Activemonitorstatechangelog.Npivotactivemonitortypetodeviceid
JOIN Monitorstate
ON Pivotactivemonitortypetodevice.Nmonitorstateid =
Monitorstate.Nmonitorstateid
WHERE Device.Bremoved = 0
AND Pivotactivemonitortypetodevice.Bremoved = 0
AND Pivotactivemonitortypetodevice.Bdisabled = 0
AND Monitorstate.Ninternalmonitorstate = 1
AND DATEDIFF(Mi,Activemonitorstatechangelog.Dstarttime,GETDATE()) >= 20
AND Device.Nworststateid = Device.Nbeststateid

To show devices whose Actions (or whose Active Monitors' Actions) have a specific word in their name:

Note: To search for a different Action, change the Action name after LIKE. Be sure to leave both % symbols.

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Actionpolicy
ON Device.Nactionpolicyid = Actionpolicy.Nactionpolicyid
JOIN Pivotactiontypetoactionpolicy
ON Actionpolicy.Nactionpolicyid =
Pivotactiontypetoactionpolicy.Nactionpolicyid
JOIN Actiontype
ON Pivotactiontypetoactionpolicy.Nactiontypeid =
Actiontype.Nactiontypeid
WHERE Device.Bremoved = 0
AND Actiontype.Sactiontypename LIKE '%Critical%'

UNION

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Pivotactivemonitortypetodevice
ON Device.Ndeviceid = Pivotactivemonitortypetodevice.Ndeviceid
JOIN Actionpolicy
ON Pivotactivemonitortypetodevice.Nactionpolicyid =
Actionpolicy.Nactionpolicyid
JOIN Pivotactiontypetoactionpolicy
ON Actionpolicy.Nactionpolicyid =
Pivotactiontypetoactionpolicy.Nactionpolicyid
JOIN Actiontype
ON Pivotactiontypetoactionpolicy.Nactiontypeid =
Actiontype.Nactiontypeid
WHERE Device.Bremoved = 0
AND Pivotactivemonitortypetodevice.Bremoved = 0
AND Actiontype.Sactiontypename LIKE '%Critical%'

To show devices to which a particular Performance Monitor is assigned:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Pivotstatisticalmonitortypetodevice
ON Device.Ndeviceid = Pivotstatisticalmonitortypetodevice.Ndeviceid
JOIN Statisticalmonitortype
ON Statisticalmonitortype.Nstatisticalmonitortypeid =
Pivotstatisticalmonitortypetodevice.Nstatisticalmonitortypeid
WHERE Device.Bremoved = 0
AND Pivotstatisticalmonitortypetodevice.Benabled = 1
AND Statisticalmonitortype.Sstatisticalmonitortypename
LIKE '%Interface Utilization%'

To show devices to which a particular Passive Monitor is assigned:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Pivotpassivemonitortypetodevice
ON Device.Ndeviceid = Pivotpassivemonitortypetodevice.Ndeviceid
JOIN Passivemonitortype
ON Passivemonitortype.Npassivemonitortypeid =
Pivotpassivemonitortypetodevice.Npassivemonitortypeid
WHERE Device.Bremoved = 0
AND Pivotpassivemonitortypetodevice.Bremoved = 0
AND Passivemonitortype.Smonitortypename LIKE '%Cold Start%'

To show devices to which a particular Active Monitor is assigned:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Pivotactivemonitortypetodevice
ON Device.Ndeviceid = Pivotactivemonitortypetodevice.Ndeviceid
JOIN Activemonitortype
ON Activemonitortype.Nactivemonitortypeid =
Pivotactivemonitortypetodevice.Nactivemonitortypeid
WHERE Device.Bremoved = 0
AND Pivotactivemonitortypetodevice.Bremoved = 0
AND Activemonitortype.Smonitortypename LIKE '%Ping%'

To find a device by its display name, host name, or IP address:

SELECT DISTINCT Device.Ndeviceid
FROM Device
JOIN Networkinterface
ON Device.Ndeviceid = Networkinterface.Ndeviceid
AND Device.Ndefaultnetworkinterfaceid =
Networkinterface.Nnetworkinterfaceid
JOIN Devicetype
ON Device.Ndevicetypeid = Devicetype.Ndevicetypeid
WHERE (Device.Sdisplayname LIKE '%Mail Server%'
OR Networkinterface.Snetworkname LIKE '%server1.ipswitch.com%'
OR Networkinterface.Snetworkaddress LIKE '%1.2.3.4%')
AND Device.Bremoved = 0