Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Prometheus+grafana Monitoring documentation installation

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Download the installation package

Wget https://github.com/prometheus/prometheus/releases/download/v2.10.0/prometheus-2.10.0.linux-amd64.tar.gz

two。 Create a running user

[root@localhost opt] # groupadd-r prometheus

[root@localhost opt] # useradd-r-g prometheus-d /-s / sbin/nologin-c "prometheus user" prometheus

3. Binary installation

[root@localhost opt] # tar-xf prometheus-2.10.0.linux-amd64.tar.gz

[root@localhost opt] # mkdir / etc/prometheus

[root@localhost opt] # mkdir / var/lib/prometheus

[root@localhost opt] # cp prometheus-2.10.0.linux-amd64/prometheus / usr/local/bin/

[root@localhost opt] # cp prometheus-2.10.0.linux-amd64/prometheus.yml / etc/prometheus/

[root@localhost opt] # chown-R prometheus:prometheus / etc/prometheus

[root@localhost opt] # chown-R prometheus:prometheus / var/lib/prometheus/

[root@localhost opt] # vim / usr/lib/systemd/system/prometheus.service

4. Configure startup script

[Unit]

Description=prometheus

After=network.target

[Service]

Type=simple

User=prometheus

ExecStart=/usr/local/bin/prometheus\

-- config.file=/etc/prometheus/prometheus.yml\

-- storage.tsdb.path=/var/lib/prometheus\

-- storage.tsdb.retention=15d\

-- web.read-timeout=5m\

-- web.max-connections=10\

-- query.max-concurrency=20\

-- query.timeout=2m\

-- web.enable-lifecycle

Restart=on-failure

[Install]

WantedBy=multi-user.target

Parameter explanation:

-- config.file=/etc/prometheus/prometheus.yml # prometheus profile

-- storage.tsdb.path=/var/lib/prometheus # prometheus storage data path

-- storage.tsdb.retention=15d # prometheus collection data retention time

-- web.read-timeout=5m # the maximum waiting time for requesting a link

-- web.max-connections=10 # maximum number of links

-- query.max-concurrency=20 # maximum number of concurrent queries supported

-- query.timeout=2m # timeout for a single query

-- web.enable-lifecycle # Hot load

5. Start

[root@localhost opt] # systemctl daemon-reload

[root@localhost opt] # systemctl enable prometheus

[root@localhost opt] # systemctl start prometheus

[root@localhost opt] # netstat-anlptu | grep: 9090

Tcp 0 0 127.0.0.1:58628 127.0.0.1:9090 ESTABLISHED 8528/prometheus

Tcp6 0 0: 9090: * LISTEN 8528/prometheus

Tcp6 0 0:: 1:9090:: 1:58374 ESTABLISHED 8528/prometheus

Tcp6 0 0 127.0.0.1:9090 127.0.0.1:58628 ESTABLISHED 8528/prometheus

Tcp6 0 0:: 1:58374:: 1:9090 ESTABLISHED 8528/prometheus

Deploy node_exporter

Node_exporter collects system data of machines. Here, exporter provided by prometheus is used. In addition to node_exporter, officials also provide exporter such as consul,memcached,haproxy,mysqld. For more information, please see the official website.

Here, the related services are deployed on the prometheus service and the node node.

Tar-zxvf node_exporter-0.17.0-rc.0.linux-amd64.tar.gz-C / usr/local/

Cd / usr/local/

Mv node_exporter-0.17.0-rc.0.linux-amd64 node_exporter

Set up users (nodes)

Groupadd prometheus

Useradd-g prometheus-s / sbin/nologin prometheus

Chown-R prometheus:prometheus / usr/local/node_exporter

[root@node1 ~] # vim / usr/lib/systemd/system/node_exporter.service

[Unit]

Description=node_exporter

Documentation= https://prometheus.io/

After=network.target

[Service]

Type=simple

User=prometheus

ExecStart=/usr/local/node_exporter/node_exporter

Restart=on-failure

[Install]

WantedBy=multi-user.target

[root@node1 ~] # systemctl enable node_exporter

[root@node1 ~] # systemctl start node_exporter

Grafana installation

Https://grafana.com/grafana/download

Configuration file

The configuration file is located in / etc/grafana/grafana.ini, so you can keep the default configuration for the time being.

Set up boot boot

Systemctl enable grafana-server

Systemctl start grafana-server

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report