useradd --no-create-home --shell /bin/false prometheus
mkdir -p /etc/prometheus /var/lib/prometheus
wget https://github.com/prometheus/prometheus/releases/download/v2.52.0/prometheus-2.52.0.linux-amd64.tar.gz
tar xvf prometheus-*.tar.gz
cd prometheus-*
cp prometheus /usr/local/bin/
cp promtool /usr/local/bin/
cp -r consoles/ console_libraries/ /etc/prometheus/
/etc/prometheus/prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'linux-node'
static_configs:
- targets: ['localhost:9100']
/etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
After=network.target
[Service]
User=prometheus
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reexec
sudo systemctl enable --now prometheus
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.1/node_exporter-1.8.1.linux-amd64.tar.gz
tar xvf node_exporter-*
cd node_exporter-*
cp node_exporter /usr/local/bin
Systemd servisi:
[Unit]
Description=Node Exporter
[Service]
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=default.target
sudo apt install -y software-properties-common
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo apt update
sudo apt install grafana
sudo systemctl enable --now grafana-server
http://localhost:3000Alertmanager binary kurulumu ve yapılandırması yapılabilir. E-posta veya webhook ile uyarılar tanımlanır.
Prometheus + Grafana, lokal sunucun için gerçek zamanlı metrik ve uyarı takibi sunar. Dilersen panel yapılarını ve dashboard şablonlarını da ayrıca sağlayabilirim.