Public bug reported:
1) Ubuntu version
```
$ lsb_release -rd
No LSB modules are available.
Description: Ubuntu 24.04.1 LTS
Release: 24.04
```
2) Package version
```
$ apt-cache policy prometheus-node-exporter-collectors
prometheus-node-exporter-collectors:
Installed: 0.0~git20231018.f5c56e7-1
Candidate: 0.0~git20231018.f5c56e7-1
...
```
3) Expectation
The systemd service prometheus-node-exporter-apt.service bundled with
prometheus-node-exporter-collectors, is responsible for producing the
file /var/lib/prometheus/node-exporter/apt.prom containing Prometheus-
compatible metrics labels.
I expect that metrics with the label `apt_upgrades_pending` are
regularly included and updated in the file /var/lib/prometheus/node-
exporter/apt.prom.
These metrics are used in a monitoring system to track pending upgrades,
including security updates.
On Ubuntu 22.04, the service prometheus-node-exporter-apt.service
produces the expected output:
```
$ apt-cache policy prometheus-node-exporter-collectors
prometheus-node-exporter-collectors:
Installed: 0+git20211024.8eeeffb-1
Candidate: 0+git20211024.8eeeffb-1
...
$ sudo systemctl start prometheus-node-exporter-apt.service
$ cat /var/lib/prometheus/node-exporter/apt.prom
# HELP apt_upgrades_pending Apt package pending updates by origin.
# TYPE apt_upgrades_pending gauge
apt_upgrades_pending{origin="Ubuntu:22.04/jammy-updates,Ubuntu:22.04/jammy-security",arch="amd64"}
1
# HELP apt_autoremove_pending Apt package pending autoremove.
# TYPE apt_autoremove_pending gauge
apt_autoremove_pending 0
# HELP node_reboot_required Node reboot is required for software updates.
# TYPE node_reboot_required gauge
node_reboot_required 0
```
4) Reality
On Ubuntu 24.04, the `apt_upgrades_pending` metrics are unexpectedly
missing.
The following output demonstrates this even though apt upgrades are
available.
```
$ apt list --upgradable
Listing... Done
snapd/noble-updates 2.65.3+24.04 amd64 [upgradable from: 2.63.1+24.04]
zstd/noble-updates 1.5.5+dfsg2-2build1.1 amd64 [upgradable from:
1.5.5+dfsg2-2build1]
$ sudo systemctl start prometheus-node-exporter-apt.service
$ cat /var/lib/prometheus/node-exporter/apt.prom
# HELP apt_upgrades_held Apt packages pending updates but held back.
# TYPE apt_upgrades_held gauge
apt_upgrades_held{arch="amd64",origin="Ubuntu:noble/noble-updates"} 2.0
# HELP apt_autoremove_pending Apt packages pending autoremoval.
# TYPE apt_autoremove_pending gauge
apt_autoremove_pending 0.0
# HELP apt_package_cache_timestamp_seconds Apt update last run time.
# TYPE apt_package_cache_timestamp_seconds gauge
apt_package_cache_timestamp_seconds 1.729071554331e+09
# HELP node_reboot_required Node reboot is required for software updates.
# TYPE node_reboot_required gauge
node_reboot_required 0.0
```
5) Fix?
There is already a fix available for Ubuntu 24.10:
apt_info.py: fix apt_upgrades_pending and apt_upgrades_held (#207)
https://salsa.debian.org/go-team/packages/prometheus-node-exporter-collectors/-/commit/1cb6223dee0e156569bdf76ab4526358f2687ba6
The fix also seems to work as expected on Ubuntu 24.04.
In the following, I overwrite /usr/share/prometheus-node-exporter-
collectors/apt_info.py with the fixed version and repeat the steps from
before:
```
$ sudo curl -sLfo /usr/share/prometheus-node-exporter-collectors/apt_info.py
https://salsa.debian.org/go-team/packages/prometheus-node-exporter-collectors/-/raw/c446e9d7a590ac4361b0e9e917b0ddf3d204cf50/apt_info.py
$ sudo systemctl start prometheus-node-exporter-apt.service
$ cat /var/lib/prometheus/node-exporter/apt.prom
# HELP apt_upgrades_pending Apt packages pending updates by origin
# TYPE apt_upgrades_pending gauge
apt_upgrades_pending{arch="amd64",origin="Ubuntu:noble/noble-updates"} 2.0
# HELP apt_autoremove_pending Apt packages pending autoremoval.
# TYPE apt_autoremove_pending gauge
apt_autoremove_pending 0.0
# HELP apt_package_cache_timestamp_seconds Apt update last run time.
# TYPE apt_package_cache_timestamp_seconds gauge
apt_package_cache_timestamp_seconds 1.729071554331e+09
# HELP node_reboot_required Node reboot is required for software updates.
# TYPE node_reboot_required gauge
node_reboot_required 0.0
```
I hope this fix, or a similar fix, will be made available on Ubuntu
24.04.
** Affects: prometheus-node-exporter-collectors (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2084665
Title:
On Ubuntu 24.04, pending apt upgrades are no longer included in apt
metrics for prometheus-node-exporter
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/prometheus-node-exporter-collectors/+bug/2084665/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs