camptocamp / grafana-prometheus-alertmanager-datasource

Grafana Datasource for the Prometheus Alertmanager
Apache License 2.0
286 stars 57 forks source link

Configure datasource via provisioning file #41

Open hawksight opened 6 years ago

hawksight commented 6 years ago

I couldn't see any examples on configuring the plugin via the provisioning method.

So I played around until I got a working example:

datasources:
 - name: alertmanager
   type: camptocamp-prometheus-alertmanager-datasource
   access: proxy
   org_id: 1
   url: http://alertmanager-main.monitoring:9093
   version: 1
   editable: false
   json_data:
     severity_critical: critical
     severity_high: error
     severity_warning: warning
     severity_info: information

In my case I am running Grafana as a pod in K8s talking to prometheus - and now alertmanager. The datasources file is provided on pod startup via a configmap.

Sharing my example incase its useful to anyone else.

Apologies, I wasn't sure how best to make a PR. clone, or just branch on repository.

fessmage commented 6 years ago

@hawksight i must correct you, becase i spent half-hour trying to work your config, but thanks for example anyway!

  1. Instead json_data: you must type jsonData
  2. Maybe it just in my environment, but for provisioning works, i was forced to create another key - keepCookies under jsonData, like that:
    jsonData:
      keepCookies: "[]"
      severity_critical: "4"
      severity_high: "3"
      severity_warning: "2"
      severity_info: "1"
Blobonat commented 3 years ago

Since there still seems to be no documentation on this topic, I wanted to provide an update: I am using Grafana v7.5.4 and was able to use the Plugin with the following config:

- name: alertmanager
  type: camptocamp-prometheus-alertmanager-datasource
  access: server
  org_id: 1
  url: http://alertmanager:9093
  version: 1
  jsonData:
    severity_critical: "4"
    severity_high: "3"
    severity_warning: "2"
    severity_info: "1"