-
-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Describe the solution you'd like
Hello together,
In addition to the deb-lastactivity plugin I would be pleased if the monitoring plugins could introduce a plugin apt/apt-get which could inform about pending updates like the check_apt plugin provided by the Debian Nagios Maintainer Group does.
The check provided by them can optionally do an apt-get update to refresh the apt cache.
It returns a list with upgradable packages, marking packages from Debian's or Ubuntu's security repos with "(security)", looking a bit like this:
APT CRITICAL: 3 packages available for dist-upgrade (1 critical updates).
runc (security)
php8.3-common
php8.3-mysql
Given there is a Python API for APT provided by the APT Developers (maintained here: python-apt, documented there) I thought it might be a good idea to use it instead of wildly regexing command line calls. So I started playing around.
The API might be counterintuitive and the resulting script is not really fast (could be caused by my implementation using all the apt caches) but I managed to create something myself resembling the original a bit. What do you think?
Kind regards
Christian
Additional context
Work in progress, currently missing tests: https://github.com/mrmolybdaen/monitoring-plugins/tree/check_apt/check-plugins/apt-get