美文网首页
docker-compose部署node-exporter

docker-compose部署node-exporter

作者: ljh123 | 来源:发表于2024-07-04 12:47 被阅读0次

    一、安装

      node_exporter:
        image: prom/node-exporter:v1.8.0
        container_name: node_exporter
        volumes:
          - /proc:/host/proc:ro
          - /sys:/host/sys:ro
          - /:/rootfs:ro
        # ports:
        #   - 9100:9100
        environment:
          TZ: Asia/Shanghai
        command:
          - '--path.procfs=/host/proc'
          - '--path.rootfs=/rootfs'
          - '--path.sysfs=/host/sys'
          - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
        network_mode: "host"
        restart: always
    

    二、接入prometheus

    1、通过静态文件配置加入

    scrape_configs:
      # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
      - job_name: "prometheus"
    
        # metrics_path defaults to '/metrics'
        # scheme defaults to 'http'.
    
        static_configs:
          - targets: ["127.0.0.1:9100"]
    

    三、图表

    1、grafana

    https://grafana.com/grafana/dashboards/

    搜索:node-expoter

    https://grafana.com/grafana/dashboards/1860-node-exporter-full/

    之后下载,导入到grafana里

    2、夜莺

    夜莺内置了一些常用exporter采集图表

    我用的是社区版:v7.0.0,从仪表盘 -> 内置仪表盘 -> 搜索linux -> 点击搜索到的,选择带有 Node Exporter的图表

    四、监控

    一些高频常用的监控

    up
    cpu使用率
    内存使用率
    网络使用情况
    磁盘使用情况

    一般需要对这些比较核心的指标进行配置告警

    夜莺里面也有内置一些常用的监控策略,从告警管理 -> 内置规则 ->linux,选择 linux_by_exporter

    相关文章

      网友评论

          本文标题:docker-compose部署node-exporter

          本文链接:https://www.haomeiwen.com/subject/hawicjtx.html