atc0005 / go-nagios

Shared Golang package for Nagios plugins
MIT License
8 stars 3 forks source link

Emit Performance Data on same line as `ServiceOutput` if `LongServiceOutput` is empty #103

Closed atc0005 closed 2 years ago

atc0005 commented 2 years ago

Currently the behavior is to emit Performance Data metrics after LongServiceOutput, but for plugins which do not generate additional information (or perhaps place it behind a --verbose flag) having the output trail the one-line (ServiceOutput) summary is perhaps not as intuitive as I expected it might be.

Instead, make the behavior dynamic based on whether LongServiceOutput is provided. If not, emit metrics on the same line as ServiceOutput content.

atc0005 commented 2 years ago

It looks like much of this logic is already in place.

One change might be to trim any trailing whitespace in es.ServiceOutput before emitting performance data.