VMware Global Community
obito1818
Contributor
Contributor

トリガー済みアラームの状態を取得したいです

Powercliにてトリガー済みアラームを取得するのスクリプトにて下記、シーケンスだと思います

(1)Get-AlarmDefinitionコマンドにて定義→定義一覧が出力

(2)Get-AlarmAction トリガー

(3) トリガー済みアラームを取得

(1) アラーム名:vCenter Server Health Alarmに指定

# Get-AlarmDefinition "vCenter Server Health Alarm" | % {$_.ExtensionData.Info} | %{Get-VIObjectByVIView $_.Alarm}

Name                 Description                                             Enabled

----                 -----------                                             -------

vCenter Server He... vCenter Server service alarm to monitor health status   True

====================================

Key              : alarm-76

Alarm            : Alarm-alarm-76

Entity           : Folder-group-d1

LastModifiedTime : 2016/09/16 3:43:22

LastModifiedUser :

CreationEventId  : 0

LinkedView       :

Name             : vCenter Server Health Alarm

SystemName       : alarm.VCServerHealthAlarm

Description      : vCenter Server service alarm to monitor health status

Enabled          : True

Expression       : VMware.Vim.OrAlarmExpression

Action           : VMware.Vim.GroupAlarmAction

ActionFrequency  : 0

Setting          : VMware.Vim.AlarmSetting

------

(2) Get-AlarmActionを使用

Get-AlarmAction | select ActionType,Trigger,AlarmDefinition | ft

ActionType Trigger                                                                                      AlarmDefinition

---------- -------                                                                                      ---------------

SendEmail {Green -> Yellow (Once), Red -> Yellow (Once), Yellow -> Green (Once), Yellow -> Red (Once)} Host connection and po...

  SendSNMP {Yellow -> Red (Repeat)}                                                                     Timed out starting Sec...

  SendSNMP {Yellow -> Red (Repeat)}                                                                     Expired vCenter Server...

  SendSNMP {Yellow -> Red (Repeat)}                                                                     Expired host license

  SendSNMP {Yellow -> Red (Repeat)}                                                                     Expired vCenter Server...

  SendSNMP {Yellow -> Red (Repeat)}                                                                     Expired host time-limi...

  SendSNMP {Yellow -> Red (Repeat)}                                                                     Expired Virtual SAN ti...

  SendSNMP {Yellow -> Red (Repeat)}                                                                     No compatible host for...

どのように組み立てれば、(3)ができるのでしょうか。

Reply
0 Kudos
1 Reply
gowatana
Leadership
Leadership

こんにちは。

Get-AlarmDefinitionやGet-AlarmActionでは、アラームの定義や有効/無効状態は取得できますが、

トリガー済みかどうかは取得できないと思います。

そこで、AlarmManager などから情報取得します。

Managed Object - AlarmManager(vim.alarm.AlarmManager)

https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538c...

取得方法については、下記のディスカッションのサンプル コードが参考になります。

Script for Getting the Active alarm list in the VC

Get all triggered alarms of multiple vCenter (5.5,6.5,6.7)

また、下記のブログの「Listing Active Alarms」のあたりで、

トリガーされているアラームを取得する PowerShell ファンクション スクリプトの紹介があります。

What’s New for vSphere Alarm Management - VMware PowerCLI Blog

以上です。参考になりますでしょうか。

Reply
0 Kudos