|
|
| (4 versions intermédiaires par le même utilisateur non affichées) |
| Ligne 1 : |
Ligne 1 : |
| | | Retour [[Linux]] | [[Accueil]] |
| {| class="wikitable" style="width:100%;" | | {| class="wikitable" style="width:100%;" |
| ! Thème | | ! Thème |
| Ligne 8 : |
Ligne 8 : |
| | Mini‑checklist : Surveillance disque LVM | | | Mini‑checklist : Surveillance disque LVM |
| | [[Surveillance disque LVM]] | | | [[Surveillance disque LVM]] |
| | |- |
| | | Extension du disque système PBS (LVM, Proxmox VE) |
| | | Mini‑checklist : Extension disque |
| | | [[Extension du disque LVM]] |
| |- | | |- |
| | Supervision | | | Supervision |
| | Installation de Prometheus, Node Exporter et Grafana, Cockpit | | | Installation de Prometheus, Node Exporter et Grafana, Cockpit |
| | [[Prometheus]] [[Node_Exporter]] [[Grafana]] [[Cockpit]] | | | [[Prometheus - Grafana - Node_Exporter]] |
| |- | | |- |
| | Pièges NGINX à éviter | | | Pièges NGINX à éviter |
| Ligne 17 : |
Ligne 21 : |
| | [[Reverse Proxy NGINX]] | | | [[Reverse Proxy NGINX]] |
| |} | | |} |
|
| |
|
| |
|
| |
| <h1>Procédure technique : Supervision Debian avec Prometheus & Grafana</h1>
| |
| <h2>1. Installation du poste Debian</h2>
| |
|
| |
| Installer Debian 13 “Trixie”
| |
| Configurer l’interface réseau
| |
| Créer l’utilisateur <code>eugène</code> avec sudo
| |
| Activer le serveur SSH
| |
|
| |
| <h2>2. Configuration SSH</h2>
| |
| <pre><code>sudo systemctl enable --now ssh
| |
| sudo ufw allow ssh</code></pre>
| |
|
| |
| <h2>3. Installation de Prometheus</h2>
| |
| <pre><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></pre>
| |
|
| |
| <h2>4. Configuration du service Prometheus</h2>
| |
| <pre><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></pre>
| |
|
| |
| <h3>Fichier systemd</h3>
| |
| <pre><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></pre>
| |
|
| |
| <pre><code>sudo systemctl daemon-reload
| |
| sudo systemctl enable --now prometheus</code></pre>
| |
|
| |
| <h2>5. Installation de Node Exporter</h2>
| |
| <pre><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></pre>
| |
|
| |
| <pre><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></pre>
| |
|
| |
| <h3>Fichier systemd</h3>
| |
| <pre><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></pre>
| |
|
| |
| <pre><code>sudo systemctl daemon-reload
| |
| sudo systemctl enable --now node_exporter</code></pre>
| |
|
| |
| <h2>6. Configuration Prometheus pour Node Exporter</h2>
| |
| <pre><code>sudo nano /etc/prometheus/prometheus.yml</code></pre>
| |
|
| |
| <h3>Contenu corrigé</h3>
| |
| <pre><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></pre>
| |
|
| |
| <pre><code>promtool check config /etc/prometheus/prometheus.yml
| |
| sudo systemctl restart prometheus</code></pre>
| |
|
| |
| <h2>7. Installation de Grafana via dépôt APT</h2>
| |
| <pre><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></pre>
| |
|
| |
| <h2>8. Configuration Grafana</h2>
| |
|
| |
| Accéder à <code>http://IP_DE_TA_VM:3000</code>
| |
| Login : <code>admin</code> / Mot de passe : <code>admin</code>
| |
| Ajouter une source Prometheus : <code>http://localhost:9091</code>
| |
|
| |
| <h2>9. Import du dashboard Node Exporter Full</h2>
| |
|
| |
| Menu → <strong>+ Import</strong>
| |
| ID du dashboard : <code>1860</code>
| |
| Associer à la source Prometheus
| |
| Cliquer sur <strong>Import</strong>
| |