欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 国际 > 简单prometheus+grafana+pushgateway采集GPU利用率和交换机流量

简单prometheus+grafana+pushgateway采集GPU利用率和交换机流量

2025/11/19 18:45:58 来源:https://blog.csdn.net/aashuii/article/details/145245881  浏览:    关键词:简单prometheus+grafana+pushgateway采集GPU利用率和交换机流量

1、prometheus+pushgateway

从https://prometheus.io/download/下载prometheus和pushgateway
下载后修改prometheus.yaml
pushgateway需要设置honor_labels: true才能保留原来的job、instance等
在这里插入图片描述
然后启动:./prometheus --config.file=“./prometheus.yml”
./pushgateway
访问pushgateway:http://x.x.x.x:9091
查看pushgateway数据:http://x.x.x.x:9091/metrics
注意:pushgateway只保留最后一次推送的值,prometheus拉取的时候也是拉取pushgateway当前存储的值

查看prometheus:http://x.x.x.x:9090
在这里插入图片描述
Status->Targets里面可以检查目标状态、上次拉取时间等

注意:http://x.x.x.x:9090/metrics并不能查看到所有表项

2、grafana

grafana安装:
apt-get install -y software-properties-common
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
add-apt-repository “deb https://packages.grafana.com/oss/deb stable main”
apt install grafana
systemctl start grafana-server
systemctl enable grafana-server
登录:http://x.x.x.x:3000
用户名密码admin admin

有的exporter源码会提供grafana配置文件,比如dcgm-exporter中:
dcgm-exporter\grafana\dcgm-exporter-dashboard.json

在Home->Dashboards->New->Import中导入json就可以看到图形

修改Y轴的单位

对应panel右上角三个点中选择Edit,Standard options,Uint中选择(忘了。。待确认)

安装dcgm-exporter

https://github.com/NVIDIA/dcgm-exporter
下载源码,然后:
kubectl create namespace gpu-monitoring
kubectl apply dcgm-exporter/service-monitor.yaml
kubectl apply dcgm-exporter/dcgm-exporter.yaml -n gpu-monitoring
创建nodeport并提交

apiVersion: v1
kind: Service
metadata:name: dcgm-exporternamespace: gpu-monitoring
spec:selector:app.kubernetes.io/name: dcgm-exporterports:- port: 9400targetPort: 9400nodePort: 30094type: NodePort

测试:curl http://localhost:30094/metrics

问题1:

error: resource mapping not found for name: "dcgm-exporter" namespace: "" from "service-monitor.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
ensure CRDs are installed first

下载https://github.com/prometheus-operator/prometheus-operato,提交prometheus-operator\prometheus-operator\example\prometheus-operator-crd\monitoring.coreos.com_servicemonitors.yaml

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词