如何在使用 Active IQ Unified Manager 时测试从警报发送到 PowerShell 的参数?
适用于
- OnCommand 统一管理器( UM )
- Active IQ Unified Manager ( AIQUM )
解答
工程人员编写了一个示例 PowerShell 脚本,用于定义参数并打印参数值。PowerShell 脚本 "param_testing.ps1" 代码如下。
param ($eventID, $eventName, $eventSeverity, $eventSourceID, $eventSourceName, $eventSourceType, $eventState, $eventArgs)
write-host "eventID : $eventID `n"
write-host "eventName : $eventName `n"
write-host "eventSeverity : $eventSeverity `n"
write-host "eventSourceID : $eventSourceID `n"
write-host "eventSourceName : $eventSourceName `n"
write-host "eventSourceType: $eventSourceType `n"
write-host "eventState : $eventState `n"
write-host "eventArgs : $eventArgs `n"
下面是测试示例。此简单脚本的目的是,对自定义脚本进行故障排除,以验证根据提供的参数在 PowerShell 中输出的值。
PS C:\Users\Administrator\Desktop> .\param_testing.ps1 -eventID 341966 -eventName Qtree` Space` Soft` Limit` Breached -eventSeverity warning -eventSourceID 6042432 -eventSourceName foo:`/bar`/test` name` `-` test -eventSourceType QTREE -eventState NEW -eventArgs qtreeSpaceHardLimit=1048576,qtreeSpaceSoftLimit=838864,bytesUsed=1033848,bytesPercent=123`.24381544565031,qtreeSpaceIsHardLimitNotSet=false
eventID : 341966
eventName : Qtree Space Soft Limit Breached
eventSeverity : warning
eventSourceID : 6042432
eventSourceName : foo:/bar/test name - test
eventSourceType: QTREE
eventState : NEW
eventArgs : qtreeSpaceHardLimit=1048576 qtreeSpaceSoftLimit=838864 bytesUsed=1033848 bytesPercent=123.24381544565031 qtreeSpaceIsHardLimitNotSet=false
其他信息
附加信息 _text