Skip to content
Snippets Groups Projects
Verified Commit 3c2f218a authored by me5na7qbjqbrp's avatar me5na7qbjqbrp
Browse files

Warn when autoremove is possible

parent feadda6f
No related branches found
No related tags found
Loading
......@@ -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'
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment