in reply to getuptime script

warn ("ERROR for $host: $error\n") unless (defined($session));
should be
unless( $session ){ warn ("ERROR for $host: $error\n") ; next; }
that way if $session is not defined, you warn and then move on to next $host.

Replies are listed 'Best First'.
Re^2: getuptime script
by deepupower123 (Initiate) on Oct 30, 2008 at 14:01 UTC
    Thank you for your reply. My concern is regarding this part of the script.
    if($days == 0) { my $res = `fcping -d`; my @temp_arr = split(" ", $res); my $port = $temp_arr[2]; chomp($temp = `fcping $port`); @TEMP_1 = split("and", $temp); @TEMP_2 = split(" ", $TEMP_1[1]); if($TEMP_2[0] eq "0") { print "Network Issue"; } else { print "Check HBA Status"; } }
    The Code above this part is fine. I'm successful in getting the uptime. I need uptime% and the conditions I've mentioned. Thanks in Advance