aboutsummaryrefslogtreecommitdiffstats
path: root/nagios-plugins/check_kernel_status
diff options
context:
space:
mode:
Diffstat (limited to 'nagios-plugins/check_kernel_status')
-rwxr-xr-xnagios-plugins/check_kernel_status17
1 files changed, 10 insertions, 7 deletions
diff --git a/nagios-plugins/check_kernel_status b/nagios-plugins/check_kernel_status
index cd1c96d..59bbc49 100755
--- a/nagios-plugins/check_kernel_status
+++ b/nagios-plugins/check_kernel_status
@@ -58,12 +58,15 @@ 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.
-my $dpkg_list = `dpkg -l | grep linux-image-2.6`;
-chomp($dpkg_list);
-my @dpkg_lines = split("\n", $dpkg_list);
-my $dpkg = pop(@dpkg_lines);
+# Yes, as you can see, it is limited to 2.6 and 3.0 kernels here.
+# But I assume that you don't need reboots anymore when this major
+# version has passed.
+my $dpkg_list = `COLUMNS=1024 dpkg -l`;
+my $dpkg;
+for my $line (split("\n", $dpkg_list)) {
+ chomp $line;
+ $dpkg = $line if ($line =~ m/^ii.+linux-image-(2.6|3.0)/);
+}
# Now, which OS is it, and which footprint do they use?
if ( $dpkg =~ /(\d+)\.(\d+)\.(\d+)-(\d+)\.(\d+)/ )
@@ -103,7 +106,7 @@ elsif ( $dpkg =~ / (\d+)\.(\d+)\.(\d+)-(\d+)/ )
}
else
{
- print "UNKNOWN - Could not determine installed version.\n";
+ print "UNKNOWN - Could not determine installed version ($dpkg).\n";
exit $UNKN;
}