動態群組範例

WhatsUp Gold 有預先設定的動態群組範例,位於 [設備群組] 下的 [設備] 畫面中。如需這些群組的詳細資訊,請參閱設定動態群組

下例列出的幾個動態群組過濾條件,可讓您為設備建立實用的動態群組。若要使用這些範例,請選取過濾條件的文字,然後複製並貼到 [動態群組] 對話方塊的 [過濾條件] 方塊中。

Note: 從說明檔複製程式碼時若出現版權資訊,最好移除貼上的版權資訊。

若要顯示過去三小時內狀態有所變更的所有設備:

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

若要顯示安裝多個網路介面的所有設備:

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

若要顯示從過去兩小時內離線到現在的所有設備:

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
AND PivotActiveMonitorTypeToDevice.bDisabled = 0
AND DATEDIFF(hh, ActiveMonitorStateChangeLog.dStartTime, GETDATE()) <= 2
AND MonitorState.nInternalMonitorState = 1

若要顯示過去兩天內有觸發動作的所有設備 (在特定群組中):

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'

若要顯示磁碟使用量在 90% 以上的所有設備:

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))

若要顯示所有維護中設備,或至少有一個主動監控工具離線且符合指定設備類型的所有設備:

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)

若只要顯示所有主動監控工具都離線的設備:

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

若只要顯示所有主動監控工具都離線 20 分鐘以上的設備:

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

若要顯示特定效能監控工具所屬的設備:

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%'

若要顯示特定被動監控工具所屬的設備:

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%'

若要顯示特定主動監控工具所屬的設備:

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%'

若要依據顯示名稱、主機名稱或 IP 位址尋找設備:

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

若要顯示動作 (或主動監控工具的動作) 名稱中有特定字眼的設備:

Note: 若要搜尋其他動作,請變更 LIKE 後面的動作名稱。請記得保留兩個 % 符號。

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%'
UNION
SELECT DISTINCT Device.nDeviceID
FROM Device
JOIN ActionPolicy
ON ActionPolicy.nActionPolicyID=0 and bGlobalActionPolicy=1
JOIN PivotActionTypetoActionPolicy P
ON P.nActionPolicyID = ActionPolicy.nActionPolicyID
JOIN [ActionType]
ON P.nActionTypeID = ActionType.nActionTypeID
WHERE ActionType.sActionTypeName LIKE '%Critical%'

另請參閱

使用設備群組

使用設備群組

建立設備群組

關於動態群組

建立動態群組

設定動態群組

使用動態群組規則編輯工具