Skip to content

Commit

Permalink
Add the node_reboot_required metric to yum.sh (#165)
Browse files Browse the repository at this point in the history
Added the node_reboot_required metric to yum.sh, based on PR #70,
with the requested changes incorporated in the code

Signed-off-by: Arnaud Vazard <vaz-git@gmx.com>
  • Loading branch information
vaz-ar committed Jun 29, 2023
1 parent 5781348 commit 34dd42e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion yum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Description: Expose metrics from yum updates.
#
# Author: Slawomir Gonet <slawek@otwiera.cz>
#
#
# Based on apt.sh by Ben Kochie <superq@gmail.com>

set -u -o pipefail
Expand Down Expand Up @@ -37,3 +37,14 @@ if [[ -n "${upgrades}" ]] ; then
else
echo 'yum_upgrades_pending{origin=""} 0'
fi

# If yum-utils/dnf-utils is not installed then we skip rendering this metric
if [[ -x /bin/needs-restarting ]] ; then
echo '# HELP node_reboot_required Node reboot is required for software updates.'
echo '# TYPE node_reboot_required gauge'
if /bin/needs-restarting -r > /dev/null 2>&1 ; then
echo 'node_reboot_required 0'
else
echo 'node_reboot_required 1'
fi
fi

0 comments on commit 34dd42e

Please sign in to comment.