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

  1. 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/path
  2. Add a recipient of rec_value to the alert. Since this command does not specify a recipient ID, the value of alert-recipient is used as the recipient ID.

    # pcs alert recipient add alert value=rec_value
  3. Add a second recipient of rec_value2 to the alert. This command specifies a recipient ID of my-recipient for the recipient.

    # pcs alert recipient add alert value=rec_value2 id=my-recipient
  4. Display 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)
  5. 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"
  6. 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 of my-alert-recipient.

    # pcs alert recipient add my-alert value=my-other-recipient
  7. Display 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)
  8. Modify the alert values for the alert my-alert.

    # pcs alert update my-alert options option1=newvalue1 meta timestamp-format="%H%M%S"
  9. Modify the alert values for the recipient my-alert-recipient.

    # pcs alert recipient update my-alert-recipient options option1=new meta timeout=60s
  10. Display 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=60s
  11. Remove the recipient my-alert-recipient from alert.

    # pcs alert recipient remove my-recipient
  12. Display 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=60s
  13. Remove the alert myalert from the configuration.

    # pcs alert remove myalert
  14. Display the alert configuration.

    # pcs alert
    Alerts:
     Alert: alert (path=/my/path)
      Recipients:
       Recipient: alert-recipient (value=rec_value)
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部