Skip to content

Commit

Permalink
Only emit perf data when plugin data present
Browse files Browse the repository at this point in the history
Emit Performance Data when available AND when `ServiceOutput`
is set. This guards against emitting metrics when there isn't
valid (complete) plugin data to process.

refs GH-98
refs atc0005/check-vmware#473
  • Loading branch information
atc0005 committed Nov 2, 2021
1 parent aaf9c5e commit a0034f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nagios.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,9 @@ func (es *ExitState) ReturnCheckResults() {
fmt.Printf("%s%s%s", CheckOutputEOL, es.BrandingCallback(), CheckOutputEOL)
}

// Generate formatted performance data if provided.
if len(es.perfData) != 0 {
// Generate formatted performance data if provided. Only emit if a
// one-line summary is set by client code.
if len(es.perfData) != 0 && es.ServiceOutput != "" {

// Performance data metrics are appended to plugin output. These
// metrics are provided as a single line, leading with a pipe
Expand Down

0 comments on commit a0034f7

Please sign in to comment.