美文网首页
Prometheus监控Linux

Prometheus监控Linux

作者: 袁先生的笔记 | 来源:发表于2018-07-26 20:03 被阅读0次

环境

系统:CentOS 7.5
软件:node_exporter-0.16.0.linux-amd64.tar.gz

客户端

  • 下载node_exporter
    地址:https://prometheus.io/download/

  • 安装

    # tar -xzvf node_exporter-0.16.0.linux-amd64.tar.gz
    # mkdir /usr/local/prometheus
    # mv node_exporter-0.16.0.linux-amd64 /usr/local/prometheus/node_exporter
    
  • 创建用户并授权

    # useradd prometheus
    # chown -R prometheus:prometheus /usr/local/prometheus
    
  • 添加启动服务

    # vim /usr/lib/systemd/system/node_exporter.service
    [Unit]
    Description=node_exporter
    After=network.target
    
    [Service]
    Type=simple
    User=prometheus
    ExecStart=/usr/local/prometheus/node_exporter/node_exporter
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    
  • 启动

    # systemctl enable node_exporter.service
    # systemctl start node_exporter.service
    

Prometheus端

  • 配置Prometheus

    # vim /usr/local/prometheus/prometheus.yml
    scrape_configs:
      - job_name: 'linux'
      static_configs:
        - targets: ['10.10.10.1:9100']
    
  • 重启Prometheus

    # systemctl restart prometheus
    

Grafana端

  • 添加dashboards
    点击Create - Import,输入dashboards的id(推荐1860)

相关文章

网友评论

      本文标题:Prometheus监控Linux

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