Skip to content

Proxmox VE 安装 Node Exporter 监控 #348

@Bpazy

Description

@Bpazy

此方案依赖 Docker,安装方法: #347

新建 docker-compose.yaml 文件:

version: '3.7'
services:
  node-exporter:
    image: prom/node-exporter:v1.3.1
    container_name: node-exporter
    network_mode: "host"
    pid: "host"
    restart: always
    volumes:
      - /proc:/host/proc
      - /sys:/host/sys
      - /:/host
      - /dev:/host/dev
    command:
      - "--path.procfs=/host/proc"
      - "--path.sysfs=/host/sys"
      - "--path.rootfs=/host"
    privileged: true

如果机器会被公网访问到,可以添加 --web.listen-address=192.168.1.100:9100 来限制只有特定的网络接口可以访问,比如我这里限制只能从 tailscale 接口访问,则配置如下:

    command:
      - "--path.procfs=/host/proc"
      - "--path.sysfs=/host/sys"
      - "--path.rootfs=/host"
      - "--web.listen-address=100.75.192.23:9100"

然后启动: docker compose up -d

最后验证:

root@pve:~/node-exporter# curl localhost:9100/metrics
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0.000127245
go_gc_duration_seconds{quantile="0.25"} 0.000127245
go_gc_duration_seconds{quantile="0.5"} 0.000159044
go_gc_duration_seconds{quantile="0.75"} 0.000159044
go_gc_duration_seconds{quantile="1"} 0.000159044
go_gc_duration_seconds_sum 0.000286289
go_gc_duration_seconds_count 2
......

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions