Outils pour utilisateurs

Outils du site


tech:notes_prometheus

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
tech:notes_prometheus [2025/03/24 15:06] – créée - modification externe 127.0.0.1tech:notes_prometheus [2025/04/15 15:59] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 {{tag>Brouillon}} {{tag>Brouillon}}
  
-Notes Prometheus+Notes Prometheus
  
 Voir : Voir :
Ligne 7: Ligne 8:
 * https://www.scaleway.com/en/docs/configure-prometheus-monitoring-with-grafana/ * https://www.scaleway.com/en/docs/configure-prometheus-monitoring-with-grafana/
 * PromQL * PromQL
 +* https://enix.io/fr/blog/comment-creer-exporter-prometheus/
 +
  
 Voir aussi :  Voir aussi : 
 * Prometheus VictoriaMetrics victoriadb * Prometheus VictoriaMetrics victoriadb
 * Alertmanager (as part of Prometheus) * Alertmanager (as part of Prometheus)
-  ** https://developers.redhat.com/articles/2023/10/04/5-steps-build-self-healing-server-alertmanager+    * https://developers.redhat.com/articles/2023/10/04/5-steps-build-self-healing-server-alertmanager
  
 Voir Identity correlation / CorrelationId Voir Identity correlation / CorrelationId
Ligne 18: Ligne 21:
 * https://grafana.com/oss/tempo/ * https://grafana.com/oss/tempo/
  
-== Serveur+## Serveur
  
-<code bash>+~~~bash
 #docker run -p 9090:9090 -v ~/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus #docker run -p 9090:9090 -v ~/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
  
 mkdir -p prometheus/nodes mkdir -p prometheus/nodes
-sudo docker run -p 9090:9090 -v ~/prometheus:/etc/prometheus prom/prometheus +#sudo docker run -p 9090:9090 -v ~/prometheus:/etc/prometheus prom/prometheus 
-</code>+podman run -p 9090:9090 -v ~/prometheus:/etc/prometheus docker.io/prom/prometheus 
 +~~~ 
  
 Config Config
-<code yaml prometheus.yml>+ 
 +''prometheus.yml'' 
 +~~~yaml
 # my global config # my global config
 global: global:
Ligne 62: Ligne 69:
     file_sd_configs:     file_sd_configs:
         - files: [ "/etc/prometheus/nodes/*.yml" ]         - files: [ "/etc/prometheus/nodes/*.yml" ]
-</code>+~~~
  
-<code yaml prometheus/nodes/vm1.yml>+''prometheus/nodes/vm1.yml'' 
 +~~~yaml
 - targets: [ "172.17.0.1:9100" ] - targets: [ "172.17.0.1:9100" ]
   labels:   labels:
       # Vous pouvez ajouter ce que vous voulez pour taguer la machine       # Vous pouvez ajouter ce que vous voulez pour taguer la machine
       host: "vm1"       host: "vm1"
-</code>+~~~ 
 + 
 + 
 +## Exporter (client) 
 + 
 +Voir aussi : 
 +* check-mk-agent
  
-== Exporter (client) 
  
 Créer un compte **node_exporter** Créer un compte **node_exporter**
  
-<code ini /etc/systemd/system/node_exporter.service>+''/etc/systemd/system/node_exporter.service'' 
 +~~~ini
 [Unit] [Unit]
 Description=node_exporter Description=node_exporter
Ligne 90: Ligne 104:
 [Install] [Install]
 WantedBy=multi-user.target WantedBy=multi-user.target
-</code>+~~~
  
  
Ligne 101: Ligne 115:
 Voir  Voir 
  
-<code bash>+~~~bash
 docker run -d --name=grafana -p 3000:3000 grafana/grafana docker run -d --name=grafana -p 3000:3000 grafana/grafana
-</code>+~~~
  
  
 # Voir https://grafana.com/docs/grafana/latest/administration/configure-docker/ # Voir https://grafana.com/docs/grafana/latest/administration/configure-docker/
-<code yaml docker-compose.yml>+ 
 +''docker-compose.yml'' 
 +~~~yaml
 version: '3.7' version: '3.7'
 services: services:
Ligne 116: Ligne 132:
  volume:  volume:
    - "$PWD/data:/var/lib/grafana"    - "$PWD/data:/var/lib/grafana"
-</code>+~~~
   
 Run Grafana container with persistent storage (recommended) Run Grafana container with persistent storage (recommended)
  
 Create a persistent volume for your data in /var/lib/grafana (database and plugins) Create a persistent volume for your data in /var/lib/grafana (database and plugins)
-<code bash>+~~~bash
 docker volume create grafana-storage docker volume create grafana-storage
-</code>+~~~
  
 Start grafana Start grafana
-<code bash>+~~~bash
 docker run -d -p 3000:3000 --name=grafana -v grafana-storage:/var/lib/grafana grafana/grafana docker run -d -p 3000:3000 --name=grafana -v grafana-storage:/var/lib/grafana grafana/grafana
-</code>+~~~
  
 Run Grafana container using bind mounts Run Grafana container using bind mounts
Ligne 134: Ligne 150:
 You may want to run Grafana in Docker but use folders on your host for the database or configuration. When doing so, it becomes important to start the container with a user that is able to access and write to the folder you map into the container. You may want to run Grafana in Docker but use folders on your host for the database or configuration. When doing so, it becomes important to start the container with a user that is able to access and write to the folder you map into the container.
  
-<code bash>+~~~bash
 mkdir data # creates a folder for your data mkdir data # creates a folder for your data
 ID=$(id -u) # saves your user id in the ID variable ID=$(id -u) # saves your user id in the ID variable
  
 # starts grafana with your user id and using the data folder # starts grafana with your user id and using the data folder
-docker run -d --user $ID --volume "$PWD/data:/var/lib/grafana" -p 3000:3000 grafana/grafana:7.2.1 +#docker run -d --user $ID --volume "$PWD/data:/var/lib/grafana" -p 3000:3000 grafana/grafana:7.2.1 
-</code>+ 
 +podman run --volume "$PWD/data:/var/lib/grafana" -p 3000:3000 docker.io/grafana/grafana:7.2.1 
 + 
 +~~~
  
  
  
  
tech/notes_prometheus.1742825205.txt.gz · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki