动态群组范例

WhatsUp Gold 有预配置的动态群组范例,位于 [设备群组] 下的 [设备] 视图中。如需这些群组的详细信息,请参阅配置动态群组

下例列出的几个动态群组过滤条件,可让您为设备建立实用的动态群组。若要使用这些范例,请选择过滤条件的文本,然后复制并贴到 [动态群组] 对话框的 [过滤条件] 对话框中。

<注意> 从说明文件复制程序代码时若出现版权信息,最好移除贴上的版权信息。

若要显示过去三小时内状态有所变更的所有设备:

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

若要显示操作 (或主动监控工具的操作) 名称中有特定字眼的设备:

<注意> 若要搜索其他操作,请变更 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%'

另请参阅

使用设备群组

使用设备群组

建立设备群组

关于动态群组

建立动态群组

配置动态群组

使用动态群组规则编辑工具