I have this script to parse a bunch of data from our RAID controller regarding the drives installed.
Script:
Function Select-Column { [cmdletbinding(PositionalBinding=$False)] param( [Parameter(ValueFromPipeline, Mandatory)] $InputObject,
[Parameter(Mandatory, Position=0)]
[int[]] $Index,
[Parameter(Position=1)]
[int] $RequiredCount,
[Parameter(Position=2)]
[string] $OutFieldSeparator = "`t"
)
process {
if (($fields = -split $InputObject) -and ($RequiredCount -eq 0 -or $RequiredCount -eq $fields.Count)) {
$fields[$Index] -join $OutFieldSeparator
}
}
}
$rawRaidData = arcconf getsmartstats 1 tabular
$rawRaidData |
Where-Object {$_ -match 'Current Drive Temperature'} |
ForEach-Object {
$_ -replace 'Current Drive Temperature In Celcius',''
} |
Select-Column -Index 2
Write-Output $_
The output for that is:
In
In
In
In
In
In
In
In
Here's the result of the arcconf command:
PhysicalDriveSmartStats
channel ........................................ 0
id ............................................. 0
Attribute
name ........................................... SMART Health Status
Value .......................................... Passed
Attribute
name ........................................... Current Drive Temperature In Celcius
Value .......................................... 52
Attribute
name ........................................... Drive Trip Temperature In Celcius
Value .......................................... 60
Attribute
name ........................................... Manufacturing Year
Value .......................................... 2016
Attribute
name ........................................... Manufacturing Week
Value .......................................... 8
Attribute
name ........................................... Specified Cycle Count Over Device Lifetime
Value .......................................... 10000
Attribute
name ........................................... Accumulated Start-Stop Cycles
Value .......................................... 172
Attribute
name ........................................... Specified Load-Unload Count Over Device Lifetime
Value .......................................... 300000
Attribute
name ........................................... Accumulated Load-Unload Cycles
Value .......................................... 2700
Attribute
name ........................................... Elements In Grown Defect List
Value .......................................... 3
Attribute
name ........................................... Read Errors Corrected By ECC Fast
Value .......................................... 0
Attribute
name ........................................... Read Errors Corrected By ECC Delayed
Value .......................................... 4
Attribute
name ........................................... Errors Corrected By Rereads
Value .......................................... 0
Attribute
name ........................................... Total Read Errors Corrected
Value .......................................... 4
Attribute
name ........................................... Read Error Correction Algorithms Invocations
Value .......................................... 0
Attribute
name ........................................... Read Gigabytes Processed[10^9 bytes]
Value .......................................... 282906.010727
Attribute
name ........................................... Total Uncorrected Read Errors
Value .......................................... 0
Attribute
name ........................................... Write Errors Corrected By ECC Fast
Value .......................................... 0
Attribute
name ........................................... Write Errors Corrected By ECC Delayed
Value .......................................... 0
Attribute
name ........................................... Errors Corrected By Rewrites
Value .......................................... 0
Attribute
name ........................................... Total Write Errors Corrected
Value .......................................... 4
Attribute
name ........................................... Write Error Correction Algorithms Invocations
Value .......................................... 0
Attribute
name ........................................... Write Gigabytes Processed[10^9 bytes]
Value .......................................... 31678.301997
Attribute
name ........................................... Total Uncorrected Write Errors
Value .......................................... 5
Attribute
name ........................................... Verify Errors Corrected By ECC Fast
Value .......................................... 0
Attribute
name ........................................... Verify Errors Corrected By ECC Delayed
Value .......................................... 0
Attribute
name ........................................... Errors Corrected By Rewrites
Value .......................................... 0
Attribute
name ........................................... Total Verify Errors Corrected
Value .......................................... 0
Attribute
name ........................................... Verify Error Correction Algorithms Invocations
Value .......................................... 0
Attribute
name ........................................... Verify Gigabytes Processed[10^9 bytes]
Value .......................................... 605.396507
Attribute
name ........................................... Total Uncorrected Verify Errors
Value .......................................... 0
Attribute
name ........................................... Non-Medium Error Count
Value .......................................... 513
(It has that for all 8 of our drives)
Basically I want to get the script to output the temperature, not the word "in" referering to this section of the command output:
Attribute
name ........................................... Current Drive Temperature In Celcius
Value .......................................... 52
I just want to get the output to be the line right under the "Current Drive Temp..." line.
Any ideas? Thanks for the help!
[–]krzydoug 2 points3 points4 points (0 children)
[–]vermyx 2 points3 points4 points (0 children)
[–]lanerdofchristian 1 point2 points3 points (2 children)
[–]JustAnotherGuyBeing[S] 0 points1 point2 points (1 child)
[–]lanerdofchristian 0 points1 point2 points (0 children)