Skip to content

How can I edit and add prometheus alerts using the same libsonnet file? #607

Answered by brancz
mmn01-sky asked this question in General
Discussion options

You must be logged in to vote

Yeah this is a jsonnet thing, you need to have an additional merge operation to do both the map and adding. Something along the lines of this should work:

local kp =
  (import 'kube-prometheus/kube-prometheus.libsonnet') +
  {
    _config+:: {
      namespace: 'monitoring',
    },
    
    prometheusAlerts+:: {
      groups+: (import 'prometheus-rules/custom-prometheus-rules.json').groups,
    },

    grafanaDashboards+:: {  //  monitoring-mixin compatibility
    'multi-cluster.json': (import 'grafana-dashboards/multi-cluster-dashboard.json'),
    },
    grafana+:: {
      dashboards+:: {  // use this method to import your dashboards to Grafana
        'multi-cluster.json': (import 'grafa…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mmn01-sky
Comment options

Answer selected by mmn01-sky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants