Prometheus 和 Grafana 的部署和使用
Prometheus 的部署
参见: prometheus 29.39.0 · prometheus/prometheus-community
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
cat > prometheus-values.yaml << EOF
server:
persistentVolume:
storageClass: "nfs-client"
ingress:
enabled: true
ingressClassName: "nginx"
hosts:
- prometheus.local
alertmanager:
persistence:
storageClass: "nfs-client"
EOF
helm install prometheus oci://ghcr.io/prometheus-community/charts/prometheus \
--namespace prometheus \
--create-namespace \
-f prometheus-values.yaml
Grafana 的部署
参见: grafana 14.2.0 · grafana-community/grafana-community
helm repo add grafana-community https://grafana-community.github.io/helm-charts
cat > grafana-values.yaml << EOF
persistence:
enabled: true
storageClassName: "nfs-client"
ingress:
enabled: true
ingressClassName: "nginx"
hosts:
- grafana.local
EOF
helm install grafana grafana-community/grafana --namespace grafana --create-namespace -f grafana-values.yaml
Grafana 的使用
打开Grafana 网页 http://grafana.local
添加 Prometheus 数据源
创建数据源 promethues :在 Connections 页面的 Add new Connections 子界面,点击 Prometheus 卡片,然后点击 Add new data source,在Settings标签页的Connection分区设置配置 Prometheus server URL 的值为 http://prometheus-server.prometheus.svc.cluster.local
添加仪表盘
添加仪表盘 Node Exporter Dashboard 20240520 TenSunS自动同步版 :在 Dashboards 导入仪表盘 https://grafana.com/grafana/dashboards/8919 并选择使用数据源 prometheus,从而添加仪表盘
浙公网安备 33010602011771号