How to modify alarm Reporting frequency in vSphere 6.x using PowerCLI
search cancel

How to modify alarm Reporting frequency in vSphere 6.x using PowerCLI

book

Article ID: 342366

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction


This article provides PowerCLI method to customize Reporting Frequency of an alarm.

Symptoms:

Alarm actions like Email alerts/SNMP traps are not triggered for state changes within 5 minutes from initial alarm trigger

Environment

VMware vCenter Server 6.5.x
VMware vCenter Server 7.0.x
VMware vCenter Server 6.0.x
VMware vCenter Server 6.7.x

Cause


By default, vCenter alarms are configured to have a 5-minute Reporting frequency to guard against repeatedly reporting insignificant alarm transitions and actions associated with it.

There are situations where default or custom alarms to have a lesser/higher reporting frequency.

Resolution


To resovle this issue:
 
  1. Connect to the vCenter server using powerCLI VI-Connect cmdlet, see Basic connecting to vCenter or a vSphere Host
  2. To list all the alarm definitions:
Get-AlarmDefinition|format-list
  1. Select an Alarm to modify using ID or Name. Here using a sample ID (Alarm-alarm-97)
  2. Get the .NET view object for the alarm:
$AlarmtoUpdate=get-view -id (get-alarmDefinition -ID Alarm-alarm-97).id
  1. To see the current value of Reporting Frequency parameters:
echo $AlarmtoUpdate.info.Setting
  1. Copy the alarm info item to a spec variable:
$specNewAlarmInfo = $AlarmToUpdate.Info
  1. modify Reporting Frequency value in the spec variable 
$specNewAlarmInfo.Setting.ReportingFrequency = <value in seconds(NOT minute) 0-3600>
  1. Once the spec variable is updated, it can be written back to the alarm definition:
$AlarmtoUpdate.ReconfigureAlarm($specNewAlarmInfo)
  1. To validate the changes:
$AlarmtoUpdate=get-view -id (get-alarmDefinition -ID Alarm-alarm-97).id
echo $AlarmtoUpdate.info.Setting