Instalando Prometheus e Grafana

Опубликовано: 11 Май 2025
на канале: Landu Digital
2,672
61

Fala galera, tudo joia?!
Seguinte, qualquer duvida deixem nos comentários.
Segue abaixo a colinha que fiz para vocês.


Installing Prometheus
Install wget in case you don't have it.
yum install wget -y

Download the binaries and libraries.
wget https://github.com/prometheus/prometh...

Extract content
tar xvf prometheus-2.28.1.linux-amd64.tar.gz

Create prometheus path
mkdir -p /opt/prometheus

Move binaries to the new path.
cp -rp . /opt/prometheus

Create Service file with the content below.
vim /etc/systemd/system/prometheus.service

[Unit]
Description=Prometheus Service
After=network.target

[Service]
Type=simple
ExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml

[Install]
WantedBy=multi-user.target

Start the application
systemctl start prometheus
systemctl stop prometheus
systemctl restart prometheus


Download node Exporter
wget https://github.com/prometheus/node_ex...

Extract node exporter content
tar xvf node_exporter-1.2.0.linux-amd64.tar.gz

Copy to the environment path.
cp -p node_exporter /usr/local/bin/

Create the service file.
vim /etc/systemd/system/node-exporter.service

[Unit]
Description=Prometheus Node Exporter Service
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=multi-user.target


Start the service
systemctl start node-exporter
systemctl stop node-exporter
systemctl restart node-exporter


Add the node to prometheus
vim /etc/prometheus/prometheus.yml
job_name: 'node-exporter'
static_configs:
targets: ['localhost:9100']

Installing Grafana
Download Grafana and install
wget https://dl.grafana.com/oss/release/gr...
yum install grafana-8.0.6-1.x86_64.rpm

Start Grafana
systemctl start grafana-server

Login to your grafan page
http://192.168.56.11:3000/login
admin
admin

Click add your first data source
Add prometheus source
Go back to the home page, click over "+" button and then click over import.
Paste the node exporter code id which is 1860 and then click over load button.
Select Prometheus.
Done.