Subversion Repositories camp_sysinfo_client_3

Rev

Rev 151 | Rev 244 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#! /usr/bin/env perl

use warnings;
use strict;

my $runDirectory = 'C:/Program Files (x86)/Online Diagnostics/oldiags/bin/';
my $command = 'pediags.exe sasdevdiag --show device';

chdir ( $runDirectory );
my $output = `$command`;

my @output = split( /[\r\n]/, $output );

#print $output;

my $currentDevice;
my $currentStatus;

my %outputInformation;


for ( my $i = 0; $i < @output; $i++ ) {
        next if $output[$i] =~ m/^\s*$/;
        my ( $tag,$value ) = split( ' : ', $output[$i] );
        $tag =~ s/\s+$//;
        $value =~ s/^\s+//;
        #print "[$tag]\n"; print "$value\n"; die;
        if ( $tag eq 'Device Index' ) {
                $currentDevice = $value;
                #print "CurrentDevice is $currentDevice\n";
        } else {
                $outputInformation{$currentDevice}{$tag} = $value;
        }
}


foreach my $device ( sort keys %outputInformation ) {
        if ( $outputInformation{$device}{'Device Class'} eq 'RAID Array Disk' )  {
                if ( $outputInformation{$device}{'Device Status'} eq 'Device is working properly.' ) {
                        print "Device $device [$outputInformation{$device}{'Device Name'}] is working properly\n";
                }
        }
}
<>;

#foreach my $device ( sort keys %outputInformation ) {
#       print "Device $device\n";
#       my $temp = $outputInformation{$device};
#       foreach my $tag ( sort keys %$temp ) {
#               print "\t$tag\t$temp->{$tag}\n";
#       }
#}

1;