| 151 | 
           rodolico | 
           1 | 
           #! /usr/bin/env perl
  | 
        
        
            | 
            | 
           2 | 
              | 
        
        
            | 
            | 
           3 | 
           use warnings;
  | 
        
        
            | 
            | 
           4 | 
           use strict;
  | 
        
        
            | 
            | 
           5 | 
              | 
        
        
            | 
            | 
           6 | 
           my $runDirectory = 'C:/Program Files (x86)/Online Diagnostics/oldiags/bin/';
  | 
        
        
            | 
            | 
           7 | 
           my $command = 'pediags.exe sasdevdiag --show device';
  | 
        
        
            | 
            | 
           8 | 
              | 
        
        
            | 
            | 
           9 | 
           chdir ( $runDirectory );
  | 
        
        
            | 
            | 
           10 | 
           my $output = `$command`;
  | 
        
        
            | 
            | 
           11 | 
              | 
        
        
            | 
            | 
           12 | 
           my @output = split( /[\r\n]/, $output );
  | 
        
        
            | 
            | 
           13 | 
              | 
        
        
            | 
            | 
           14 | 
           #print $output;
  | 
        
        
            | 
            | 
           15 | 
              | 
        
        
            | 
            | 
           16 | 
           my $currentDevice;
  | 
        
        
            | 
            | 
           17 | 
           my $currentStatus;
  | 
        
        
            | 
            | 
           18 | 
              | 
        
        
            | 
            | 
           19 | 
           my %outputInformation;
  | 
        
        
            | 
            | 
           20 | 
              | 
        
        
            | 
            | 
           21 | 
              | 
        
        
            | 
            | 
           22 | 
           for ( my $i = 0; $i < @output; $i++ ) {
  | 
        
        
            | 
            | 
           23 | 
           	next if $output[$i] =~ m/^\s*$/;
  | 
        
        
            | 
            | 
           24 | 
           	my ( $tag,$value ) = split( ' : ', $output[$i] );
  | 
        
        
            | 
            | 
           25 | 
           	$tag =~ s/\s+$//;
  | 
        
        
            | 
            | 
           26 | 
           	$value =~ s/^\s+//;
  | 
        
        
            | 
            | 
           27 | 
           	#print "[$tag]\n"; print "$value\n"; die;
  | 
        
        
            | 
            | 
           28 | 
           	if ( $tag eq 'Device Index' ) {
  | 
        
        
            | 
            | 
           29 | 
           		$currentDevice = $value;
  | 
        
        
            | 
            | 
           30 | 
           		#print "CurrentDevice is $currentDevice\n";
  | 
        
        
            | 
            | 
           31 | 
           	} else {
  | 
        
        
            | 
            | 
           32 | 
           		$outputInformation{$currentDevice}{$tag} = $value;
  | 
        
        
            | 
            | 
           33 | 
           	}
  | 
        
        
            | 
            | 
           34 | 
           }
  | 
        
        
            | 
            | 
           35 | 
              | 
        
        
            | 
            | 
           36 | 
              | 
        
        
            | 
            | 
           37 | 
           foreach my $device ( sort keys %outputInformation ) {
  | 
        
        
            | 
            | 
           38 | 
           	if ( $outputInformation{$device}{'Device Class'} eq 'RAID Array Disk' )  {
  | 
        
        
            | 
            | 
           39 | 
           		if ( $outputInformation{$device}{'Device Status'} eq 'Device is working properly.' ) {
  | 
        
        
            | 
            | 
           40 | 
           			print "Device $device [$outputInformation{$device}{'Device Name'}] is working properly\n";
  | 
        
        
            | 
            | 
           41 | 
           		}
  | 
        
        
            | 
            | 
           42 | 
           	}
  | 
        
        
            | 
            | 
           43 | 
           }
  | 
        
        
            | 
            | 
           44 | 
           <>;
  | 
        
        
            | 
            | 
           45 | 
              | 
        
        
            | 
            | 
           46 | 
           #foreach my $device ( sort keys %outputInformation ) {
  | 
        
        
            | 
            | 
           47 | 
           #	print "Device $device\n";
  | 
        
        
            | 
            | 
           48 | 
           #	my $temp = $outputInformation{$device};
  | 
        
        
            | 
            | 
           49 | 
           #	foreach my $tag ( sort keys %$temp ) {
  | 
        
        
            | 
            | 
           50 | 
           #		print "\t$tag\t$temp->{$tag}\n";
  | 
        
        
            | 
            | 
           51 | 
           #	}
  | 
        
        
            | 
            | 
           52 | 
           #}
  | 
        
        
            | 
            | 
           53 | 
              | 
        
        
            | 
            | 
           54 | 
           1;
  |