From 6f533c756c933c84a94f19f5c9d011b26b3c133f Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Mon, 22 Aug 2011 16:07:54 +0000 Subject: [PATCH] Bugfix, whitespace in eva system name fixed by Martin Hauke --- .../trunk/check_emc_clariion.pl | 34 ++++++++++++++++--- check_eva/trunk/check_eva.py | 4 +-- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/check_emc_clariion/trunk/check_emc_clariion.pl b/check_emc_clariion/trunk/check_emc_clariion.pl index 4f29f99..f74b4e3 100644 --- a/check_emc_clariion/trunk/check_emc_clariion.pl +++ b/check_emc_clariion/trunk/check_emc_clariion.pl @@ -31,7 +31,9 @@ use Pod::Usage; # predeclared subs use subs qw/print_help check_sp check_disk check_portstate check_hbastate check_cache check_faults/; - +my $opt_sp=""; +my $missing_bus=""; +my $missing_enclosure=""; # predeclared vars use vars qw ( $PROGNAME @@ -68,6 +70,15 @@ $opt_port=-1; my $secure; $secure=0; +# timeout in seconds for calls to navi(sec)cli +my $clitimeout; +$clitimeout=18; + +$SIG{ALRM} = sub { + print "CLI call timeout"; + exit 3; +}; + # Main values $PROGNAME = basename($0); $VERSION = '1.0'; @@ -119,6 +130,7 @@ if ( $opt_user && $opt_password ) { # Check if all needed options present. if ( $opt_host && $opt_checktype ) { # do the work + alarm($clitimeout); if ($opt_checktype eq "sp" && $opt_sp ne "") { check_sp(); } @@ -137,6 +149,7 @@ if ( $opt_host && $opt_checktype ) { if ($opt_checktype eq "hbastate" && $opt_pathcount ne "" && $opt_node ne "") { check_hbastate(); } + alarm(0); print_help(1, 'Wrong parameters specified!'); } else { @@ -173,20 +186,31 @@ sub check_sp { $error_count++; } } + # check for a missing enclosure + #if( $_ =~ m/.*Bus\s\(\d\)\sEnclosure\s\(\d\d\)\s:\sMissi.*/ ){ + #(Bus 2 Enclosure 3 : Missing) + if( $_ =~ m/Bus\s(\d+)\sEnclosure\s(\d+)\s:\sMissing/ ){ + my $missing_bus = $1; + my $missing_enclosure = $2; + #print "Missing enclosure at $missing_bus $missing_enclosure!\n"; + } # check for Enclosure lines - if( $_ =~ m/Enclosure\s(\d+|\w+)\s(\w+)\s$opt_sp\d?\s\w+:\s+(.*)/) { + if( $_ =~ m/Enclosure\s(\d+|\w+)\s(\w+)\s$opt_sp\d?\s(\w+):\s+(.*)/) { my $check = $2; - if ($3 =~ m/Removed|\d+.\d+|Present|Valid|N\/A|255.255/) { + if ($3 =~ m/Revision/ or $4 =~ m/Removed/) { } + elsif ($4 =~ m/Present|Valid|N\/A|255.255/) { $output .= "$check ok,"; } else { + print "check: $check $3 $4 \n"; $output .= "$check failed,"; $error_count++; } } # check for Cabling lines - if( $_ =~ m/Enclosure\s(\d+|\w+)\s\w+\s$opt_sp\s(\w+)\s\w+:\s+(.*)/) { + + if( $_ =~ m/Enclosure\s(\d+|\w+)\s\w+\s$opt_sp\s(\w+)\s(\w+):\s+(.*)/) { my $check = $2; - if ($3 =~ m/Present|Valid|N\/A|255.255/) { + if ($4 =~ m/Removed|Present|Valid|N\/A|255.255/) { $output .= "$check ok,"; } else { $output .= "$check failed,"; diff --git a/check_eva/trunk/check_eva.py b/check_eva/trunk/check_eva.py index f8209b9..0d87c26 100644 --- a/check_eva/trunk/check_eva.py +++ b/check_eva/trunk/check_eva.py @@ -203,11 +203,11 @@ def run_sssu(system=None, command="ls system full"): commands.append(continue_on_error) commands.append(login) if system != None: - commands.append("select SYSTEM %s" % system) + commands.append('select SYSTEM "%s"' % system) commands.append(command) commandstring = "sssu " - for i in commands: commandstring = commandstring + '"%s" '% i + for i in commands: commandstring = commandstring + "'%s' " % i global server_side_troubleshooting if server_side_troubleshooting == True: commandstring = 'cat "debug/%s"' % command