简单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并提交

c 复制代码
apiVersion: v1
kind: Service
metadata:
  name: dcgm-exporter
  namespace: gpu-monitoring
spec:
  selector:
    app.kubernetes.io/name: dcgm-exporter
  ports:
  - port: 9400
    targetPort: 9400
    nodePort: 30094
  type: NodePort

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

问题1:

c 复制代码
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

相关推荐
happymade11 小时前
7000 台网络设备批量纳管 & 自动拓扑生成实战——MSRM3 完整操作流程与关键要点复盘
运维·服务器·网络·zabbix·grafana·msrm3
AAA@峥11 小时前
从零搭建 Prometheus 完整监控告警体系|Linux 部署 + node_exporter+Grafana 可视化
云原生·grafana·prometheus
liuyicenysabel2 天前
Grafana + Prometheus 分级告警配置设计(P0/P1/P2)
javascript·grafana·prometheus
随遇而安zx2 天前
SpringCloud---可观测性与监控:Actuator / Micrometer / Prometheus / Grafana 深度解析
spring cloud·grafana·prometheus
qq_452396232 天前
第四篇:《Prometheus 深度实战:指标设计、Exporter 开发与服务发现》
服务发现·prometheus
刘某的Cloud2 天前
k8s部署prometheus架构规则
linux·运维·kubernetes·prometheus·监控
LlmCraft|大模型工程实践2 天前
12. Docker 日志管理与监控:ELK 日志收集 + Prometheus 性能监控
elk·docker·prometheus
DevOps老兵3 天前
AI Infra实战02:GPU监控实战,用DCGM+Prometheus+Grafana看清每一张卡
人工智能·grafana·prometheus·ai infra·gpu监控·dcgm
qq_452396233 天前
第二篇:《LGTM 栈全景:Loki、Grafana、Tempo、Mimir 的协同作战》
grafana
heimeiyingwang3 天前
【Prometheus·入门篇】数据模型:Metric 类型、标签与时间序列
prometheus