Supervision Debian
De EC_Wiki
Autres actions
| Thème | Description | Page associée |
|---|---|---|
| Surveillance disque LVM | Mini‑checklist : Surveillance disque LVM | Surveillance disque LVM |
| Supervision | Installation de Prometheus, Node Exporter et Grafana, Cockpit | Supervision Debian |
Procédure technique : Supervision Debian avec Prometheus & Grafana
1. Installation du poste Debian
Installer Debian 13 “Trixie”
Configurer l’interface réseau
Créer l’utilisateur eugène avec sudo
Activer le serveur SSH
2. Configuration SSH
<code>sudo systemctl enable --now ssh sudo ufw allow ssh</code>
3. Installation de Prometheus
<code>cd /opt wget https://github.com/prometheus/prometheus/releases/download/v2.49.1/prometheus-2.49.1.linux-amd64.tar.gz tar -xzf prometheus-2.49.1.linux-amd64.tar.gz mv prometheus-2.49.1.linux-amd64 prometheus</code>
4. Configuration du service Prometheus
<code>sudo useradd --no-create-home --shell /usr/sbin/nologin prometheus sudo mkdir /etc/prometheus /var/lib/prometheus sudo cp /opt/prometheus/prometheus.yml /etc/prometheus/ sudo cp /opt/prometheus/prometheus /usr/local/bin/ sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus /usr/local/bin/prometheus</code>
Fichier systemd
<code>[Unit] Description=Prometheus Monitoring Wants=network-online.target After=network-online.target [Service] User=prometheus Group=prometheus Type=simple ExecStart=/usr/local/bin/prometheus \ --config.file=/etc/prometheus/prometheus.yml \ --storage.tsdb.path=/var/lib/prometheus \ --web.listen-address=0.0.0.0:9091 [Install] WantedBy=multi-user.target</code>
<code>sudo systemctl daemon-reload sudo systemctl enable --now prometheus</code>
5. Installation de Node Exporter
<code>cd /opt wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gz tar -xzf node_exporter-1.7.0.linux-amd64.tar.gz mv node_exporter-1.7.0.linux-amd64 node_exporter</code>
<code>sudo useradd --no-create-home --shell /usr/sbin/nologin node_exporter sudo cp /opt/node_exporter/node_exporter /usr/local/bin/ sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter</code>
Fichier systemd
<code>[Unit] Description=Node Exporter Wants=network-online.target After=network-online.target [Service] User=node_exporter Group=node_exporter Type=simple ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=default.target</code>
<code>sudo systemctl daemon-reload sudo systemctl enable --now node_exporter</code>
6. Configuration Prometheus pour Node Exporter
<code>sudo nano /etc/prometheus/prometheus.yml</code>
Contenu corrigé
<code>global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets: []
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9091"]
- job_name: "node_exporter"
static_configs:
- targets: ["localhost:9100"]</code>
<code>promtool check config /etc/prometheus/prometheus.yml sudo systemctl restart prometheus</code>
7. Installation de Grafana via dépôt APT
<code>sudo apt-get install -y apt-transport-https wget gpg sudo mkdir -p /etc/apt/keyrings wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list sudo apt-get update sudo apt-get install grafana sudo systemctl enable --now grafana-server</code>
8. Configuration Grafana
Accéder àhttp://IP_DE_TA_VM:3000Login :admin/ Mot de passe :adminAjouter une source Prometheus :http://localhost:9091
9. Import du dashboard Node Exporter Full
Menu → + Import
ID du dashboard : 1860
Associer à la source Prometheus
Cliquer sur Import