Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
rafamiga
byrafamiga, August 4, 2013
Here's the patch for SATA drives within the array [found on IBM x3630 M3 server]
--- check_smart.pl.orig 2013-08-05 12:54:09.409283146 +0200
+++ check_smart.pl 2013-08-05 12:57:24.580906887 +0200
@@ -7,7 +7,13 @@
# Changes and Modifications
# =========================
# Feb 3, 2009: Kurt Yoder - initial version of script 1.0
-# Jan 27, 2010: Philippe Genonceaux - modifications for compatibility with megaraid, use smartmontool version >= 5.39
+# Jan 27, 2010: Philippe Genonceaux - modifications for compatibility with
+# megaraid, use smartmontool version >= 5.39
+# Aug 5, 2013: Rafal Frühling - added --parse-as-ata switch to enable
+# checking of megaraid-compatible array drives which are SATA and
+# report ATA-like status [found on IBM x3630 M3 server with LSI Logic
+# / Symbios Logic MegaRAID SAS 2108 Liberator controller]
+#
# Add this line to /etc/sudoers: "nagios ALL=(root) NOPASSWD: /usr/sbin/smartctl"
use strict;
@@ -25,7 +31,7 @@
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
-use vars qw($opt_d $opt_debug $opt_h $opt_i $opt_n $opt_v);
+use vars qw($opt_d $opt_debug $opt_h $opt_i $opt_n $opt_v $opt_force_ata);
Getopt::Long::Configure('bundling');
GetOptions(
"debug" => \$opt_debug,
@@ -34,6 +40,7 @@
"i=s" => \$opt_i, "interface=s" => \$opt_i,
"n=s" => \$opt_n, "number=s" => \$opt_n,
"v" => \$opt_v, "version" => \$opt_v,
+ "parse-as-ata" => \$opt_force_ata,
);
if ($opt_v) {
@@ -107,7 +114,7 @@
my $line_str = 'SMART overall-health self-assessment test result: '; # ATA SMART line
my $ok_str = 'PASSED'; # ATA SMART OK string
-if ($interface eq 'megaraid'.",".$number or 'scsi'){
+if (!$opt_force_ata && ($interface eq 'megaraid'.",".$number or 'scsi')){
$line_str = 'SMART Health Status: '; # SCSI OR MEGARAID SMART line
$ok_str = 'OK'; #SCSI OR MEGARAID SMART OK string
}
@@ -202,7 +209,7 @@
my @perfdata = qw//;
# separate metric-gathering and output analysis for ATA vs SCSI SMART output
-if ($interface eq 'ata'){
+if ($interface eq 'ata' || $opt_force_ata){
foreach my $line(@output){
# get lines that look like this:
# 9 Power_On_Minutes 0x0032 241 241 000 Old_age Always - 113h+12m
--- check_smart.pl.orig 2013-08-05 12:54:09.409283146 +0200
+++ check_smart.pl 2013-08-05 12:57:24.580906887 +0200
@@ -7,7 +7,13 @@
# Changes and Modifications
# =========================
# Feb 3, 2009: Kurt Yoder - initial version of script 1.0
-# Jan 27, 2010: Philippe Genonceaux - modifications for compatibility with megaraid, use smartmontool version >= 5.39
+# Jan 27, 2010: Philippe Genonceaux - modifications for compatibility with
+# megaraid, use smartmontool version >= 5.39
+# Aug 5, 2013: Rafal Frühling - added --parse-as-ata switch to enable
+# checking of megaraid-compatible array drives which are SATA and
+# report ATA-like status [found on IBM x3630 M3 server with LSI Logic
+# / Symbios Logic MegaRAID SAS 2108 Liberator controller]
+#
# Add this line to /etc/sudoers: "nagios ALL=(root) NOPASSWD: /usr/sbin/smartctl"
use strict;
@@ -25,7 +31,7 @@
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
-use vars qw($opt_d $opt_debug $opt_h $opt_i $opt_n $opt_v);
+use vars qw($opt_d $opt_debug $opt_h $opt_i $opt_n $opt_v $opt_force_ata);
Getopt::Long::Configure('bundling');
GetOptions(
"debug" => \$opt_debug,
@@ -34,6 +40,7 @@
"i=s" => \$opt_i, "interface=s" => \$opt_i,
"n=s" => \$opt_n, "number=s" => \$opt_n,
"v" => \$opt_v, "version" => \$opt_v,
+ "parse-as-ata" => \$opt_force_ata,
);
if ($opt_v) {
@@ -107,7 +114,7 @@
my $line_str = 'SMART overall-health self-assessment test result: '; # ATA SMART line
my $ok_str = 'PASSED'; # ATA SMART OK string
-if ($interface eq 'megaraid'.",".$number or 'scsi'){
+if (!$opt_force_ata && ($interface eq 'megaraid'.",".$number or 'scsi')){
$line_str = 'SMART Health Status: '; # SCSI OR MEGARAID SMART line
$ok_str = 'OK'; #SCSI OR MEGARAID SMART OK string
}
@@ -202,7 +209,7 @@
my @perfdata = qw//;
# separate metric-gathering and output analysis for ATA vs SCSI SMART output
-if ($interface eq 'ata'){
+if ($interface eq 'ata' || $opt_force_ata){
foreach my $line(@output){
# get lines that look like this:
# 9 Power_On_Minutes 0x0032 241 241 000 Old_age Always - 113h+12m
byrafamiga, December 23, 2012