diff options
author | Andreas B. Mundt <andi.mundt@web.de> | 2011-06-16 19:29:27 +0000 |
---|---|---|
committer | Andreas B. Mundt <andi.mundt@web.de> | 2011-06-16 19:29:27 +0000 |
commit | 542f2d93293f07865c9ea8ce509376cba1a20a22 (patch) | |
tree | c119f104056c87d291e294ba58008269dbcfe48f /nagios-plugins/check_kernel_status | |
parent | 23b5d6fd101027b32cd827863984e74febdf2c1f (diff) | |
download | sitesummary-542f2d93293f07865c9ea8ce509376cba1a20a22.tar.gz sitesummary-542f2d93293f07865c9ea8ce509376cba1a20a22.tar.bz2 sitesummary-542f2d93293f07865c9ea8ce509376cba1a20a22.tar.xz |
Add '-w' and 'use strict;' to nagios-plugins/check_kernel_status.
Modify code to get rid of warnings (i.e. add 'my'). This seems to
help nagios' embedded perl interpreter to run the script after
Diffstat (limited to 'nagios-plugins/check_kernel_status')
-rwxr-xr-x | nagios-plugins/check_kernel_status | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/nagios-plugins/check_kernel_status b/nagios-plugins/check_kernel_status index 6e972e6..bee9dfe 100755 --- a/nagios-plugins/check_kernel_status +++ b/nagios-plugins/check_kernel_status @@ -6,11 +6,17 @@ # Downloaded from # http://www.monitoringexchange.org/attachment/download/Check-Plugins/Operating-Systems/Linux/Running-kernel-compared-to-installed-kernel-version/check_kernel_status +use strict; + my $OK = 0; my $WARN = 1; my $CRIT = 2; my $UNKN = 3; +my $sig; +my @running_version; +my @installed_version; + # First, find the current running kernel version if ( -e '/proc/version_signature' ) { @@ -53,10 +59,10 @@ else # Next, find the installed kernel version # Yes, as you can see, it is limited to 2.6 kernels here. # But I assume that you don't need reboots anymore when this major version has passed. -$dpkg_list = `dpkg -l | grep linux-image-2.6`; +my $dpkg_list = `dpkg -l | grep linux-image-2.6`; chomp($dpkg_list); -@dpkg_lines = split("\n", $dpkg_list); -$dpkg = pop(@dpkg_lines); +my @dpkg_lines = split("\n", $dpkg_list); +my $dpkg = pop(@dpkg_lines); # Now, which OS is it, and which footprint do they use? if ( $dpkg =~ /(\d+)\.(\d+)\.(\d+)-(\d+)\.(\d+)/ ) @@ -101,11 +107,11 @@ else } # Calculate sums for easy comparison -$running_version_sum = sprintf("%02d%02d%02d%02d%02d%02d", @running_version); -$installed_version_sum = sprintf("%02d%02d%02d%02d%02d%02d", @installed_version); +my $running_version_sum = sprintf("%02d%02d%02d%02d%02d%02d", @running_version); +my $installed_version_sum = sprintf("%02d%02d%02d%02d%02d%02d", @installed_version); # And some readable format -$print_running_version = sprintf("%d.%d.%d-%d.%d.%d", @running_version); -$print_installed_version = sprintf("%d.%d.%d-%d.%d.%d", @installed_version); +my $print_running_version = sprintf("%d.%d.%d-%d.%d.%d", @running_version); +my $print_installed_version = sprintf("%d.%d.%d-%d.%d.%d", @installed_version); # Do we need a reboot? if ( $running_version_sum < $installed_version_sum ) |