29.6. クラスターアラート設定コマンドの例
以下の例は、基本的なアラート設定コマンドの一部と、アラートの作成、受信側の追加、および設定されたアラートの表示に使用される形式を表しています。
クラスターの各ノードにアラートエージェント自体をインストールする必要がありますが、pcs
コマンドを実行する必要があるのは 1 回だけです。
以下のコマンドは簡単なアラートを作成し、アラートに 2 つの受信側を追加した後、設定された値を表示します。
-
アラート ID の値が指定されていないため、
alert
のアラート ID が作成されます。 -
最初の受信側作成コマンドは、
rec_value
の受信側を指定します。このコマンドには受信側 ID が指定されていないため、alert-recipient
の値が受信側 ID として使用されます。 -
2 番目の受信側作成コマンドは、
rec_value2
の受信側を指定します。このコマンドは、my-recipient
を受信側 ID として指定します。
pcs alert create path=/my/path pcs alert recipient add alert value=rec_value pcs alert recipient add alert value=rec_value2 id=my-recipient pcs alert config
# pcs alert create path=/my/path
# pcs alert recipient add alert value=rec_value
# pcs alert recipient add alert value=rec_value2 id=my-recipient
# pcs alert config
Alerts:
Alert: alert (path=/my/path)
Recipients:
Recipient: alert-recipient (value=rec_value)
Recipient: my-recipient (value=rec_value2)
以下のコマンドは、2 番目のアラートとそのアラートの受信側を追加します。2 番目のアラートのアラート ID は my-alert
で、受信側の値は my-other-recipient
です。受信側 ID が指定されていないため、my-alert-recipient
が受信側 ID として使用されます。
pcs alert create id=my-alert path=/path/to/script description=alert_description options option1=value1 opt=val meta timeout=50s timestamp-format="%H%B%S" pcs alert recipient add my-alert value=my-other-recipient pcs alert
# pcs alert create id=my-alert path=/path/to/script description=alert_description options option1=value1 opt=val meta timeout=50s timestamp-format="%H%B%S"
# pcs alert recipient add my-alert value=my-other-recipient
# pcs alert
Alerts:
Alert: alert (path=/my/path)
Recipients:
Recipient: alert-recipient (value=rec_value)
Recipient: my-recipient (value=rec_value2)
Alert: my-alert (path=/path/to/script)
Description: alert_description
Options: opt=val option1=value1
Meta options: timestamp-format=%H%B%S timeout=50s
Recipients:
Recipient: my-alert-recipient (value=my-other-recipient)
以下のコマンドは、アラート my-alert
と受信側 my-alert-recipient
のアラート値を変更します。
pcs alert update my-alert options option1=newvalue1 meta timestamp-format="%H%M%S" pcs alert recipient update my-alert-recipient options option1=new meta timeout=60s pcs alert
# pcs alert update my-alert options option1=newvalue1 meta timestamp-format="%H%M%S"
# pcs alert recipient update my-alert-recipient options option1=new meta timeout=60s
# pcs alert
Alerts:
Alert: alert (path=/my/path)
Recipients:
Recipient: alert-recipient (value=rec_value)
Recipient: my-recipient (value=rec_value2)
Alert: my-alert (path=/path/to/script)
Description: alert_description
Options: opt=val option1=newvalue1
Meta options: timestamp-format=%H%M%S timeout=50s
Recipients:
Recipient: my-alert-recipient (value=my-other-recipient)
Options: option1=new
Meta options: timeout=60s
次のコマンドは、受信側 my-alert-recipient
を alert
から削除します。
pcs alert recipient remove my-recipient pcs alert
# pcs alert recipient remove my-recipient
# pcs alert
Alerts:
Alert: alert (path=/my/path)
Recipients:
Recipient: alert-recipient (value=rec_value)
Alert: my-alert (path=/path/to/script)
Description: alert_description
Options: opt=val option1=newvalue1
Meta options: timestamp-format="%M%B%S" timeout=50s
Recipients:
Recipient: my-alert-recipient (value=my-other-recipient)
Options: option1=new
Meta options: timeout=60s
次のコマンドは、設定から myalert
を削除します。
pcs alert remove myalert pcs alert
# pcs alert remove myalert
# pcs alert
Alerts:
Alert: alert (path=/my/path)
Recipients:
Recipient: alert-recipient (value=rec_value)