【问题标题】:Grafana Notification channel adding in config?Grafana 通知通道在配置中添加?
【发布时间】:2018-12-04 12:26:58
【问题描述】:

我已经在 Kubernetes 中安装了 Grafana。我正在尝试通过脚本自动完成所有操作。我能够安装 grafana、导入数据源和仪表板。但我还想在 slack 中添加一个通知通道,但不是在 web UI 中,而是在配置中的某个地方。这样做有可能吗?

雅库布

【问题讨论】:

标签: notifications kubernetes grafana channel


【解决方案1】:

目前使用 Grafana API 的最简单方法:

POST /api/alert-notifications


{
  "name": "new alert notification",  //Required
  "type":  "email", //Required
  "isDefault": false,
  "sendReminder": false,
  "settings": {
    "addresses": "carl@grafana.com;dev@grafana.com"
  }
}

文档http://docs.grafana.org/http_api/alerting/#get-alert-notifications

【讨论】:

    【解决方案2】:

    我将带有 curl (API) 的通知通道添加到 grafana。

    【讨论】:

      【解决方案3】:

      可以配置警报。
      /etc/grafana/provisioning/notifiers/notifiers.yml 创建一个文件。这是一个示例(从官方文档中复制)。可以在Grafana Provisioning documentation page找到可能的设置:

      notifiers:
        - name: notification-channel-1
          type: slack
          uid: notifier1
          # either
          org_id: 2
          # or
          org_name: Main Org.
          is_default: true
          send_reminder: true
          frequency: 1h
          disable_resolve_message: false
          settings:
            recipient: 'XXX'
            uploadImage: true
            token: 'xoxb' # legacy setting since Grafana v7.2 (stored non-encrypted)
            url: https://slack.com # legacy setting since Grafana v7.2 (stored non-encrypted)
            # Secure settings that will be encrypted in the database 
            # (supported since Grafana v7.2). 
          secure_settings:
            token: 'xoxb'
            url: https://slack.com
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-12-31
        • 2017-03-08
        • 2017-04-23
        • 2011-07-21
        • 2019-09-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多