%PDF- %PDF-
Server IP : 79.170.40.229 / Your IP : 18.222.105.245 Web Server : Apache System : Linux web230.extendcp.co.uk 4.18.0-513.24.1.el8_9.x86_64 #1 SMP Mon Apr 8 11:23:13 EDT 2024 x86_64 User : 1stforcarhirealicante.com ( 296923) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/sbin/ |
Upload File : |
#!/usr/bin/perl use strict; use warnings; open(SCSIINFO, "/proc/scsi/scsi") or die $!; my $controller_type = ''; while(<SCSIINFO>) { $controller_type='perc56_H700' if (/Model: PERC [56]|Model: PERC H7\d0/); $controller_type='perc4' if /MegaRAID/; $controller_type='sas6' if /Vendor: Dell\s+Model: VIRTUAL DISK/; $controller_type='perc_H200' if /Vendor: Dell\s+Model: Virtual Disk/; } close(SCSIINFO); my $optimal = 1; if( $controller_type eq 'perc56_H700' ) { # PERC 5/6 tests open(CLIOUTPUT, "-|", "/usr/sbin/MegaCli -CfgDsply -a0 -NoLog") or die $!; while(<CLIOUTPUT>) { chomp; if( /^State\s*: (.+)/ ) { $optimal = 0 if $1 ne "Optimal"; } if( /^Current Cache Policy\s*: (.+?),/ ) { $optimal = 0 if $1 ne "WriteBack"; } } close(CLIOUTPUT) or warn $!; } elsif( $controller_type eq 'perc4' ) { # MegaRAID (PERC 4) tests # This is more complicated as we need to make sure that /dev/megadev0 under the correct major device id. # This can be determined from /proc/devices unless( -c "/dev/megadev0" ) { # We need to create the character special device my $major_device_id; open(PROCDEV, "<", "/proc/devices") or die $!; while(<PROCDEV>) { $major_device_id = $1 if /(\d+) megadev/; } close(PROCDEV) or die $!; die "Failed to determine major device id" unless $major_device_id; system("/bin/mknod /dev/megadev0 c $major_device_id 0"); # warn "Found device id: $major_device_id"; } open(CLIOUTPUT, "-|", "/usr/sbin/megarc.bin -ldInfo -a0 -Lall") or die $!; while(<CLIOUTPUT>) { chomp; s/\r$//; if( /Status\s*: (.+)/ ) { $optimal = 0 if $1 ne "OPTIMAL"; } } close(CLIOUTPUT) or warn $!; } elsif( $controller_type eq 'sas6' ) { open(CLIOUTPUT, "-|", "/usr/sbin/lsiutil -p 1 -a 21,01,0,0") or die $!; while(<CLIOUTPUT>) { chomp; # Volume State: optimal, enabled if( /Volume State/ ) { $optimal = 0 if not ($_ =~ /optimal/); } } close(CLIOUTPUT); } elsif ( $controller_type eq 'perc_H200' ) { open(CLIOUTPUT, "-|", "/usr/sbin/sas2ircu 0 STATUS") or die $!; while(<CLIOUTPUT>) { chomp; # Volume State: Optimal if( /Volume State/ ) { $optimal = 0 if not ($_ =~ /Optimal/); } } close(CLIOUTPUT); } else { # Unknown $optimal = 0; warn "Unknown controller type, please check /proc/scsi/scsi"; } print "$optimal\n";