-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for embedding an encoded payload within and later extracting the payload from plugin output #251
Labels
documentation
Improvements or additions to documentation
enhancement
New feature or request
output/plugin
plugin output intended for monitoring system ingest
payload
Milestone
Comments
atc0005
added
documentation
Improvements or additions to documentation
enhancement
New feature or request
output/plugin
plugin output intended for monitoring system ingest
payload
labels
Oct 8, 2024
atc0005
added a commit
that referenced
this issue
Oct 15, 2024
OVERVIEW Add support for embedding an encoded payload within and later extracting the payload from plugin output. The current Nagios plugin API permits returning human readable information to Nagios for display in a web UI or notifications and metrics for calculations & other data manipulation purposes. As far as I know, Nagios does not permit passing something like a JSON payload directly between the plugin and the monitoring system. This new (optional) support provides 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. Due to current Nagios plugin output length restrictions (8192 bytes), the use of encoded payloads should be used sparingly. CHANGES - add standalone functions for encoding/decoding payload content - add new `Plugin` methods for adding (append or overwrite behavior) content to be encoded and embedded as a payload - add new `Plugin` methods to override behavior - opt out of using delimiters (NOT RECOMMENDED) - use custom delimiters - set custom payload section label - minor README updates - note new functionality - refresh overview & status sections - add test coverage for new functionality - add numerous testdata input files - add basic examples - extract and decode an embedded payload from (previous) plugin output - add encoded payload CREDIT I consulted ChatGPT when planning the implementation. While later iterations of the code differed significantly, ChatGPT provided code samples that acted as a starting point for the initial encoding/decoding functionality. Discussions with ChatGPT proved very helpful when deciding between using the base64 encoding format (more common, but less efficient) and the base85 (aka, "Ascii85") encoding format (more efficient). Those discussions also covered concerns such as adhering to the default `illegal_macro_output_chars` requirements that Nagios imposes for plugin output. REFERENCES - refs #251 - refs atc0005/check-cert#960
This was referenced Oct 15, 2024
atc0005
added a commit
to atc0005/check-cert
that referenced
this issue
Oct 15, 2024
Prepare for testing latest pre-release changes. - refs atc0005/go-nagios#251 - refs #960
atc0005
added a commit
that referenced
this issue
Nov 1, 2024
Make changes to clarify what happens when empty input is provided to encoded payload methods. - update doc comments and behavior of payload related methods to explicitly handle empty input vs using previous implicit behavior of underlying buffer field - `(Plugin).AddPayloadBytes` - `(Plugin).AddPayloadString` - `(Plugin).SetPayloadBytes` - `(Plugin).SetPayloadString` - add new tests to lock-in the intended behavior for empty input for those payload related methods - `TestAddPayloadString_AppendsNothingWhenCalledWithEmptyInput` - `TestAddPayloadBytes_AppendsNothingWhenCalledWithEmptyInput` - `TestSetPayloadString_SetsInputSuccessfullyWhenCalledWithEmptyInput` - `TestSetPayloadBytes_SetsInputSuccessfullyWhenCalledWithEmptyInput` refs GH-251
atc0005
added a commit
that referenced
this issue
Nov 5, 2024
If encoded payload content is provided then enable the LongServiceOutput section header/label to better separate the two types of output/content. refs GH-251
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
Improvements or additions to documentation
enhancement
New feature or request
output/plugin
plugin output intended for monitoring system ingest
payload
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
LongServiceOutput
macroLongServiceOutput
content check-cert#960The text was updated successfully, but these errors were encountered: