ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ#!/usr/bin/perl ############### # # Check RAID status: # see https://incidencias.irontec.com/view.php?id=39467 # ############### use strict; use Getopt::Long; use Data::Dumper; use Switch; use File::Basename; use vars qw($opt_h); my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); my %SCRIPTS=('software'=>'check_raid','cciss'=>'check_cciss-1.8','megacli'=>'MegaCli64','megasas'=>'check_megaraid_sas'); my $program=basename($0); my $path="/usr/lib64/nagios/plugins/"; my $raid="cciss"; sub print_help () { print " Check RAID status. It executes the check_XXX depends of the raid type passed by argument Usage: $program Options: software: software raid (mdstatus) cciss: HP/Compaq cciss raid megacli: LSI MegaCli raid megasas: Symbios Logic MegaRAID SAS none: no raid -h, --help Show this help "; } sub usage { my $format=shift; printf($format,@_); exit $ERRORS{'UNKNOWN'}; } sub detect_raid { my $raid_detect = "none"; open (LSPCI, "/usr/bin/lspci |"); while (){ if (/RAID/){ if (/Hewlett-Packard Company Smart Array/ or /Compaq Computer Corporation Smart Array 64/ or /RAID bus controller: Hewlett-Packard Company Device/){ $raid_detect = "cciss"; } elsif (/Symbios Logic MegaRAID SAS/){ $raid_detect = "megasas"; } else { $raid_detect = "unknown"; } } } if (-e "/proc/mdstat"){ $raid_detect = "software"; } return $raid_detect; } Getopt::Long::Configure('bundling'); GetOptions ("h" => \$opt_h,); if ($opt_h or @ARGV > 1) { print_help(); exit $ERRORS{'OK'}; } if (@ARGV) { $raid=@ARGV[0]; } else { $raid=detect_raid(); } switch ($raid) { case "none" { print "NO tiene raid\n"; exit $ERRORS{'OK'}; } case "unknown" { print "Unknown raid ¿?\n"; exit $ERRORS{'WARNING'}; } else { #there's raid, we execute the check for the raid print "RAID: $raid ; "; exec("$path$SCRIPTS{$raid}"); } }