tech:notes_prometheus
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_prometheus [2025/04/01 19:49] – Jean-Baptiste | tech:notes_prometheus [2025/04/15 15:59] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| {{tag> | {{tag> | ||
| - | = Notes Prometheus | + | # Notes Prometheus |
| Voir : | Voir : | ||
| Ligne 13: | Ligne 14: | ||
| * Prometheus VictoriaMetrics victoriadb | * Prometheus VictoriaMetrics victoriadb | ||
| * Alertmanager (as part of Prometheus) | * Alertmanager (as part of Prometheus) | ||
| - | ** https:// | + | |
| Voir Identity correlation / CorrelationId | Voir Identity correlation / CorrelationId | ||
| Ligne 20: | Ligne 21: | ||
| * https:// | * https:// | ||
| - | == Serveur | + | ## Serveur |
| - | < | + | ~~~bash |
| #docker run -p 9090:9090 -v ~/ | #docker run -p 9090:9090 -v ~/ | ||
| mkdir -p prometheus/ | mkdir -p prometheus/ | ||
| - | sudo docker run -p 9090:9090 -v ~/ | + | #sudo docker run -p 9090:9090 -v ~/ |
| - | </code> | + | podman run -p 9090:9090 -v ~/prometheus:/ |
| + | ~~~ | ||
| Config | Config | ||
| - | <code yaml prometheus.yml> | + | |
| + | '' | ||
| + | ~~~yaml | ||
| # my global config | # my global config | ||
| global: | global: | ||
| Ligne 64: | Ligne 69: | ||
| file_sd_configs: | file_sd_configs: | ||
| - files: [ "/ | - files: [ "/ | ||
| - | </ | + | ~~~ |
| - | <code yaml prometheus/ | + | '' |
| + | ~~~yaml | ||
| - targets: [ " | - targets: [ " | ||
| 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: " | host: " | ||
| - | </ | + | ~~~ |
| + | |||
| + | |||
| + | ## Exporter (client) | ||
| + | |||
| + | Voir aussi : | ||
| + | * check-mk-agent | ||
| - | == Exporter (client) | ||
| Créer un compte **node_exporter** | Créer un compte **node_exporter** | ||
| - | <code ini / | + | '' |
| + | ~~~ini | ||
| [Unit] | [Unit] | ||
| Description=node_exporter | Description=node_exporter | ||
| Ligne 92: | Ligne 104: | ||
| [Install] | [Install] | ||
| WantedBy=multi-user.target | WantedBy=multi-user.target | ||
| - | </ | + | ~~~ |
| Ligne 103: | Ligne 115: | ||
| Voir | Voir | ||
| - | < | + | ~~~bash |
| docker run -d --name=grafana -p 3000:3000 grafana/ | docker run -d --name=grafana -p 3000:3000 grafana/ | ||
| - | </ | + | ~~~ |
| # Voir https:// | # Voir https:// | ||
| - | <code yaml docker-compose.yml> | + | |
| + | '' | ||
| + | ~~~yaml | ||
| version: ' | version: ' | ||
| services: | services: | ||
| Ligne 118: | Ligne 132: | ||
| volume: | volume: | ||
| - " | - " | ||
| - | </ | + | ~~~ |
| Run Grafana container with persistent storage (recommended) | Run Grafana container with persistent storage (recommended) | ||
| Create a persistent volume for your data in / | Create a persistent volume for your data in / | ||
| - | < | + | ~~~bash |
| docker volume create grafana-storage | docker volume create grafana-storage | ||
| - | </ | + | ~~~ |
| Start grafana | Start grafana | ||
| - | < | + | ~~~bash |
| docker run -d -p 3000:3000 --name=grafana -v grafana-storage:/ | docker run -d -p 3000:3000 --name=grafana -v grafana-storage:/ | ||
| - | </ | + | ~~~ |
| Run Grafana container using bind mounts | Run Grafana container using bind mounts | ||
| Ligne 136: | 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. | ||
| - | < | + | ~~~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 " | + | #docker run -d --user $ID --volume " |
| - | </code> | + | |
| + | podman run --volume "$PWD/data:/ | ||
| + | |||
| + | ~~~ | ||
tech/notes_prometheus.1743529750.txt.gz · Dernière modification : de Jean-Baptiste
