-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsuccessrate.ps1
141 lines (109 loc) · 6.52 KB
/
successrate.ps1
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
param(
$Path
)
if (-not $Path) {
$log = cmd.exe /c "docker logs storagenode 2>&1"
} else {
$log = Get-Content $Path
}
Write-Host "========== AUDIT =============" -ForegroundColor Cyan
$auditsSuccess = ($log | Select-String GET_AUDIT | Select-String downloaded).Count
$auditsFailed = ($log | Select-String GET_AUDIT | Select-String failed | Select-String exist -NotMatch).Count
$auditsFailedCritical = ($log | Select-String GET_AUDIT | Select-String failed | Select-String exist).Count
if (($auditsSuccess + $auditsFailed + $auditsFailedCritical) -ge 1) {
$audits_failed_ratio = $auditsFailed / ($auditsSuccess + $auditsFailed + $auditsFailedCritical) * 100
$audits_critical_ratio = $auditsFailedCritical / ($auditsSuccess + $auditsFailed + $auditsFailedCritical) * 100
$audits_success_ratio = $auditsSuccess / ($auditsSuccess + $auditsFailed + $auditsFailedCritical) * 100
} else {
$audits_failed_ratio = 0.00
$audits_critical_ratio = 0.00
$audits_success_ratio = 0.00
}
Write-Host ("Critically failed:`t" + $auditsFailedCritical) -ForegroundColor Red
Write-Host ("Critical Fail Rate:`t{0:N}%" -f $audits_critical_ratio)
Write-Host ("Recoverable failed:`t" + $auditsFailed) -ForegroundColor Yellow
Write-Host ("Recoverable Fail Rate:`t{0:N}%" -f $audits_failed_ratio)
Write-Host ("Successful:`t`t" + $auditsSuccess) -ForegroundColor Green
Write-Host ("Success Rate:`t`t{0:N}%" -f $audits_success_ratio)
Write-Host "========== DOWNLOAD ==========" -ForegroundColor Cyan
$dl_success = ($log | Select-String '"GET"' | Select-String downloaded).Count
$dl_canceled = ($log | Select-String '"GET"' | Select-String canceled).Count
$dl_failed = ($log | Select-String '"GET"' | Select-String failed).Count
if (($dl_success + $dl_failed + $dl_canceled) -ge 1) {
$dl_failed_ratio = $dl_failed / ($dl_success + $dl_failed + $dl_canceled) * 100
$dl_canceled_ratio = $dl_canceled / ($dl_success + $dl_failed + $dl_canceled) * 100
$dl_ratio = $dl_success / ($dl_success + $dl_failed + $dl_canceled) * 100
} else {
$dl_failed_ratio = 0.00
$dl_canceled_ratio = 0.00
$dl_ratio = 0.00
}
Write-Host ("Failed:`t`t`t" + $dl_failed) -ForegroundColor Red
Write-Host ("Fail Rate:`t`t{0:N}%" -f $dl_failed_ratio)
Write-Host ("Canceled:`t`t" + $dl_canceled) -ForegroundColor Yellow
Write-Host ("Cancel Rate:`t`t{0:N}%" -f $dl_canceled_ratio)
Write-Host ("Successful:`t`t" + $dl_success) -ForegroundColor Green
Write-Host ("Success Rate:`t`t{0:N}%" -f $dl_ratio)
Write-Host "========== UPLOAD ============" -ForegroundColor Cyan
$put_success = ($log | Select-String '"PUT"' | Select-String uploaded).Count
$put_rejected = ($log | Select-String '"PUT"' | Select-String rejected).Count
$put_canceled = ($log | Select-String '"PUT"' | Select-String canceled).Count
$put_failed = ($log | Select-String '"PUT"' | Select-String failed).Count
if (($put_success + $put_rejected + $put_failed + $put_canceled) -ge 1) {
$put_failed_ratio = $put_failed / ($put_success + $put_rejected + $put_failed + $put_canceled) * 100
$put_canceled_ratio = $put_canceled / ($put_success + $put_rejected + $put_failed + $put_canceled) * 100
$put_accept_ratio = ($put_success + $put_canceled + $put_failed) / ($put_success + $put_rejected + $put_failed + $put_canceled) * 100
$put_ratio = $put_success / ($put_success + $put_rejected + $put_failed + $put_canceled) * 100
} else {
$put_failed_ratio = 0.00
$put_canceled_ratio = 0.00
$put_accept_ratio = 0.00
$put_ratio = 0.00
}
Write-Host ("Rejected:`t`t" + $put_rejected)
Write-Host ("Acceptance Rate:`t{0:N}%" -f $put_accept_ratio)
"---------- accepted ----------"
Write-Host ("Failed:`t`t`t" + $put_failed) -ForegroundColor Red
Write-Host ("Fail Rate:`t`t{0:N}%" -f $put_failed_ratio)
Write-Host ("Canceled:`t`t" + $put_canceled) -ForegroundColor Yellow
Write-Host ("Cancel Rate:`t`t{0:N}%" -f $put_canceled_ratio)
Write-Host ("Successful:`t`t" + $put_success) -ForegroundColor Green
Write-Host ("Success Rate:`t`t{0:N}%" -f $put_ratio)
Write-Host "========== REPAIR DOWNLOAD ===" -ForegroundColor Cyan
$get_repair_success = ($log | Select-String GET_REPAIR | Select-String downloaded).Count
$get_repair_canceled = ($log | Select-String GET_REPAIR | Select-String canceled).Count
$get_repair_failed = ($log | Select-String GET_REPAIR | Select-String failed).Count
if (($get_repair_success + $get_repair_failed + $get_repair_canceled) -ge 1) {
$get_repair_failed_ratio = $get_repair_failed / ($get_repair_success + $get_repair_failed + $get_repair_canceled) * 100
$get_repair_canceled_ratio = $get_repair_canceled / ($get_repair_success + $get_repair_failed + $get_repair_canceled) * 100
$get_repair_ratio = $get_repair_success / ($get_repair_success + $get_repair_failed + $get_repair_canceled) * 100
} else {
$get_repair_failed_ratio = 0.00
$get_repair_canceled_ratio = 0.00
$get_repair_ratio = 0.00
}
Write-Host ("Failed:`t`t`t" + $get_repair_failed) -ForegroundColor Red
Write-Host ("Fail Rate:`t`t{0:N}%" -f $get_repair_failed_ratio)
Write-Host ("Canceled:`t`t" + $get_repair_canceled) -ForegroundColor Yellow
Write-Host ("Cancel Rate:`t`t{0:N}%" -f $get_repair_canceled_ratio)
Write-Host ("Successful:`t`t" + $get_repair_success) -ForegroundColor Green
Write-Host ("Success Rate:`t`t{0:N}%" -f $get_repair_ratio)
Write-Host "========== REPAIR UPLOAD =====" -ForegroundColor Cyan
$put_repair_success = ($log | Select-String PUT_REPAIR | Select-String uploaded).Count
$put_repair_canceled = ($log | Select-String PUT_REPAIR | Select-String canceled).Count
$put_repair_failed = ($log | Select-String PUT_REPAIR | Select-String failed).Count
if (($put_repair_success + $put_repair_failed + $put_repair_canceled) -ge 1) {
$put_repair_failed_ratio = $put_repair_failed / ($put_repair_success + $put_repair_failed + $put_repair_canceled) * 100
$put_repair_canceled_ratio = $put_repair_canceled / ($put_repair_success + $put_repair_failed + $put_repair_canceled) * 100
$put_repair_ratio = $put_repair_success / ($put_repair_success + $put_repair_failed + $put_repair_canceled) * 100
} else {
$put_repair_failed_ratio = 0.00
$put_repair_canceled_ratio = 0.00
$put_repair_ratio = 0.00
}
Write-Host ("Failed:`t`t`t" + $put_repair_failed) -ForegroundColor Red
Write-Host ("Fail Rate:`t`t{0:N}%" -f $put_repair_failed_ratio)
Write-Host ("Canceled:`t`t" + $put_repair_canceled) -ForegroundColor Yellow
Write-Host ("Cancel Rate:`t`t{0:N}%" -f $put_repair_canceled_ratio)
Write-Host ("Successful:`t`t" + $put_repair_success) -ForegroundColor Green
Write-Host ("Success Rate:`t`t{0:N}%" -f $put_repair_ratio)