本文介绍了稳定/prometheus-operator-添加持久的grafana仪表板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将新的仪表板添加到下面的掌舵表中

I am trying to add a new dashboard to the below helm chart

https://github.com/helm/charts/tree /master/stable/prometheus-operator

文档不是很清楚.

我已经在名称空间中添加了一个配置映射,如下所示-

I have added a config map to the name space like the below -

apiVersion: v1
kind: ConfigMap
metadata:
  name: sample-grafana-dashboard
  namespace: monitoring
  labels:
     grafana_dashboard: "1"
data:
  etcd-dashboard.json: |-
{JSON}

根据文档,应仅选择"并添加此文件,但不能添加. https://github.com/helm/charts/tree/master/稳定/grafana#配置

According to the documentation, this should just be "picked" up and added, but its not.https://github.com/helm/charts/tree/master/stable/grafana#configuration

我的values.yaml中的sidecar选项看起来像-

The sidecar option in my values.yaml looks like -

grafana:
  enabled: true

  ## Deploy default dashboards.
  ##
  defaultDashboardsEnabled: true

  adminPassword: password

  ingress:
    ## If true, Grafana Ingress will be created
    ##
    enabled: false

    ## Annotations for Grafana Ingress
    ##
    annotations: {}
      # kubernetes.io/ingress.class: nginx
      # kubernetes.io/tls-acme: "true"

    ## Labels to be added to the Ingress
    ##
    labels: {}

    ## Hostnames.
    ## Must be provided if Ingress is enable.
    ##
    # hosts:
    #   - grafana.domain.com
    hosts: []

    ## Path for grafana ingress
    path: /

    ## TLS configuration for grafana Ingress
    ## Secret must be manually created in the namespace
    ##
    tls: []
    # - secretName: grafana-general-tls
    #   hosts:
    #   - grafana.example.com
  #dashboardsConfigMaps:
    #sidecarProvider: sample-grafana-dashboard
  sidecar:
    dashboards:
      enabled: true
      label: grafana_dashboard

我也尝试将其添加到value.yml

I have also tried adding this to the value.yml

dashboardsConfigMaps:
   - sample-grafana-dashboard

哪个,不行.

像我本人一样,没有人有任何将自己的仪表板添加到此掌舵图中的经验.

Does anyone have any experience with adding your own dashboards to this helm chart as I really am at my wits end.

推荐答案

总结:对于sidecar,您只需要将一个选项设置为true-grafana.sidecar.dashboards.enabled

To sum up:For sidecar you need only one option set to true - grafana.sidecar.dashboards.enabled

  1. 已启用安装prometheus-operator女巫补充卡:

helm install stable/prometheus-operator --name prometheus-operator --set grafana.sidecar.dashboards.enabled=true --namespace monitoring

  1. 添加新的仪表板,例如 MongoDB_Overview :
  1. Add new dashboard, for exampleMongoDB_Overview:
wget https://raw.githubusercontent.com/percona/grafana-dashboards/master/dashboards/MongoDB_Overview.json
kubectl -n monitoring create cm grafana-mongodb-overview --from-file=MongoDB_Overview.json
  1. 现在最棘手的部分是,您必须为自己设置一个正确的标签configmap,默认情况下设置为grafana.sidecar.dashboards.labelgrafana_dashboard,因此:
  1. Now the tricky part, you have to set a correct label for yourconfigmap, by default grafana.sidecar.dashboards.label is settografana_dashboard, so:
kubectl -n monitoring label cm grafana-mongodb-overview grafana_dashboard=mongodb-overview

现在您应该在grafana中找到新添加的仪表板,此外,每个带有标签grafana_dashboard的confimap都将作为仪表板进行处理.

Now you should find your newly added dashboard in grafana, moreover every confimap with label grafana_dashboard will be processed as dashboard.

仪表板是持久且安全的,存储在configmap中.

The dashboard is persisted and safe, stored in configmap.

这篇关于稳定/prometheus-operator-添加持久的grafana仪表板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 00:22