obsolete packages: move collector command first authored by lelutin's avatar lelutin
This section is a playbook so it's mean to be used when there's an alert
firing. So in that context, we're better off testing things that get a
result closer to what the alert is telling us.

The other commands are still very useful but they might catch details
that the alert is not considering.
...@@ -199,20 +199,20 @@ might be: ...@@ -199,20 +199,20 @@ might be:
* apt source got removed but not packages installed from it * apt source got removed but not packages installed from it
* patched package was installed locally * patched package was installed locally
If you want to know which packages are marked as obsolete, you can use the If you want to know which packages are marked as obsolete and is triggering the
following two commands: alert, you can call the command that exports the metrics for the `apt_info`
collector to get more information:
apt list "?obsolete" DEBUG=1 /usr/share/prometheus-node-exporter-collectors/apt_info.py >/dev/null
apt list "?narrow(?installed, ?not(?codename($(lsb_release -c -s | tail -1))))"
The authoritative source for the alert, however, is the `apt_info` You can also use the following two commands to get more details on packages:
collector, which might differ from the above:
DEBUG=1 /usr/share/prometheus-node-exporter-collectors/apt_info.py >/dev/null apt list "?obsolete"
apt list "?narrow(?installed, ?not(?codename($(lsb_release -c -s | tail -1))))"
Check the state of each package with `apt policy $package` to determine what Check the state of each package with `apt policy $package` to determine what
needs to be done with it. If most cases, the packages can just be purged, but needs to be done with it. If most cases, the packages can just be purged, but
maybe not if they are obsolete because an apt source was lost. maybe not if they are obsolete because an apt source was lost.
In that latter case, you may want to check out why the source was In that latter case, you may want to check out why the source was
removed and make sure to bring it back. Sometimes it means downgrading removed and make sure to bring it back. Sometimes it means downgrading
... ...
......