Prometheus+Grafana installation minimalist tutorial

Table of contents

Initialize the monitoring host

Install go environment

Install Prometheus

Install Grafana

Initialize the monitored host

Monitoring host configuration monitoring monitored host

after class

Initialize the monitoring host

Install go environment

Download the corresponding go version, unzip it, and set environment variables

export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin

Execute go version to ensure that go is installed successfully

Install Prometheus

Download the corresponding installation package Download | Prometheus

After downloading, unzip tar-zxvf prometheus-2.37.8.linux-amd64.tar.gz

start up

nohup ./prometheus --web.listen-address="0.0.0.0:9788" &

Visit your designated port to directly view the monitoring page that comes with Prometheus: such as my 192.168.55.191:9788

Install Grafana

Download the rpm package: https://dl.grafana.com/oss/release/grafana-6.4.3-1.x86_64.rpm

Local installation: yum localinstall grafana-6.4.3-1.x86_64.rpm

Start: systemctl start grafana-server.service

Visit: 192.168.55.191:3000 to open the grafana page, the default username and password are admin, the first login will allow you to change the password

 Then click Add Data Source

Click Prometheus

 After entering, fill in according to your own configuration, and then save

 Select the report you need on the Dashboards page, or go directly to the official website to download and import Dashboards | Grafana Labs

Interlude: I imported a json from the official website, but the following error occurred, the reason is that my grafana is too low for this monitoring version, so I used rpm -Uvh grafana-7.2.1-1.x86_64.rpm to upgrade the rpm (upgrade Remember to stop the previous service), after upgrading, you can view the version grafana-server -v, and then restart: systemctl start grafana-server.service

Initialize the monitored host

Download node_exporter at https://github.com/prometheus/node_exporter/

Unzip and start (nohup ./node_exporter --web.listen-address=:9788 &)

Visit the local startup port verification, for example, I visit the local port 9788

Monitoring host configuration monitoring monitored host

Modify Prometheus configuration

According to the official case of monitoring yourself, continue to add the services to be monitored.

  - job_name: "prometheus"

    static_configs:
      - targets: ["localhost:9788"]

 Then restart Prometheus

after class

Gracefully shut down and reload Prometheus : --web.enable-lifecycle Description Enable shutdown and reload via HTTP request. You can then close the program with an HTTP request, for example:

curl -X POST http://localhost:9788/-/quit

The grafana configuration file installed in this way is in /etc/grafana/grafana.ini

 

 

 

 

 

Guess you like

Origin blog.csdn.net/wai_58934/article/details/131167846