tech:notes_supervision
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_supervision [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_supervision [2026/05/30 17:01] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes Supervision | ||
| + | |||
| + | Ne pas dire **supervision** mais **observabilité**. Ça fait mieux. | ||
| + | |||
| + | |||
| + | ## Outils | ||
| + | |||
| + | Ex : | ||
| + | * Zabbix | ||
| + | * Nagios | ||
| + | * Check mk / Shinken | ||
| + | * Nagstamon | ||
| + | * [Sensu](https:// | ||
| + | * CachetHQ | ||
| + | * Riemann.io (Supervision & Alerting) | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ## Sondes | ||
| + | |||
| + | ### System | ||
| + | |||
| + | ~~~bash | ||
| + | lsof +L1 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Apache2 | ||
| + | |||
| + | ~~~bash | ||
| + | apachectl status || lynx localhost/ | ||
| + | ~~~ | ||
| + | |||
| + | ### Expiration certificat SSL/TLS | ||
| + | |||
| + | Voir : | ||
| + | * http:// | ||
| + | |||
| + | Script : | ||
| + | * http:// | ||
| + | |||
| + | ~~~bash | ||
| + | openssl s_client -connect gnunet.org: | ||
| + | ~~~ | ||
| + | |||
| + | Source : http:// | ||
| + | |||
| + | `check-tls.sh` | ||
| + | ~~~bash | ||
| + | #!/bin/bash | ||
| + | # Author: Kim Minh Kaplan, 2010. | ||
| + | |||
| + | set -e | ||
| + | |||
| + | # The $statedir/ | ||
| + | # server to be checked: | ||
| + | # | ||
| + | # < | ||
| + | # | ||
| + | # For example: | ||
| + | # | ||
| + | # www.example.com: | ||
| + | # www.example.org: | ||
| + | # www.example.net: | ||
| + | # | ||
| + | # LIMITATIONS/ | ||
| + | # | ||
| + | # * Requires OpenSSL | ||
| + | # | ||
| + | # * Probably only works on a GNU system (bash, coreutils). | ||
| + | # | ||
| + | # * Only check the expiration date of the certificate. Not its purpose, | ||
| + | # | ||
| + | # | ||
| + | # * Only check the expiration date of the server certificate but *not* | ||
| + | # the expiration date of intermediate or root certificate | ||
| + | # | ||
| + | # * Empty lines in $statedir/ | ||
| + | # | ||
| + | |||
| + | OPENSSL=" | ||
| + | |||
| + | # Alertes à moins de 90, 60, 30, 15, 7, 6, 5, 4, 3, 2, 1 jour. | ||
| + | alert=(90 60 30 15 7 6 5 4 3 2 1) | ||
| + | |||
| + | statedir=/ | ||
| + | test -d " | ||
| + | mkdir " | ||
| + | trap "rmdir \" | ||
| + | |||
| + | nowepoch=`date +%s` | ||
| + | >" | ||
| + | while read host_desc prevepoch ca_file openssl_args | ||
| + | do | ||
| + | if test -z " | ||
| + | then | ||
| + | prevepoch=0 | ||
| + | fi | ||
| + | |||
| + | # Find expiry epoch | ||
| + | tmpf=/ | ||
| + | if $OPENSSL s_client -CAfile " | ||
| + | -connect $host_desc </ | ||
| + | then | ||
| + | if grep -q '^ *Verify return code: 0 (ok)$' " | ||
| + | then | ||
| + | true | ||
| + | else | ||
| + | echo " | ||
| + | echo "Error verifying $host_desc" | ||
| + | cat " | ||
| + | rm -f " | ||
| + | echo " | ||
| + | continue | ||
| + | fi | ||
| + | enddate=`$OPENSSL x509 -in " | ||
| + | rm -f " | ||
| + | else | ||
| + | cat " | ||
| + | rm -f " | ||
| + | echo " | ||
| + | continue | ||
| + | fi | ||
| + | endepoch=`date -d " | ||
| + | |||
| + | if test $endepoch -le $nowepoch | ||
| + | then | ||
| + | echo " | ||
| + | prevepoch=$nowepoch | ||
| + | else | ||
| + | # Find the largest not yet triggered alert: it is the maximum that is still below prevspan | ||
| + | prevspan=`expr \( $endepoch - $prevepoch \) / 60 / 60 / 24` | ||
| + | nextalert=none | ||
| + | for j in ${alert[@]} | ||
| + | do | ||
| + | if test $j -lt $prevspan | ||
| + | then | ||
| + | if test $nextalert = none | ||
| + | then | ||
| + | nextalert=$j | ||
| + | elif test $j -gt $nextalert | ||
| + | then | ||
| + | nextalert=$j | ||
| + | fi | ||
| + | fi | ||
| + | done | ||
| + | if test $nextalert = none | ||
| + | then | ||
| + | echo " | ||
| + | continue | ||
| + | fi | ||
| + | |||
| + | # Alert if necessary | ||
| + | spanepoch=`expr $nextalert \* 60 \* 60 \* 24` | ||
| + | if test `expr $endepoch - $nowepoch` -lt $spanepoch | ||
| + | then | ||
| + | expire=`date -I -d @$endepoch` | ||
| + | echo " | ||
| + | prevepoch=$nowepoch | ||
| + | fi | ||
| + | fi | ||
| + | echo " | ||
| + | done <" | ||
| + | mv " | ||
| + | |||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Sonde check générique à faire | ||
| + | |||
| + | Voir : | ||
| + | * create_a_custom_service_unit [[how_to_distinguish_between_a_crash_and_a_graceful_reboot_in_rhel_7_or_rhel_8|Alert on unexpected shutdown]] | ||
| + | |||
| + | Fichiers sensibles : | ||
| + | * /etc/passwd | ||
| + | * /etc/shadow | ||
| + | |||
| + | RW partition. touch /.check | ||
| + | |||
| + | date / time : ntpdate ? | ||
| + | |||
| + | MAJ | ||
| + | |||
| + | Service KO | ||
| + | |||
| + | Alerte avant l' | ||
| + | |||
| + | /etc/passwd uid 0 | ||
| + | |||
| + | dmesg | ||
| + | |||
| + | Comptes LDAP | ||
