Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[yum.sh] Explicitly disable "running kernel"-check #232

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

svalouch
Copy link
Contributor

On my OracleLinux 8 and 9 machines, I get unexpected output when a kernel update has been installed but the node has not yet rebooted to run the new kernel. The issue is that "autocheck_running_kernel" is enabled on these machines, and it causes yum/dnf to output things the script doesn't expect. The setting may not be enabled on other systems, but it seems like a sane solution to disable it to force a consistent behaviour regardless of the system-wide settings.

The problem shows itself like this:

# ./yum.sh
# HELP yum_upgrades_pending Yum package pending updates by origin.
# TYPE yum_upgrades_pending gauge
yum_upgrades_pending{origin="is"} 1
yum_upgrades_pending{origin="kernel-core-4.18.0-553.33.1.el8_10.x86_64"} 1
# HELP node_reboot_required Node reboot is required for software updates.
# TYPE node_reboot_required gauge
node_reboot_required 1

This is because the output is as follows (forcing the setting on to make reproduction easier):

# yum -q --setopt=autocheck_running_kernel=1 check-update
Security: kernel-core-4.18.0-553.34.1.el8_10.x86_64 is an installed security update
Security: kernel-core-4.18.0-553.33.1.el8_10.x86_64 is the currently running version

With this commit applied, the collector script works as desired:

# HELP yum_upgrades_pending Yum package pending updates by origin.
# TYPE yum_upgrades_pending gauge
yum_upgrades_pending{origin=""} 0
# HELP node_reboot_required Node reboot is required for software updates.
# TYPE node_reboot_required gauge
node_reboot_required 1

Tested on OracleLinux 8 and 9.

@svalouch svalouch force-pushed the master branch 2 times, most recently from 715568c to f0cb8c3 Compare January 16, 2025 13:36
On my OracleLinux 8 and 9 machines, I get unexpected output when a
kernel update has been installed but the node has not yet rebooted to
run the new kernel. The issue is that "autocheck_running_kernel" is
enabled on these machines, and it causes yum/dnf to output things the
script doesn't expect. The setting may not be enabled on other systems,
but it seems like a sane solution to disable it to force a consistent
behaviour regardless of the system-wide settings.

The problem shows itself like this:

 # ./yum.sh
 # HELP yum_upgrades_pending Yum package pending updates by origin.
 # TYPE yum_upgrades_pending gauge
 yum_upgrades_pending{origin="is"} 1
 yum_upgrades_pending{origin="kernel-core-4.18.0-553.33.1.el8_10.x86_64"} 1
 # HELP node_reboot_required Node reboot is required for software updates.
 # TYPE node_reboot_required gauge
 node_reboot_required 1

This is because the output is as follows (forcing the setting on to make
reproduction easier):

 # yum -q --setopt=autocheck_running_kernel=1 check-update
 Security: kernel-core-4.18.0-553.34.1.el8_10.x86_64 is an installed security update
 Security: kernel-core-4.18.0-553.33.1.el8_10.x86_64 is the currently running version

With this commit applied, the collector script works as desired:

 # HELP yum_upgrades_pending Yum package pending updates by origin.
 # TYPE yum_upgrades_pending gauge
 yum_upgrades_pending{origin=""} 0
 # HELP node_reboot_required Node reboot is required for software updates.
 # TYPE node_reboot_required gauge
 node_reboot_required 1

Tested on OracleLinux 8 and 9.

Signed-off-by: svalouch <[email protected]>
@dswarbrick
Copy link
Member

Nice analysis. Thanks for the fix.

@dswarbrick dswarbrick merged commit b36a2ea into prometheus-community:master Jan 16, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants