diff options
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 )  | 
