I would like to update an Alarm definition - Triggers - Trigger Type condition values using powercli. Is it possible with powercli?
Ok, that one is a bit special since there is no Action defined.
But with the API it is possible like this
$alarmName = 'Datastore disk usage'
$yellowPercent = 85
$redPercent = 90
$alarmMgr = Get-View AlarmManager
$alarm = Get-View -id ($alarmMgr.GetAlarm($null)) | where {$_.Info.Name -eq $alarmName}
$spec = $alarm.Info
$spec.Expression.Expression[0].Yellow = $yellowPercent * 100
$spec.Expression.Expression[0].Red = $redPercent * 100
$alarm.ReconfigureAlarm($spec)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Have a look at the Remove-AlarmAction, Remove-AlarmActionTrigger, New-AlarmAction and New-AlarmActionTrigger cmdlets.
Anything particular you want to do ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks. I am trying to change Alarm Trigger Type condition through Powercli.
For example, I need to update the condition for "Datastore Disk Usage%" Trigger type in Alarm Definition "Datastore usage on disk".
Ok, that one is a bit special since there is no Action defined.
But with the API it is possible like this
$alarmName = 'Datastore disk usage'
$yellowPercent = 85
$redPercent = 90
$alarmMgr = Get-View AlarmManager
$alarm = Get-View -id ($alarmMgr.GetAlarm($null)) | where {$_.Info.Name -eq $alarmName}
$spec = $alarm.Info
$spec.Expression.Expression[0].Yellow = $yellowPercent * 100
$spec.Expression.Expression[0].Red = $redPercent * 100
$alarm.ReconfigureAlarm($spec)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
