atc0005 / go-nagios

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

Add support for embedding an encoded payload within and later extracting the payload from plugin output #251

Open atc0005 opened 4 days ago

atc0005 commented 4 days ago

Overview

The intent is to provide a way for plugins to safely & reliably embed content (e.g., JSON data) within the generated output which can later be extracted by other tools.

The current plugin API permits passing human readable information back for display in a web UI or notifications and metrics for calculations & other data manipulation purposes, but AFAIK does not permit passing something like a JSON payload between plugin and the monitoring system.

My particular use case is accessing this information via the Nagios XI API, but I'd like to see this implemented in a way that's usable to plugins used with various monitoring systems.

In particular, I'd like to see this feature implemented so that's it is off by default and has to be explicitly opted into by the plugin author.

Details

Based on light research, both the base64 and ascii85 encoding formats would be suitable for passing the default illegal_macro_output_chars requirements.

The current Nagios plugin output length restriction is 8192 (bytes), so we need to ensure that we keep any included payload as small as possible.

Between the two considered encoding formats, ascii85 seems like a better fit for this requirement as it inflates the given input payload by the least amount.

References