prometheus配置大盘与告警

1、prometheus配置大盘

kube-prometheus-stack 定义 dashboard

https://stackoverflow.com/questions/77271449/persist-grafana-dashboard-on-kube-prometheus-and-expose-it

Also to persist dashboards to outlive pod deletion follow the below steps:

  • Create your custom dashboard through the UI.
  • Click on the “Save” button which will pop up a “Cannot save provisioned dashboard” window. There you can click on the “Save JSON to file” button.
  • Save the json file to your computer.
  • Using kubectl command-line tool which is configured to communicate with your k8s cluster, create a new ConfigMap using the following command: kubectl create configmap my-custom-dashboard --from-file=path-to-file.json
  • Add a label to the newly created ConfigMap: kubectl label configmaps my-custom-dashboard grafana_dashboard=1

bitnami-grafana

dashboardsConfigMaps

https://github.com/bitnami/charts/tree/main/bitnami/grafana
https://blog.cloudcover.ch/posts/grafana-helm-dashboard-import/

定义

apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    grafana_dashboard: "1"
  name: graph-services-response-times
  namespace: monitoring
data:
  graph-services-response-times.json: |-
    {
	  //TODO JSON内容
    }	

重点:需要替换JSON文件的 datasource.uuid为所在系统有的DataSource id;否则数据出不来
https://blog.csdn.net/xixihahalelehehe/article/details/136532080

2、如何配置告警

https://medium.com/cloud-native-daily/provision-grafana-dashboards-and-alerts-using-helm-and-sidecars-733dcd223037
posted @ 2025-03-28 22:41  BUG弄潮儿  阅读(33)  评论(0)    收藏  举报