Warn when autoremove is possible

certbot_on_virtu
Alexandre Iooss 2020-01-19 18:39:29 +01:00
parent feadda6fac
commit 3c2f218a2f
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 10 additions and 6 deletions

View File

@ -16,7 +16,7 @@ upgrades="$(/usr/bin/apt-get --just-print dist-upgrade \
)"
autoremove="$(/usr/bin/apt-get --just-print autoremove \
| /usr/bin/awk '/^Remv/{a++}END{print "apt_autoremove_pending " a}'
| /usr/bin/awk '/^Remv/{a++}END{printf "apt_autoremove_pending %d", a}'
)"
echo '# HELP apt_upgrades_pending Apt package pending updates by origin.'
@ -29,11 +29,7 @@ fi
echo '# HELP apt_autoremove_pending Apt package pending autoremove.'
echo '# TYPE apt_autoremove_pending gauge'
if [[ -n "${autoremove}" ]] ; then
echo "${autoremove}"
else
echo 'apt_autoremove_pending 0'
fi
echo "${autoremove}"
echo '# HELP node_reboot_required Node reboot is required for software updates.'
echo '# TYPE node_reboot_required gauge'

View File

@ -142,6 +142,14 @@ groups:
summary: "La tension de sortie de {{ $labels.instance }} est de {{ $value }}V."
description: "https://grafana.crans.org/d/qtbg59mZz/alimentation"
- alert: AptAutoremovePending
expr: apt_autoremove_pending > 0
for: 5m
labels:
severity: warning
annotations:
summary: "{{ $value }} paquet(s) APT sont inutile(s) sur {{ $labels.instance }}."
# NTP (need NTP plugin in node)
# - alert: ntp_drifting
# expr: node_ntp_drift_seconds > 0.05