forked from rubrikinc/rubrik-scripts-for-powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParse-RubrikSizing.ps1
More file actions
31 lines (25 loc) · 1.79 KB
/
Parse-RubrikSizing.ps1
File metadata and controls
31 lines (25 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
param($csvfile
,$delimiter = '|'
,[int[]]$HistogramBins=@(1,10,100,500,1000))
$rawdata = Get-Content $csvfile | ConvertFrom-Csv -Delimiter $delimiter
$DailyLogChurn = ($rawdata | Measure-Object -Property SevenDayLogBackupMB -Sum).Sum/7
$EstimatedChangePerc = $DailyLogChurn/($rawdata | Where-Object {$_.recovery_model_desc -ne 'SIMPLE'} | Measure-Object -Property DBTotalSizeMB -Sum).Sum
$return = [ordered]@{
'DB Count' = ($rawdata | Measure-Object).Count
'DBs in Full' = ($rawdata | Where-Object {$_.recovery_model_desc -ne 'SIMPLE'} | Measure-Object).Count
'Server Count' = ($rawdata | Group-Object -Property ServerName | Measure-Object).Count
'Total DB Size (GB)' = (($rawdata | Measure-Object -Property DBTotalSizeMB -Sum).Sum/1024).ToString('0.00')
'Avg Full Backup Time(Sec)' = ($rawdata | Measure-Object -Property 'AverageFullTimeSec' -Average).Average.ToString('0.00')
'Avg Log Backup Time(Sec)' = ($rawdata | Where-Object {$_.recovery_model_desc -ne 'SIMPLE'} | Measure-Object -Property 'AverageLogTimeSec' -Average).Average.ToString('0.00')
'Estimated Daily Change Rate (Perc)' = ($EstimatedChangePerc * 100).ToString('0.00')
'Estimated Daily Change Rate (GB)' = ((($rawdata | Measure-Object -Property DBTotalSizeMB -Sum).Sum/1024) * $EstimatedChangePerc).ToString('0.00')
}
$BinStart = 0
foreach($bin in $HistogramBins){
$BinCount = ($rawdata | Where-Object {[int]$_.DBTotalSizeMB/1024 -gt $BinStart -and [int]$_.DBTotalSizeMB/1024 -le $bin} | Measure-Object).Count
$return.Add("Histogram (GBs) :$bin",$BinCount)
$BinStart = $bin
}
$BinCount = ($rawdata | Where-Object {[int]$_.DBTotalSizeMB/1024 -gt $BinStart} | Measure-Object).Count
$return.Add("Histogram:More",$BinCount)
return $return