Files
tp/prometheus.md

102 lines
2.2 KiB
Markdown
Raw Normal View History

2025-11-06 20:08:05 +01:00
# Prometheus
2025-11-18 11:44:11 +01:00
## Debian 13
```shell
useradd --system --no-create-home --user-group --shell /usr/sbin/nologin prometheus
wget https://github.com/prometheus/prometheus/releases/download/v3.7.3/prometheus-3.7.3.linux-amd64.tar.gz
tar xvf prometheus-*.tar.gz
```
Déplacer les binaires
```shell
mv prometheus-*/prometheus /usr/local/bin/
mv prometheus-*/promtool /usr/local/bin/
chown prometheus:prometheus /usr/local/bin/prometheus
chown prometheus:prometheus /usr/local/bin/promtool
```
Créer le dossier de configuration
```shell
mkdir /etc/prometheus
mkdir /etc/prometheus/consoles
mkdir /etc/prometheus/console_libraries
mv prometheus-*/prometheus.yml /etc/prometheus
chown -R prometheus:prometheus /etc/prometheus
```
Créer le dossier pour les données
```shell
mkdir /var/lib/prometheus
chown -R prometheus:prometheus /var/lib/prometheus
```
2025-11-18 11:53:25 +01:00
Créer le service
```shell
nano /etc/systemd/system/prometheus.service
```
```
[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.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries
Restart=always
[Install]
WantedBy=multi-user.target
```
```shell
systemctl daemon-reload
systemctl enable --now prometheus
```
2025-11-18 11:44:11 +01:00
## Raspberry Pi 3B+
2025-11-06 20:08:05 +01:00
```shell
2025-11-18 07:43:57 +01:00
wget https://github.com/prometheus/prometheus/releases/download/v3.7.3/prometheus-3.7.3.linux-armv7.tar.gz
tar xfz prometheus-3.7.3.linux-armv7.tar.gz
mv prometheus-3.7.3.linux-armv7 prometheus
rm prometheus-3.7.3.linux-armv7.tar.gz
sudo nano /etc/systemd/system/prometheus.service
2025-11-06 20:08:05 +01:00
```
```
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network-online.target
[Service]
User=iut
Restart=on-failure
ExecStart=/home/iut/prometheus/prometheus \
--config.file=/home/iut/prometheus/prometheus.yml \
--storage.tsdb.path=/home/iut/prometheus/data
[Install]
WantedBy=multi-user.target
```
```shell
2025-11-20 20:12:55 +01:00
sudo systemctl enable --now prometheus
sudo systemctl status prometheus
2025-11-06 20:08:05 +01:00
```