vi /etc/nginx/sites-available/monitor.conf
server { listen 80; listen [::]:80; server_name monitor.<domaine-sinp>; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $realip_remote_addr; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:3000/;# ATTENTION : bien mettre un slash final ! Sinon => erreur 404 } }
cd /etc/nginx/sites-enabled/ ; ln -s ../sites-available/monitor.conf monitor.conf
nginx -t && nginx -s reload
docker network ls
cd ~/docker/monitor
docker-compose up
CTRL+C
docker-compose up -d
docker compose down
certbot --nginx -d monitor.<domaine-sinp>
server { listen 443 ssl http2; # managed by Certbot listen [::]:443 ssl http2; # managed by Certbot server_name monitor.<domaine-sinp>; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $realip_remote_addr; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:3000/;# ATTENTION : bien mettre un slash final ! Sinon => erreur 404 } ssl_certificate /etc/letsencrypt/live/monitor.<domaine-sinp>/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/monitor.<domaine-sinp>/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { listen 80; listen [::]:80; server_name monitor.<domaine-sinp>; if ($host = monitor.<domaine-sinp>) { return 301 https://$host$request_uri; } # managed by Certbot return 404; # managed by Certbot }
INFLUXDB2_INIT_BUCKET=telegraf
INFLUXDB2_INIT_RETENTION=90d
: 3 mois.docker exec -it monitor-influxdb /bin/bash
influx config create --active --org <organisation> --config-name administrator --host-url http://monitor-influxdb:8086 --token <admin-token-from-InfluxDB2-interface>
influx user create -n telegraf -p <telegraf-password> -o <organisation>
influx bucket list
influx bucket update -i <telgraf-bucket-id> -r 7d
influx v1 dbrp create --db telegraf --rp telegraf --bucket-id <telgraf-bucket-id> --default
Authorisation
avec pour valeur Token <grafana-api-tocken>
.<grafana-api-tocken>
, connecter vous à l'interface d'InfluxDB v2 et générer un nouveau token si ce n'est pas déjà fait (Load Data > Api Tockens > Generate API Token) en lecture seulement sur le bucket "telegraf". ssh admin@bkp-<region>-sinp
docker exec -it monitor-grafana /bin/bash
grafana-cli plugins install grafana-clock-panel
exit
cd ~/docker/monitor/
docker compose restart monitor-grafana
sudo chown 1337:root /home/admin/docker/monitor/grafana/backup
docker compose run monitor-grafana-backup
/home/admin/docker/monitor/grafana/backup
docker compose run monitor-grafana-backup restore _OUTPUT_/<date>.tar.gz
/etc/cron.d
/home/admin/
est bien sauvegarder par Borg.$__interval
par 10s
NoData
pour le champ "If no data or all values are null" qnd on utilise une règle d'alerte utilisant For. Vous pouvez utiliser la valeur Keep Last State
.A : SELECT mean("usage_user") FROM "autogen"."cpu" WHERE $timeFilter GROUP BY TIME(10s), "host"::tag fill(NULL) B : MEAN ; A ; DROP NON NUMERIC VALUE C : B IS ABOVE 50
A query : SELECT mean("load5") FROM "autogen"."system" WHERE $timeFilter GROUP BY TIME(10s) fill(NULL) B reduce : MEAN ; A ; DROP NON NUMERIC VALUE C threshold : B IS ABOVE 2,5
A query : SELECT mean("available_percent") AS "mean_available_percent" FROM "autogen"."mem" WHERE $timeFilter GROUP BY TIME(10s), "host"::tag fill(NULL) B reduce : MEAN ; A ; DROP NON NUMERIC VALUE C threshold : B IS BELOW 25
A query: SELECT mean("used_percent") FROM "autogen"."disk" WHERE $timeFilter GROUP BY TIME(1m), "host"::tag, "device"::tag fill(NULL) B reduce : MAX ; A ; DROP NON NUMERIC VALUE C threshold : B IS ABOVE 80
docker exec -it monitor-influxdb influx -execute 'CREATE RETENTION POLICY "telegraf_1_year" ON "telegraf" DURATION 365d REPLICATION 1 SHARD DURATION 7d DEFAULT'
docker exec -it monitor-influxdb influx -execute 'SHOW RETENTION POLICIES ON "telegraf"'
docker exec -it monitor-influxdb influx
SHOW DATABASES
USE "telegraf"
SHOW MEASUREMENTS
SHOW SERIES FROM <measurement>
SHOW TAG KEYS FROM <measurement>
SHOW TAG VALUES WITH KEY = "host"
SHOW TAG VALUES FROM <measurement> WITH KEY = "host"
SHOW FIELD KEYS FROM <measurement>
SELECT * FROM <measurement>
precision rfc3339
DELETE FROM postgresql WHERE time < '2020-01-09 17:00:00'
DELETE WHERE time < '2020-01-09 10:37:00
'[[outputs.influxdb]] urls = ["http://monitor-influxdb:8086"] database = "telegraf" [[inputs.influxdb]] urls = [ "http://monitor-influxdb:8086/debug/vars" ]