当前位置:网站首页>Prometheus + granfana monitoring deployment (binary)

Prometheus + granfana monitoring deployment (binary)

2021-09-15 05:58:50 lihaha7

  1. prometheus build

    prometheus Official website download address :Download | Prometheus

    # Download deadline 2021/9/9 The latest version 
    wget https://github.com/prometheus/prometheus/releases/download/v2.29.2/prometheus-2.29.2.linux-amd64.tar.gz
    
    # establish prometheus Catalog 
    mkdir -p /opt/monitor
    
    # Unzip mobile 
    tar -xf prometheus-2.29.2.linux-amd64.tar.gz
    mv prometheus-2.29.2.linux-amd64 /opt/monitor/prometheus
    
    # add to systemctl management 
    vi /usr/lib/systemd/system/prometheus.service
    [Unit]
    Description=prometheus
    [Service]
    ExecStart=/opt/monitor/prometheus/prometheus --config.file=/opt/monitor/prometheus/prometheus.yml
    ExecReload=/bin/kill -HUP $MAINPID
    KillMode=process
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target
    
    # start-up prometheus
    systemctl daemon-reload 
    systemctl start prometheus.service 
    systemctl status prometheus.service
    
  2. granfana build

    granfana Official website download address :Download Grafana | Grafana Labs

    # Download deadline 2021/9/9 The latest version 
    wget https://dl.grafana.com/enterprise/release/grafana-enterprise-8.1.2.linux-amd64.tar.gz
    tar -zxvf grafana-enterprise-8.1.2.linux-amd64.tar.gz
    mkdir /opt/monitor/grafana
    mv grafana-8.1.2 /opt/monitor/grafana
    
    vi /usr/lib/systemd/system/grafana.service
    [Unit]
    Description=grafana
    [Service]
    ExecStart=/opt/monitor/grafana/bin/grafana-server -homepath=/opt/monitor/grafana
    ExecReload=/bin/kill -HUP $MAINPID
    KillMode=process
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target
    
    systemctl daemon-reload 
    systemctl start grafana.service
    systemctl status grafana.service 
    
  3. node_exporter: Used to monitor Linux The index collector of the system

    prometheus Collector address :Exporters and integrations | Prometheus

    # notes : If github Pull slowly , Thunder can be used to download and upload 
    wget https://github.com/prometheus/node_exporter/releases/download/v1.2.2/node_exporter-1.2.2.linux-amd64.tar.gz
    
    tar  -xf node_exporter-1.2.2.linux-amd64.tar.gz 
    mv node_exporter-1.2.2.linux-amd64 /usr/local/node_exporter
    
    vi /usr/lib/systemd/system/node_exporter.service
    [Unit]
    Description=node_exporter
    [Service]
    ExecStart=/usr/local/node_exporter/node_exporter
    #ExecStart=/usr/local/node_exporter/node_exporter --web.config=/usr/local/node_exporter/config.yml
    ExecReload=/bin/kill -HUP $MAINPID
    KillMode=process
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target
    
    systemctl daemon-reload 
    systemctl start node_exporter.service 
    systemctl status node_exporter.service 
    
  4. To configure prometheus Discover

    # Add configuration at the end ,ip The address is installation node_exporter The address of 
    vim /opt/monitor/prometheus/prometheus.yml
    - job_name: "node"
        static_configs:
          - targets: ["192.168.123.97:9100"]
    #prometheus Supports hot loading configuration files 
    kill -HUP prometheus Of PID
    
  5. visit prometheus Of ip:9090 see

    Click on Status ----> Targets see

  6. land granfana page ip:3000

    Default password admin admin The first time you log in, you need to change your password

    Click settings on the left ----> Data sources

    The bottom test is saved

  7. Add monitoring template

    Click on import After completion , fill 9276 Click on load

    And then in import Upper selection After the previously added database Click again import

  8. The effect is as shown in the picture

版权声明
本文为[lihaha7]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/09/20210909120916545n.html

随机推荐