28.7. Creating and modifying a cluster alert
The following example procedure creates alerts, adds recipients, modifies an alert, removes an alert, and displays the configured alerts at each step.
While you must install the alert agents themselves on each node in a cluster, you need to run the pcs commands only once.
Procedure
Create a simple alert. Since no alert ID value is specified, the system creates an alert ID value of
alert.# pcs alert create path=/my/pathAdd a recipient of
rec_valueto the alert. Since this command does not specify a recipient ID, the value ofalert-recipientis used as the recipient ID.# pcs alert recipient add alert value=rec_valueAdd a second recipient of
rec_value2to the alert. This command specifies a recipient ID ofmy-recipientfor the recipient.# pcs alert recipient add alert value=rec_value2 id=my-recipientDisplay the alert configuration.
# pcs alert config Alerts: Alert: alert (path=/my/path) Recipients: Recipient: alert-recipient (value=rec_value) Recipient: my-recipient (value=rec_value2)Add a second alert, with an alert ID of
my-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"Add a recipient for that alert for the second alert with a recipient value of
my-other-recipient. Since no recipient ID is specified, the system provides a recipient id ofmy-alert-recipient.# pcs alert recipient add my-alert value=my-other-recipientDisplay the alert configuration.
# 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)Modify the alert values for the alert
my-alert.# pcs alert update my-alert options option1=newvalue1 meta timestamp-format="%H%M%S"Modify the alert values for the recipient
my-alert-recipient.# pcs alert recipient update my-alert-recipient options option1=new meta timeout=60sDisplay the alert configuration.
# 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=60sRemove the recipient
my-alert-recipientfromalert.# pcs alert recipient remove my-recipientDisplay the alert configuration.
# 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=60sRemove the alert
myalertfrom the configuration.# pcs alert remove myalertDisplay the alert configuration.
# pcs alert Alerts: Alert: alert (path=/my/path) Recipients: Recipient: alert-recipient (value=rec_value)