====== Prometheus ====== http://Prometheus.io * [[https://fr.slideshare.net/TimVaillancourt/monitoringwithprometheusgrafanatutorial|Monitoring with Prometheus Grafana Tutorial]] (with Mysql exported) * Monitoring Exim (Exim4) with [[https://github.com/fstab/grok_exporter|grok_exporter]]. The grok_exporter aims at porting Grok from the ELK stack to Prometheus monitoring. The goal is to use Grok patterns for extracting Prometheus metrics from arbitrary log files. * [[https://github.com/prometheus/blackbox_exporter|blackbox_exporter]] The blackbox exporter allows blackbox probing of endpoints over HTTP, HTTPS, DNS, TCP and ICMP. * [[https://www.robustperception.io/tag/prometheus/|Articles]] du lead developper Prometheus differs from [[/informatique/system_admin/server_monitoring#grafana_loki|Grafana Loki]] by focusing on metrics instead of logs, and delivering logs via pull, instead of push. ===== prometheus-node-exporter ===== Désactiver les services inutiles sur des VM cloud : sudo systemctl disable --now prometheus-node-exporter-smartmon.timer sudo systemctl disable --now prometheus-node-exporter-nvme.timer sudo systemctl disable --now prometheus-node-exporter-ipmitool-sensor.timer sudo systemctl disable --now prometheus-node-exporter-mellanox-hca-temp.timer Purger le dossier ''/var/lib/prometheus/node-exporter/'' des fichiers ''.prom'' de ces services. À priori il ne devrait rester que le ''apt.prom''. Exemple de configuration ''/etc/default/prometheus-node-exporter'' sur VM public cloud. 📢 Attention, selon les versions de l'exporter des ''--no-collector.xyz'' peuvent être inconnus et bloquer son démarrage, bien consulter le systemd journal pour les erreurs. # Le filtre `--collector.systemd.unit-include` est important : # passe de ~550-600 (~115 units x 5) à 25 (5 units x 5 status) # et 15 ms vs 157 ms (divise par 10 le coût du scrape systemd) # À adapter selon les services à surveiller # ARGS="--web.listen-address=127.0.0.1:9100 \ --collector.diskstats.ignored-devices=\"^(ram|loop|fd|sr|(h|s|v|xv)d[a-z]|nvme\\\\d+n\\\\d+p)\\\\d+$\" \ --collector.systemd.unit-include=\"^((postfix|nginx|php.*fpm|mariadb|ssh|prometheus-*-exporter|wg-quick@.+)[.]service)$\" \ --no-collector.bcache \ --no-collector.btrfs \ --no-collector.bonding \ --no-collector.dmi \ --no-collector.drbd \ --no-collector.edac \ --no-collector.fibrechannel \ --no-collector.hwmon \ --no-collector.infiniband \ --no-collector.mdadm \ --no-collector.nfs \ --no-collector.nfsd \ --no-collector.powersupplyclass \ --no-collector.rapl \ --no-collector.tapestats \ --no-collector.thermal_zone \ --no-collector.xfs \ --no-collector.zfs \ --no-collector.wifi \ --no-collector.ipvs \ --no-collector.cpufreq \ --no-collector.entropy \ --no-collector.nvme \ --no-collector.selinux " ===== prometheus-postfix-exporter ===== ATTENTION: la version .deb fourni avec Debian 13 est buggée avec la lecture de journald, tous les logs ne sont pas captés [[https://github.com/kumina/postfix_exporter/issues/55|kumina/postfix_exporter#55]]. Debian sid semble changer pour [[https://github.com/Hsn723/postfix_exporter|Hsn723/postfix_exporter]], à confirmer ... Ubuntu 26 utilise bien "Hsn723/postfix_exporter" Après installation vérifier : * dans le groupe ''systemd-journal'' * avec ''$ sudo grep ^Groups /proc/$(pidof prometheus-postfix-exporter)/status'' * vérifier l'unité systemd * dans ''EnvironmentFile'' : ''ARGS='--systemd.unit=postfix@-.service''' Installer **"Hsn723/postfix_exporter" par dessus le ''.deb'' de "kumina/postfix_exporter"** pour bénéficier de l'unité systemd, l'utilisateur prometheus, les SupplementaryGroups (systemd-journal + postdrop) et le fichier d'environnement. Utiliser ''dpkg-divert'' sur /usr/bin/prometheus-postfix-exporter pour que les mises à jour du paquet n'écrasent pas le remplacement. # Récup du binaire wget https://github.com/Hsn723/postfix_exporter/releases/download/v0.21.2/postfix_exporter_systemd_0.21.2_linux_amd64.tar.gz # décompression qui donne le seul fichier `postfix_exporter` tar zxf postfix_exporter_systemd_0.21.2_linux_amd64.tar.gz # stop le service sudo systemctl stop prometheus-postfix-exporter.service # Diversion dpkg sudo dpkg-divert --add --rename --divert /usr/bin/prometheus-postfix-exporter.distrib /usr/bin/prometheus-postfix-exporter Adding 'local diversion of /usr/bin/prometheus-postfix-exporter to /usr/bin/prometheus-postfix-exporter.distrib' # vérif diversion $ dpkg-divert --list | grep postfix local diversion of /usr/bin/prometheus-postfix-exporter to /usr/bin/prometheus-postfix-exporter.distrib # install le nouveau binaire sudo install -o root -g root -m 0755 postfix_exporter /usr/bin/prometheus-postfix-exporter # restart le service sudo systemctl start prometheus-postfix-exporter.service Attention au nom des services dans journald: Par défaut il cherche ''postfix/smtpd'' mais il peut y avoir ''postfix/smtps/smtpd'' * ajouter 2 fois option ''--postfix.${SERVICE_TYPE}_service_label=*'' # Extra arguments for the daemon. ARGS="--systemd.unit=postfix@-.service \ --web.listen-address=127.0.0.1:9154 \ --postfix.smtpd_service_label=smtpd \ --postfix.smtpd_service_label=smtps/smtpd "