Prometheus. Monitor Linux server using Prometheus: различия между версиями

Материал из Wiki
Перейти к навигации Перейти к поиску
Строка 1: Строка 1:
== At Client - Linux node (192.168.199.181) ==
== At Client - Linux node (192.168.17.186) ==
Install linux node exporter
Install linux node exporter


Строка 35: Строка 35:
Go to web
Go to web


<code><nowiki>http://IP-Address:9100/metrics</nowiki></code>
<code><nowiki>http://192.168.17.186:9100/metrics</nowiki></code>


== At Server - Prometheus ==
== At Server - Prometheus ==
<code>nano /etc/prometheus/prometheus.yml</code>
<code>nano /etc/prometheus/prometheus.yml</code>
  ...
  ...
    - job_name: 'node_exporter_centos'
    - job_name: 'centos7-test01'
      scrape_interval: 5s
      scrape_interval: 5s
      static_configs:
      static_configs:
        - targets: [''''192.168.199.181:9100'''<nowiki/>']
        - targets: [''''192.168.17.186:9100'''<nowiki/>']
<code>systemctl restart prometheus</code>
<code>systemctl restart prometheus</code>


Строка 50: Строка 50:
<code>http://<Prometheus-Server-IP>:9090/targets</code>
<code>http://<Prometheus-Server-IP>:9090/targets</code>


You can click the graph and query any server metrics and click execute to show output. It will show the console output.
== At Grafana ==
 
 
Look at '''centos7-test01''' metrics
[[Файл:Linux node dashboard to grafana 1.jpg|без|мини]]
 
 
Look at '''centos7-test01''' in Prometheus
[[Файл:Linux node dashboard to grafana 2.jpg|без|мини]]
 
 
Add '''centos7-test01''' Dashboard to Grafana
[[Файл:Linux node dashboard to grafana 3.jpg|без|мини]]
[[Файл:Linux node dashboard to grafana 4.jpg|без|мини]]
[[Файл:Linux node dashboard to grafana 5.jpg|без|мини]]
[[Файл:Linux node dashboard to grafana 6.jpg|без|мини]]
[[Файл:Linux node dashboard to grafana 7.jpg|без|мини]]
[[Категория:Prometheus]]
[[Категория:Prometheus]]
__ОБЯЗАТЕЛЬНОЕ_ОГЛАВЛЕНИЕ__
__ОБЯЗАТЕЛЬНОЕ_ОГЛАВЛЕНИЕ__

Версия 20:36, 21 июля 2022

At Client - Linux node (192.168.17.186)

Install linux node exporter

wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz

tar -xvzf node_exporter-1.3.1.linux-amd64.tar.gz

useradd -rs /bin/false nodeusr

mv node_exporter-1.3.1.linux-amd64/node_exporter /usr/local/bin/

nano /etc/systemd/system/node_exporter.service

[Unit]
Description=Node Exporter
After=network.target
[Service]
User=nodeusr
Group=nodeusr
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target

systemctl daemon-reload

systemctl enable node_exporter

systemctl start node_exporter

systemctl start firewalld

firewall-cmd --zone=public --add-port=9100/tcp --permanent

systemctl restart firewalld

Go to web

http://192.168.17.186:9100/metrics

At Server - Prometheus

nano /etc/prometheus/prometheus.yml

...
  - job_name: 'centos7-test01'
    scrape_interval: 5s
    static_configs:
      - targets: ['192.168.17.186:9100']

systemctl restart prometheus

Web

http://<Prometheus-Server-IP>:9090/targets

At Grafana

Look at centos7-test01 metrics

Linux node dashboard to grafana 1.jpg


Look at centos7-test01 in Prometheus

Linux node dashboard to grafana 2.jpg


Add centos7-test01 Dashboard to Grafana

Linux node dashboard to grafana 3.jpg
Linux node dashboard to grafana 4.jpg
Linux node dashboard to grafana 5.jpg
Linux node dashboard to grafana 6.jpg
Linux node dashboard to grafana 7.jpg