### DOKU ### =pod LOGICAL UNIT NUMBER 7 Name: POOL_0_VMVOL_07 Current State: Ready Und hier stehe ich an, ich muss den Code so anpassen, das der mir für Nagios den Output wie folgt generiert: Name: POOL_0_VMVOL_07, State: Ready Wenn State nicht Ready ist, dann warning! =cut ### /DOKU ### sub check_lun_info { open( NAVICLIOUT, "$NAVICLI_CMD -h $opt_host lun -list -state |" ); my $sp_line = 0; my $error_count = 0; my %out = (); my $warn = 0; while () { # First lets check for errors before proceeding check_for_errors($_); if (/(LOGICAL UNIT NUMBER)\s+(\d+)/) { #$out{lun}="$1 $2"; $out{lun}="$2"; next; } if (/(Name:)\s+(\w+)/) { #$out{name} = "$1 $2"; $out{name} = "$2"; next; } if (/(Current State:)\s+(\w+)/) { #$out{state} = "$1 $2"; $out{state} = "$2"; $warn = uc $out{state} ne 'READY'; ++$error_count if $warn; next; } if (defined $out{state} and defined $out{lun} and defined $out{name}) { $output .= "$out{name}:$out{state},"; %out = (); next; } } close (NAVICLIOUT); if ($error_count == 0 && $output ne "") { $state = 'OK'; } elsif ($output eq "") { $output = "UNKNOWN: No output from $NAVICLI"; $state = 'UNKNOWN'; } else { if ($warn) { $state = 'WARNING'; } else { $state = 'CRITICAL'; } } $output =~ s/,$//; print $output."\n"; exit $states{$state}; }