NAME
Monitoring::Sneck::Checks::reboot_needed - checks if a reboot or restarts are needed after updates
VERSION
Version 0.0.1
SYNOPSIS
reboot|perl:reboot_needed
restarts|perl:reboot_needed -l
DESCRIPTION
WARNING, or CRITICAL with --critical, if updates are waiting on a reboot.
On Linux, that is any of...
- /var/run/reboot-required :: Is there, as Debian and Ubuntu packages leave it. What it says and the packages in reboot-required.pkgs are added.
- a newer kernel :: Is installed than the one running, going by the /boot/vmlinuz-* and /lib/modules/*/vmlinuz there are.
- the kernel package :: For Debian, the version of the installed linux-image package for the running kernel is not the one running, as for a update that kept the same ABI, and so the same release.
On FreeBSD, it is freebsd-version -k, the installed kernel, not being freebsd-version -r, the one running. Other OSes are UNKNOWN.
With --libraries, on Linux, processes using libraries that were since replaced are listed as well, as they need restarting to use the new ones, the same as needrestart finds. This reads /proc/*/maps, so needs root to see every process. On FreeBSD it does nothing.
OPTIONS
- -l, --libraries :: Also list processes using replaced libraries. Linux only.
- -n, --lines :: How many processes using replaced libraries to list. Default :: 20
- -c, --critical :: Make it CRITICAL in place of WARNING.
METHODS
check
Does the check.
release
Returns the release of the running kernel, as uname -r says.
linux_reasons
Returns the reasons Linux needs a reboot, as said under "DESCRIPTION", adding a line listing the packages in reboot-required.pkgs to the array ref given.
dpkg_version
Returns the version of a installed package from dpkg's status file, or undef if it is not installed.
my $version = $check->dpkg_version('linux-image-6.12.48+deb13-amd64');
replaced_libraries
Returns a reason if processes use libraries that were replaced, adding a line for each process to the array ref given, with the libraries it uses, up to --lines of them.
freebsd_reasons
Returns the reasons FreeBSD needs a reboot, as said under "DESCRIPTION".