アラーム環境変数とは
vCenterにおけるアラームは以下の変数を用いてスクリプトへ渡すことができる
※出典
アラーム環境変数の利用例
・アラーム設定
デフォルトで定義されている「ホストの接続と電源状態」にて、"/root/test.sh {targetName}"を実行するように設定
#!/bin/bash SERVER=$1 echo "echo "`date "+%Y-%m-%d %H:%M:%S" ` $SERVER" disconnected" >> /tmp/out.txt
・出力
# cat /tmp/out.txt echo 2023-11-16 03:05:03 24-esxi-03.env.lab disconnected
・各種変数の出力例
・eventDescription Alarm Host connection and power state on ・targetName 24-esxi-03.env.lab ・alarmName changed from Green to Red 24-esxi-03.env.lab alarm.HostConnectionStateAlarm ・triggeringSummary State is equal to Not responding AND State is equal to Unknown ・declaringSummary (([Red state Is equal to notResponding] AND [Red state Not equal to standBy])) ・oldStatus Normal ・newStatus Critical ・target HostSystem:host-18