With PowerCLI, you can
create vCenter Server alarm actions and
triggers.
Prerequisites
Verify that you are connected
to a
vCenter
Server
system.
Procedure
-
Create an alarm action email for the
renamed alarm definition.
-
Create an snmp alarm
action.
Get-AlarmDefinition -Name AlarmDefinitionNew | New-AlarmAction -Snmp
-
Create a script alarm
action.
Get-AlarmDefinition -Name AlarmDefinitionNew | New-AlarmAction -Script -ScriptPath 'c:\test.ps1'
-
Create a metric-based alarm trigger.
$metric = Get-Metric -MetricGroup CPU -Name Usage | Where-Object {$_.Key -eq 2}
$metricTrigger = New-AlarmTrigger -Metric $metric -Red 9000 -RedIntervalSeconds 3000 -EntityType "VirtualMachine" -MetricAlarmOperator Above
-
Create a state-based alarm trigger.
$stateTrigger = New-AlarmTrigger -StatePath "runtime.powerState" -Value "poweredOff" -EntityStatus Red -EntityType "VirtualMachine" -StateAlarmOperator Equal