Skip to content

Commit

Permalink
ExceptionFixes and UOM per_second handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolas committed Jan 3, 2020
1 parent e86ef61 commit ca8ea5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion PlugNpshell/exception.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AssumedOK: System.Exception {
# To be thrown when the status of the check cannot be identified.
# This is usually used when the check requires the result of a previous run and this is the first run.
[string] $ErrorMessage
ResultError([string]$Message) {
AssumedOK([string]$Message) {
$this.ErrorMessage = $Message
}
}
Expand Down
5 changes: 4 additions & 1 deletion PlugNpshell/metric.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,12 @@ class Metric {
$convertedMetric = [Metric]::ConvertValue($this.Value, $this.UOM, $this.SummaryPrecision, $this.SiBytesConversion)
}
$displayUOM = $convertedMetric.UOM
if ( $displayUOM -eq 'per_second') {
$displayUOM = '/s'
}
if ($this.DisplayInSummary) {
$this.DisplayFormat = $this.DisplayFormat -Replace ('{name}', $this.DisplayName)
$this.DisplayFormat = $this.DisplayFormat -Replace ('{unit}', $DisplayUOM)
$this.DisplayFormat = $this.DisplayFormat -Replace ('{unit}', $displayUOM)
$this.DisplayFormat = $this.DisplayFormat -Replace ('{value}', $convertedMetric.Value)
$this.Summary = $this.DisplayFormat
}
Expand Down

0 comments on commit ca8ea5e

Please sign in to comment.