From 767a6e23fedb214f74b376874cefc7987a35f0e9 Mon Sep 17 00:00:00 2001 From: Adam Chalkley Date: Tue, 15 Oct 2024 06:30:12 -0500 Subject: [PATCH] Update atc0005/go-nagios dep to v0.17.0-alpha.1 Prepare for testing latest pre-release changes. - refs atc0005/go-nagios#251 - refs atc0005/check-cert#960 --- go.mod | 2 +- go.sum | 4 +- .../github.com/atc0005/go-nagios/CHANGELOG.md | 25 +- vendor/github.com/atc0005/go-nagios/README.md | 35 +-- vendor/github.com/atc0005/go-nagios/nagios.go | 143 +++++++++++- .../github.com/atc0005/go-nagios/payload.go | 218 ++++++++++++++++++ .../github.com/atc0005/go-nagios/sections.go | 63 +++++ ...payload_encoded_with_custom_delimiters.txt | 1 + ...ayload_encoded_with_default_delimiters.txt | 1 + ...rge_payload_encoded_without_delimiters.txt | 1 + .../payload/large_payload_unencoded.txt | 9 + ...encoded-payload-with-custom-delimiters.txt | 26 +++ ...ncoded-payload-with-default-delimiters.txt | 26 +++ ...rge-encoded-payload-with-no-delimiters.txt | 26 +++ ...ed-json-payload-with-custom-delimiters.txt | 26 +++ ...d-json-payload-with-default-delimiters.txt | 26 +++ ...ncoded-json-payload-with-no-delimiters.txt | 26 +++ ...aintext-payload-with-custom-delimiters.txt | 26 +++ ...intext-payload-with-default-delimiters.txt | 26 +++ ...d-plaintext-payload-with-no-delimiters.txt | 26 +++ ...encoded-payload-with-custom-delimiters.txt | 26 +++ ...ncoded-payload-with-default-delimiters.txt | 26 +++ ...rge-encoded-payload-with-no-delimiters.txt | 26 +++ ...ed-json-payload-with-custom-delimiters.txt | 26 +++ ...d-json-payload-with-default-delimiters.txt | 26 +++ ...ncoded-json-payload-with-no-delimiters.txt | 26 +++ ...aintext-payload-with-custom-delimiters.txt | 26 +++ ...intext-payload-with-default-delimiters.txt | 26 +++ ...d-plaintext-payload-with-no-delimiters.txt | 26 +++ ...payload_encoded_with_custom_delimiters.txt | 1 + ...ayload_encoded_with_default_delimiters.txt | 1 + ...son_payload_encoded_without_delimiters.txt | 1 + .../payload/small_json_payload_unencoded.txt | 1 + ...payload_encoded_with_custom_delimiters.txt | 1 + ...ayload_encoded_with_default_delimiters.txt | 1 + ...ext_payload_encoded_without_delimiters.txt | 1 + .../small_plaintext_payload_unencoded.txt | 1 + vendor/modules.txt | 2 +- 38 files changed, 935 insertions(+), 45 deletions(-) create mode 100644 vendor/github.com/atc0005/go-nagios/payload.go create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/large_payload_encoded_with_custom_delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/large_payload_encoded_with_default_delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/large_payload_encoded_without_delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/large_payload_unencoded.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-large-encoded-payload-with-custom-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-large-encoded-payload-with-default-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-large-encoded-payload-with-no-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-json-payload-with-custom-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-json-payload-with-default-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-json-payload-with-no-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-custom-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-default-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-no-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-large-encoded-payload-with-custom-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-large-encoded-payload-with-default-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-large-encoded-payload-with-no-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-json-payload-with-custom-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-json-payload-with-default-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-json-payload-with-no-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-custom-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-default-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-no-delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_with_custom_delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_with_default_delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_without_delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_unencoded.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_with_custom_delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_with_default_delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_without_delimiters.txt create mode 100644 vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_unencoded.txt diff --git a/go.mod b/go.mod index 2965d5eb..6a8be269 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/atc0005/check-cert go 1.20 require ( - github.com/atc0005/go-nagios v0.16.2 + github.com/atc0005/go-nagios v0.17.0-alpha.1 github.com/grantae/certinfo v0.0.0-20170412194111-59d56a35515b github.com/rs/zerolog v1.33.0 ) diff --git a/go.sum b/go.sum index 1041fc9b..123ab10b 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/atc0005/go-nagios v0.16.2 h1:yl11RiT1PrxQ/z1XrjhMWPpXt+ztn7NBElkjTd/nKx0= -github.com/atc0005/go-nagios v0.16.2/go.mod h1:n2RHhsrgI8xiapqkJ240dKLwMXWbWvkOPLE92x0IGaM= +github.com/atc0005/go-nagios v0.17.0-alpha.1 h1:TIM68/Ga39sIVfWA6YI2oivNrjxrjnfBApDYOBA22pg= +github.com/atc0005/go-nagios v0.17.0-alpha.1/go.mod h1:n2RHhsrgI8xiapqkJ240dKLwMXWbWvkOPLE92x0IGaM= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= diff --git a/vendor/github.com/atc0005/go-nagios/CHANGELOG.md b/vendor/github.com/atc0005/go-nagios/CHANGELOG.md index 98a2762a..1419ee5b 100644 --- a/vendor/github.com/atc0005/go-nagios/CHANGELOG.md +++ b/vendor/github.com/atc0005/go-nagios/CHANGELOG.md @@ -26,28 +26,6 @@ The following types of changes will be recorded in this file: - placeholder -## [v0.16.2] - 2024-10-10 - -### Changed - -#### Dependency Updates - -- (GH-240) Update Dependabot PR prefixes -- (GH-241) Update Dependabot PR prefixes (redux) -- (GH-242) Go Dependency: Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 - -#### Other - -- (GH-245) Add check_cert plugin perfdata success test case -- (GH-254) Update README reference links - -### Fixed - -- (GH-247) Remove inactive maligned linter -- (GH-248) Fix errcheck linting errors -- (GH-252) Fix `TestEmptyServiceOutputProducesNoOutput` test -- (GH-257) Fix `predeclared` linter warnings - ## [v0.16.1] - 2024-01-25 ### Added @@ -543,8 +521,7 @@ Initial package state - Nagios state map -[Unreleased]: https://github.com/atc0005/go-nagios/compare/v0.16.2...HEAD -[v0.16.2]: https://github.com/atc0005/go-nagios/releases/tag/v0.16.2 +[Unreleased]: https://github.com/atc0005/go-nagios/compare/v0.16.1...HEAD [v0.16.1]: https://github.com/atc0005/go-nagios/releases/tag/v0.16.1 [v0.16.0]: https://github.com/atc0005/go-nagios/releases/tag/v0.16.0 [v0.15.0]: https://github.com/atc0005/go-nagios/releases/tag/v0.15.0 diff --git a/vendor/github.com/atc0005/go-nagios/README.md b/vendor/github.com/atc0005/go-nagios/README.md index 1b35534c..f14c5636 100644 --- a/vendor/github.com/atc0005/go-nagios/README.md +++ b/vendor/github.com/atc0005/go-nagios/README.md @@ -12,8 +12,8 @@ Shared Golang package for Nagios plugins ## Table of contents -- [Status](#status) - [Overview](#overview) +- [Status](#status) - [Features](#features) - [Changelog](#changelog) - [Examples](#examples) @@ -21,19 +21,19 @@ Shared Golang package for Nagios plugins - [Used by](#used-by) - [References](#references) -## Status - -Alpha quality. +## Overview -This codebase is subject to change without notice and may break client code -that depends on it. You are encouraged to [vendor](#references) this package -if you find it useful until such time that the API is considered stable. +This package provides support and functionality common to monitoring plugins. +While Nagios (Core and XI) are primary monitoring platform targets, the intent +is to support (where feasible) all monitoring platforms compatible with Nagios +plugins. -## Overview +## Status -This package contains common types and package-level variables used when -developing Nagios plugins. The intent is to reduce code duplication between -various plugins and help reduce typos associated with literal strings. +While attempts are made to provide stability, this codebase is subject to +change without notice and may break client code that depends on it. You are +encouraged to [vendor](#references) this package if you find it useful until +such time that the API is considered stable. ## Features @@ -41,8 +41,9 @@ various plugins and help reduce typos associated with literal strings. - state labels (e.g., `StateOKLabel`) - state exit codes (e.g., `StateOKExitCode`) - Nagios `CheckOutputEOL` constant - - provides a consistent newline format for both Nagios Core and Nagios XI - (and presumably other similar monitoring systems) + - provides a common newline format shown to produce consistent results for + both Nagios Core and Nagios XI (and presumably other similar monitoring + systems) - Nagios `ServiceState` type - simple label and exit code "wrapper" - useful in client code as a way to map internal check results to a Nagios @@ -58,7 +59,7 @@ various plugins and help reduce typos associated with literal strings. the service or host state to be an issue - Panics from client code are captured and reported - panics are surfaced as `CRITICAL` state - - service output and error details are overridden to panic prominent + - service output and error details are overridden to make panics prominent - Optional support for emitting performance data generated by plugins - if not overridden by client code *and* if using the provided `nagios.NewPlugin()` constructor, a default `time` performance data metric @@ -73,6 +74,12 @@ various plugins and help reduce typos associated with literal strings. - Automatically omit `LongServiceOutput` section if not specified by client code - Support for overriding text used for section headers/labels +- Support for adding/embedding an encoded payload (Ascii85) in plugin output +- Support for decoding (Ascii85) encoded input (payload) +- Support for extracting an (Ascii85) encoded payload from captured plugin + output +- Support for extracting and decoding an (Ascii85) encoded payload (into the + original non-encoded form) from captured plugin output ## Changelog diff --git a/vendor/github.com/atc0005/go-nagios/nagios.go b/vendor/github.com/atc0005/go-nagios/nagios.go index cf56e17d..f1b43df7 100644 --- a/vendor/github.com/atc0005/go-nagios/nagios.go +++ b/vendor/github.com/atc0005/go-nagios/nagios.go @@ -8,6 +8,7 @@ package nagios import ( + "bytes" "errors" "fmt" "io" @@ -58,9 +59,10 @@ const CheckOutputEOL string = " \n" // Default header text for various sections of the output if not overridden. const ( - defaultThresholdsLabel string = "THRESHOLDS" - defaultErrorsLabel string = "ERRORS" - defaultDetailedInfoLabel string = "DETAILED INFO" + defaultThresholdsLabel string = "THRESHOLDS" + defaultErrorsLabel string = "ERRORS" + defaultDetailedInfoLabel string = "DETAILED INFO" + defaultEncodedPayloadLabel string = "ENCODED PAYLOAD" ) // Default performance data metrics emitted if not specified by client code. @@ -69,6 +71,39 @@ const ( defaultTimeMetricUnitOfMeasurement string = "ms" ) +// Default payload values if not specified by client code. +const ( + defaultPayloadDelimiterLeft string = DefaultASCII85EncodingDelimiterLeft + defaultPayloadDelimiterRight string = DefaultASCII85EncodingDelimiterRight +) + +const ( + // DefaultASCII85EncodingDelimiterLeft is the left delimiter often used + // with ascii85-encoded data. + DefaultASCII85EncodingDelimiterLeft string = "<~" + + // DefaultASCII85EncodingDelimiterRight is the right delimiter often used + // with ascii85-encoded data. + DefaultASCII85EncodingDelimiterRight string = "~>" + + // DefaultASCII85EncodingPatternRegex is the default regex pattern used to + // match and extract an Ascii85 encoded payload as used in the btoa tool + // and Adobe's PostScript and PDF document formats. + // + // In Ascii85-encoded blocks, whitespace and line-break characters may be + // present anywhere, including in the middle of a 5-character block, but + // they must be silently ignored. + // + // - https://pkg.go.dev/encoding/ascii85 + // - https://en.wikipedia.org/wiki/Ascii85 + // + // NOTE: Not using delimiters when saving an encoded payload makes the + // extraction process *VERY* unreliable as this regex pattern (by itself) + // matches far more than likely intended. + // + DefaultASCII85EncodingPatternRegex string = `[\x21-\x75\s]+` +) + // Sentinel error collection. Exported for potential use by client code to // detect & handle specific error scenarios. var ( @@ -112,6 +147,21 @@ var ( // ErrInvalidPerformanceDataCritField = errors.New("invalid field Crit in parsed performance data") // ErrInvalidPerformanceDataMinField = errors.New("invalid field Min in parsed performance data") // ErrInvalidPerformanceDataMaxField = errors.New("invalid field Max in parsed performance data") + + // ErrMissingValue indicates that an expected value was missing. + ErrMissingValue = errors.New("missing expected value") + + // ErrEncodedPayloadNotFound indicates that an encoded payload was not + // found during an extraction attempt. + ErrEncodedPayloadNotFound = errors.New("encoded payload not found") + + // ErrEncodedPayloadInvalid indicates that an encoded payload was found + // during extraction but was found to be invalid. + ErrEncodedPayloadInvalid = errors.New("encoded payload invalid") + + // ErrEncodedPayloadInvalid indicates that a regular expression used to + // identify an encoded payload was found to be invalid. + ErrEncodedPayloadRegexInvalid = errors.New("encoded payload regex invalid") ) // ServiceState represents the status label and exit code for a service check. @@ -137,6 +187,21 @@ type Plugin struct { // outputSink is the user-specified or fallback target for plugin output. outputSink io.Writer + // encodedPayloadBuffer holds a user-specified payload *before* encoding + // is performed. If provided, this payload is later encoded and included + // in the generated plugin output. + encodedPayloadBuffer bytes.Buffer + + // encodedPayloadDelimiterLeft is the user-specified custom encoded + // payload delimiter. If not set the default payload left delimiter is + // used. + encodedPayloadDelimiterLeft *string + + // encodedPayloadDelimiterRight is the user-specified custom encoded + // payload delimiter. If not set the default payload right delimiter is + // used. + encodedPayloadDelimiterRight *string + // start tracks when the associated plugin begins executing. This value is // used to generate a default `time` performance data metric (which can be // overridden by client code). @@ -193,6 +258,10 @@ type Plugin struct { // standard text prior to emitting LongServiceOutput. detailedInfoLabel string + // encodedPayloadLabel is an optional custom label used in place of the + // standard text prior to emitting an encoded payload. + encodedPayloadLabel string + // hideThresholdsSection indicates whether client code has opted to hide // the thresholds section, regardless of whether client code previously // specified values for display. @@ -312,6 +381,8 @@ func (p *Plugin) ReturnCheckResults() { p.handleLongServiceOutput(&output) + p.handleEncodedPayload(&output) + // If set, call user-provided branding function before emitting // performance data and exiting application. if p.BrandingCallback != nil { @@ -406,6 +477,24 @@ func (p *Plugin) SetOutputTarget(w io.Writer) { p.outputSink = w } +// SetEncodedPayloadDelimiterLeft uses the given value to override the default +// left delimiter used when encoding a provided payload. Specify an empty +// string if no left delimiter should be used. +// +// This value is ignored if no payload is provided. +func (p *Plugin) SetEncodedPayloadDelimiterLeft(delimiter string) { + p.encodedPayloadDelimiterLeft = &delimiter +} + +// SetEncodedPayloadDelimiterRight uses the given value to override the +// default right delimiter used when encoding a provided payload. Specify an +// empty string if no right delimiter should be used. +// +// This value is ignored if no payload is provided. +func (p *Plugin) SetEncodedPayloadDelimiterRight(delimiter string) { + p.encodedPayloadDelimiterRight = &delimiter +} + // SkipOSExit indicates that the os.Exit(x) step used to signal to Nagios what // state plugin execution has completed in (e.g., OK, WARNING, ...) should be // skipped. If skipped, a message is logged to os.Stderr in place of the @@ -417,6 +506,54 @@ func (p *Plugin) SkipOSExit() { p.shouldSkipOSExit = true } +// SetPayloadBytes uses the given input in bytes to overwrite any existing +// content in the payload buffer. It returns the length of input and a +// potential error. +// +// The contents of this buffer will be included in the plugin's output as an +// encoded payload suitable for later retrieval/decoding. +func (p *Plugin) SetPayloadBytes(input []byte) (int, error) { + p.encodedPayloadBuffer.Reset() + + return p.encodedPayloadBuffer.Write(input) +} + +// SetPayloadString uses the given input string to overwrite any existing +// content in the payload buffer. It returns the length of input and a +// potential error. +// +// The contents of this buffer will be included in the plugin's output as an +// encoded payload suitable for later retrieval/decoding. +func (p *Plugin) SetPayloadString(input string) (int, error) { + p.encodedPayloadBuffer.Reset() + + return p.encodedPayloadBuffer.WriteString(input) +} + +// AddPayloadBytes appends the given input in bytes to the payload buffer. It +// returns the length of input and a potential error. +// +// The contents of this buffer will be included in the plugin's output as an +// encoded payload suitable for later retrieval/decoding. +func (p *Plugin) AddPayloadBytes(input []byte) (int, error) { + return p.encodedPayloadBuffer.Write(input) +} + +// AddPayloadString appends the given input string to the payload buffer. It +// returns the length of input and a potential error. +// +// The contents of this buffer will be included in the plugin's output as an +// encoded payload suitable for later retrieval/decoding. +func (p *Plugin) AddPayloadString(input string) (int, error) { + return p.encodedPayloadBuffer.WriteString(input) +} + +// UnencodedPayload returns the payload buffer contents in string format as-is +// without encoding applied. +func (p *Plugin) UnencodedPayload() string { + return p.encodedPayloadBuffer.String() +} + // emitOutput writes final plugin output to the previously set output target. // No further modifications to plugin output are performed. func (p Plugin) emitOutput(pluginOutput string) { diff --git a/vendor/github.com/atc0005/go-nagios/payload.go b/vendor/github.com/atc0005/go-nagios/payload.go new file mode 100644 index 00000000..b09aa9e8 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/payload.go @@ -0,0 +1,218 @@ +// Copyright 2024 Adam Chalkley +// +// https://github.com/atc0005/go-nagios +// +// Licensed under the MIT License. See LICENSE file in the project root for +// full license information. +// +// Code in this file inspired by or generated with the help of ChatGPT, OpenAI. + +package nagios + +import ( + "bytes" + "encoding/ascii85" + "fmt" + "regexp" +) + +// getEncodedPayloadDelimiterLeft retrieves the custom left delimiter used +// when enclosing an encoded payload if set, otherwise returns the default +// value. +func (p Plugin) getEncodedPayloadDelimiterLeft() string { + switch { + case p.encodedPayloadDelimiterLeft != nil: + return *p.encodedPayloadDelimiterLeft + default: + return defaultPayloadDelimiterLeft + } +} + +// getEncodedPayloadDelimiterRight retrieves the custom right delimiter used +// when enclosing an encoded payload if set, otherwise returns the default +// value. +func (p Plugin) getEncodedPayloadDelimiterRight() string { + switch { + case p.encodedPayloadDelimiterRight != nil: + return *p.encodedPayloadDelimiterRight + default: + return defaultPayloadDelimiterRight + } +} + +// EncodeASCII85Payload encodes the given input as Ascii85. If no input is +// provided, an empty string is returned. +// +// If specified, the given left and right delimiters are used to enclose the +// encoded payload. If not specified, no delimiters are used. +func EncodeASCII85Payload(data []byte, leftDelimiter string, rightDelimiter string) string { + if len(data) == 0 { + return "" + } + + encoded := make([]byte, ascii85.MaxEncodedLen(len(data))) + ascii85.Encode(encoded, data) + + // Add optional delimiters. + return leftDelimiter + string(encoded) + rightDelimiter +} + +// decodeASCII85 decodes given Ascii85 encoded input or an error if one occurs +// during decoding. +// +// The caller is expected to remove any delimiters from the input before +// calling this function. +// +// This function is also not intended for extraction of an Ascii encoded +// payload from surrounding text. +func decodeASCII85(encodedInput []byte) ([]byte, error) { + if len(encodedInput) == 0 { + return nil, fmt.Errorf( + "failed to decode empty payload: %w", + ErrMissingValue, + ) + } + + decoded := make([]byte, len(encodedInput)) + n, _, err := ascii85.Decode(decoded, encodedInput, true) + if err != nil { + return nil, err + } + + decodedBytes := decoded[:n] + + // Remove any trailing null (\x00) bytes that may have been added as + // padding during the encoding process. + // + // https://blog.manugarri.com/note-to-self-fixing-encoding-in-golang-ascii85/ + decodedBytes = bytes.Trim(decodedBytes, "\x00") + + return decodedBytes, nil +} + +// DecodeASCII85Payload decodes given Ascii85 encoded input or an error if one +// occurs during decoding. If provided, the left and right delimiters are +// trimmed from the given input before decoding is performed. +// +// This function is not intended to extract an Ascii encoded payload from +// surrounding text. +func DecodeASCII85Payload(encodedInput []byte, leftDelimiter string, rightDelimiter string) ([]byte, error) { + if len(encodedInput) == 0 { + return nil, fmt.Errorf( + "failed to decode empty payload: %w", + ErrMissingValue, + ) + } + + if leftDelimiter != "" { + encodedInput = bytes.TrimPrefix(encodedInput, []byte(leftDelimiter)) + } + + if rightDelimiter != "" { + encodedInput = bytes.TrimSuffix(encodedInput, []byte(rightDelimiter)) + } + + decodedPayload, err := decodeASCII85(encodedInput) + if err != nil { + // return nil, err + return nil, fmt.Errorf( + "failed to decode %d bytes input payload: %w", + len(encodedInput), + err, + ) + } + + return decodedPayload, nil +} + +// ExtractEncodedASCII85Payload extracts an Ascii85 encoded payload from given +// text input using specified delimiters. +// +// If not provided, a default regular expression for the Ascii85 encoding +// format is used to perform matching/extraction. +// +// If specified, delimiters are removed during the extraction process. +// +// NOTE: While technically optional, the use of delimiters for matching an +// encoded payload is *highly* recommended; reliability of payload matching is +// *greatly* reduced without using delimiters. +// +// The extracted payload is Ascii85 encoded and will need to be decoded before +// the original content is accessible. +func ExtractEncodedASCII85Payload(text string, customRegex string, leftDelimiter string, rightDelimiter string) (string, error) { + if len(text) == 0 { + return "", fmt.Errorf( + "failed to extract encoded payload from empty input: %w", + ErrMissingValue, + ) + } + + // Regular expression to match Ascii85 block without delimiters. + ascii85EncodingPattern := DefaultASCII85EncodingPatternRegex + + defaultMatchPattern := leftDelimiter + ascii85EncodingPattern + rightDelimiter + + chosenRegex := defaultMatchPattern + if customRegex != "" { + chosenRegex = leftDelimiter + customRegex + rightDelimiter + } + + // Assert that combined expression is valid. + re, err := regexp.Compile(chosenRegex) + if err != nil { + return "", fmt.Errorf( + "failed to use regex %q to match encoded payload "+ + "in given text: %w", + chosenRegex, + ErrEncodedPayloadRegexInvalid, + ) + } + + matches := re.FindStringSubmatch(text) + if len(matches) == 0 { + return "", fmt.Errorf("no encoded Ascii85 data found: %w", ErrEncodedPayloadNotFound) + } + + // Dynamically remove the delimiters based on input delimiter length. + leftDelimiterLength := len(leftDelimiter) + rightDelimiterLength := len(rightDelimiter) + + return matches[0][leftDelimiterLength : len(matches[0])-rightDelimiterLength], nil +} + +// ExtractAndDecodeASCII85Payload extracts and decodes a Ascii85 encoded +// payload from given input text. +// +// If not provided, a default regular expression for the Ascii85 encoding +// format is used to perform matching/extraction. +// +// If specified, delimiters are removed during the extraction process. +// +// NOTE: While technically optional, the use of delimiters for matching an +// encoded payload is *highly* recommended; without delimiters, reliability of +// payload matching is *greatly* reduced (LOTS of false positives). +// +// The extracted content is the original unencoded payload before Ascii85 +// encoding was performed. Depending on the type of the original data, the +// retrieved payload may require additional processing (e.g., JSON vs +// plaintext). +func ExtractAndDecodeASCII85Payload(text string, customRegex string, leftDelimiter string, rightDelimiter string) (string, error) { + if len(text) == 0 { + return "", fmt.Errorf( + "failed to extract and decode payload from empty input: %w", + ErrMissingValue, + ) + } + + encodedPayload, err := ExtractEncodedASCII85Payload(text, customRegex, leftDelimiter, rightDelimiter) + if err != nil { + return "", err + } + + decodedPayload, err := decodeASCII85([]byte(encodedPayload)) + if err != nil { + return "", err + } + + return string(decodedPayload), nil +} diff --git a/vendor/github.com/atc0005/go-nagios/sections.go b/vendor/github.com/atc0005/go-nagios/sections.go index e394e036..cd0a0584 100644 --- a/vendor/github.com/atc0005/go-nagios/sections.go +++ b/vendor/github.com/atc0005/go-nagios/sections.go @@ -151,6 +151,53 @@ func (p Plugin) handleLongServiceOutput(w io.Writer) { ) } +// handleEncodedPayload is a wrapper around the logic used to handle/process +// any user-provided content to be encoded and included in the plugin output. +func (p Plugin) handleEncodedPayload(w io.Writer) { + // Early exit if there is no content to process. + if p.encodedPayloadBuffer.Len() == 0 { + return + } + + leftDelimiter := p.getEncodedPayloadDelimiterLeft() + rightDelimiter := p.getEncodedPayloadDelimiterRight() + + // Encode the contents of the buffer to Ascii85 with delimiters. + encodedWithDelimiters := EncodeASCII85Payload( + p.encodedPayloadBuffer.Bytes(), + leftDelimiter, + rightDelimiter, + ) + + // Hide section header/label if no payload was specified. + // + // If we hide the section header, we still provide some padding to prevent + // this output from running up against the LongServiceOutput content. + switch { + case p.encodedPayloadBuffer.Len() > 0: + _, _ = fmt.Fprintf(w, + "%s**%s**%s", + CheckOutputEOL, + p.getEncodedPayloadLabelText(), + CheckOutputEOL, + ) + + // Note: fmt.Println() (and fmt.Fprintln()) has the same issue as + // `\n`: Nagios seems to interpret them literally instead of emitting + // an actual newline. We work around that by using fmt.Fprintf() for + // output that is intended for display within the Nagios web UI. + _, _ = fmt.Fprintf(w, + "%s%v%s", + CheckOutputEOL, + encodedWithDelimiters, + CheckOutputEOL, + ) + + default: + _, _ = fmt.Fprint(w, CheckOutputEOL) + } +} + // handlePerformanceData is a wrapper around the logic used to // handle/process plugin Performance Data. func (p *Plugin) handlePerformanceData(w io.Writer) { @@ -240,6 +287,17 @@ func (p Plugin) getDetailedInfoLabelText() string { } } +// getEncodedPayloadLabelText retrieves the custom encoded payload label text +// if set, otherwise returns the default value. +func (p Plugin) getEncodedPayloadLabelText() string { + switch { + case p.encodedPayloadLabel != "": + return p.encodedPayloadLabel + default: + return defaultEncodedPayloadLabel + } +} + // SetThresholdsLabel overrides the default thresholds label text. func (p *Plugin) SetThresholdsLabel(newLabel string) { p.thresholdsLabel = newLabel @@ -255,6 +313,11 @@ func (p *Plugin) SetDetailedInfoLabel(newLabel string) { p.detailedInfoLabel = newLabel } +// SetEncodedPayloadLabel overrides the default encoded payload label text. +func (p *Plugin) SetEncodedPayloadLabel(newLabel string) { + p.encodedPayloadLabel = newLabel +} + // HideThresholdsSection indicates that client code has opted to hide the // thresholds section, regardless of whether values were previously provided // for display. diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/large_payload_encoded_with_custom_delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/large_payload_encoded_with_custom_delimiters.txt new file mode 100644 index 00000000..4c8a6d0e --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/large_payload_encoded_with_custom_delimiters.txt @@ -0,0 +1 @@ +CUSTOM_ENCODING_DELIMITER_LEFT9Q+r_D'3P3F*2=BA8c:&EZfF;F-F(Jj'ATW'8+EV12CiseACgggfDJdmF!,@=DCco@Bk)7-D'3n.E+rm$/g*Q#DIm<#D..O.BlbD5@:OG$+CoV//0JMG+Eh16Bm"J>De*R#+DG7oF_kc5+CT@E+B*E(E+NotBle?,+E27@ASuU(/g*ksARf:h@<3Q&FWbO0F`M2;+ED.6DI[g1+DkP.F($2%BkMi.+DkP3Bl/!6+EMI;Ch[BnFEM,.DBNY(+Du+8+CT;#FY4e8ARlp+Ci!Ns@rHC,ATAo6BQ%cuF`S[B@2EcZAE+Dtb1F_)\0DBNn:EccD;FDl1P$497FF(8c(AS5RqFCB55F(K22DJsD8Ch[?iEc3(@F`_YHD'3G%F_>DsFi++Dbt:ASiPu+EV=8@qfIrDKIKR;g!/#ASu$mF)tn8D..6lF*1o%@3B-&FD/X6,BlbmL;g!/#ASu$mF)tn8F(Jl)CiAF6/0JM:ATT&,ATDX!DKL#<+Dbb)F_kJ/G%G`:Bju4$F_r`R76+EMI;Ch[BnFEM,.DBNk.Bl>,/F`VYC/0K"JFFC?;&BkM,D/Ws'+Dtb#+Co1pD(Zr0ARlp)BlkJ+D.Rf3A8,OqF_r7>Earf9+Ad)eATMF#FFD..'p@3B`)F*),*F_l2;+D#A#BkCpoA1f!"F_kl&+CT@7@u4Ecc5?+EhI@@:^u4@rH7+AT;j$Fl7@;R-)Df-\=@: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G@/CgggrF!,F?EccD;FDl1N+EDUHEcl4A@<,k#+CT@C+E2@4FD5l7+Co1pD(Zr-ASc0oDKKH2EHPh8Bk/?*BOPpmFE1e4Ch7N9+DG@/B6%F(Bk1WpASu4!/d_q^Ec5Z0+CQC$DKKG4F(8ctATDL+EHPhD+Co2!DJ=05Bl+u/BkMR)@3BW&A1SjFEbTT:BlS9,+CT;#FY4e2@:`q[DIIT/E,Tf?ATD?)@rH6qBl.F!FEMFCF`MA./0JMH+Cf>-F(Jj'ATW'8+Dtn7Bcq82Ch7[0Bk8DuF=n\2F_kl&D'3n2A0?&,Ch[u6@:LF'ASc(&+E27>FC?;%Df'?0A8a(C6uQsS@j#c6BlbD5BkMR)@3BW&A0>c(F(lb,Df'?0A8`T%Ch7dfF_kJ/F(o_=@;TRt/0JA2@s)X0@;[32AS`K2F`MG8F"SS6F`VM5DIdI&F(HJ(Df031ALnsGASc1*F!,X;C`m\;ATVX/D'3q7DI[BkF`):P+D#G)D'3n.E+rm$+DG7oF_kc5+DbV!FEMXU+DG^9An?""ASuU4D'3D2F>t@;]UiFu7BleB1EHPh8AS,Og@qg%-E\&>FASc(%+DbV!FEMXIAmoglBju4++E_^B@4WO0FE$Ci=>:ASu4!+E_cK@<,k#/g*o3Ci!Ns+CT)#EHP],+CTD*F_)\0DBNA.@s&o8F`V&,E+sDF+DG@/FE2):FD5`;AKZ/-Ch[u6Bl8$(Eb'<0/g*u2DeX)3F`\aDF_kl&+ELt(BlnH2F"AGFAnGaeBlnK<+DkP0EbTS;F(Jl5+Cno"Bju4++Dbt:ASj%B;g!/#ASu$mF)tn8Ch7N-An>dmF"AGN@;KLrF^\fh+DG@/DfT?%+EM+)/0K+YCiFN=@ \ No newline at end of file diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/large_payload_encoded_without_delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/large_payload_encoded_without_delimiters.txt new file mode 100644 index 00000000..49b05082 --- /dev/null +++ b/vendor/github.com/at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I[BkF`):P+D#G)D'3n.E+rm$+DG7oF_kc5+DbV!FEMXU+DG^9An?""ASuU4D'3D2F>t@;]UiFu7BleB1EHPh8AS,Og@qg%-E\&>FASc(%+DbV!FEMXIAmoglBju4++E_^B@4WO0FE$Ci=>:ASu4!+E_cK@<,k#/g*o3Ci!Ns+CT)#EHP],+CTD*F_)\0DBNA.@s&o8F`V&,E+sDF+DG@/FE2):FD5`;AKZ/-Ch[u6Bl8$(Eb'<0/g*u2DeX)3F`\aDF_kl&+ELt(BlnH2F"AGFAnGaeBlnK<+DkP0EbTS;F(Jl5+Cno"Bju4++Dbt:ASj%B;g!/#ASu$mF)tn8Ch7N-An>dmF"AGN@;KLrF^\fh+DG@/DfT?%+EM+)/0K+YCiFN=@ + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-large-encoded-payload-with-no-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-large-encoded-payload-with-no-delimiters.txt new file mode 100644 index 00000000..cea2f8f7 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-large-encoded-payload-with-no-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**PAYLOAD FOR LATER API USE** + +9Q+r_D'3P3F*2=BA8c:&EZfF;F-F(Jj'ATW'8+EV12CiseACgggfDJdmF!,@=DCco@Bk)7-D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$DKKG4F(8ctATDL+EHPhD+Co2!DJ=05Bl+u/BkMR)@3BW&A1SjFEbTT:BlS9,+CT;#FY4e2@:`q[DIIT/E,Tf?ATD?)@rH6qBl.F!FEMFCF`MA./0JMH+Cf>-F(Jj'ATW'8+Dtn7Bcq82Ch7[0Bk8DuF=n\2F_kl&D'3n2A0?&,Ch[u6@:LF'ASc(&+E27>FC?;%Df'?0A8a(C6uQsS@j#c6BlbD5BkMR)@3BW&A0>c(F(lb,Df'?0A8`T%Ch7dfF_kJ/F(o_=@;TRt/0JA2@s)X0@;[32AS`K2F`MG8F"SS6F`VM5DIdI&F(HJ(Df031ALnsGASc1*F!,X;C`m\;ATVX/D'3q7DI[BkF`):P+D#G)D'3n.E+rm$+DG7oF_kc5+DbV!FEMXU+DG^9An?""ASuU4D'3D2F>t@;]UiFu7BleB1EHPh8AS,Og@qg%-E\&>FASc(%+DbV!FEMXIAmoglBju4++E_^B@4WO0FE$Ci=>:ASu4!+E_cK@<,k#/g*o3Ci!Ns+CT)#EHP],+CTD*F_)\0DBNA.@s&o8F`V&,E+sDF+DG@/FE2):FD5`;AKZ/-Ch[u6Bl8$(Eb'<0/g*u2DeX)3F`\aDF_kl&+ELt(BlnH2F"AGFAnGaeBlnK<+DkP0EbTS;F(Jl5+Cno"Bju4++Dbt:ASj%B;g!/#ASu$mF)tn8Ch7N-An>dmF"AGN@;KLrF^\fh+DG@/DfT?%+EM+)/0K+YCiFN=@ + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-json-payload-with-no-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-json-payload-with-no-delimiters.txt new file mode 100644 index 00000000..e7754d67 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-json-payload-with-no-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**PAYLOAD FOR LATER API USE** + +HQkagAKj/i2_6.EDKKH1ATMs7,!&pP@W-1#F!<.ZB45XgF!<.X,"$BrF*(i,+B*ArGTpFA + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-custom-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-custom-delimiters.txt new file mode 100644 index 00000000..630581d6 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-custom-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**PAYLOAD FOR LATER API USE** + +CUSTOM_ENCODING_DELIMITER_LEFT87cURD_*#4DfTZ)+TMKBCUSTOM_ENCODING_DELIMITER_RIGHT + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-default-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-default-delimiters.txt new file mode 100644 index 00000000..b7e9386a --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-default-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**PAYLOAD FOR LATER API USE** + +<~87cURD_*#4DfTZ)+TMKB~> + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-no-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-no-delimiters.txt new file mode 100644 index 00000000..987051b3 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-custom-section-header-and-small-encoded-plaintext-payload-with-no-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**PAYLOAD FOR LATER API USE** + +87cURD_*#4DfTZ)+TMKB + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-large-encoded-payload-with-custom-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-large-encoded-payload-with-custom-delimiters.txt new file mode 100644 index 00000000..8cbf1792 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-large-encoded-payload-with-custom-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**ENCODED PAYLOAD** + +CUSTOM_ENCODING_DELIMITER_LEFT9Q+r_D'3P3F*2=BA8c:&EZfF;F-F(Jj'ATW'8+EV12CiseACgggfDJdmF!,@=DCco@Bk)7-D'3n.E+rm$/g*Q#DIm<#D..O.BlbD5@:OG$+CoV//0JMG+Eh16Bm"J>De*R#+DG7oF_kc5+CT@E+B*E(E+NotBle?,+E27@ASuU(/g*ksARf:h@<3Q&FWbO0F`M2;+ED.6DI[g1+DkP.F($2%BkMi.+DkP3Bl/!6+EMI;Ch[BnFEM,.DBNY(+Du+8+CT;#FY4e8ARlp+Ci!Ns@rHC,AT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\&>FASc(%+DbV!FEMXIAmoglBju4++E_^B@4WO0FE$Ci=>:ASu4!+E_cK@<,k#/g*o3Ci!Ns+CT)#EHP],+CTD*F_)\0DBNA.@s&o8F`V&,E+sDF+DG@/FE2):FD5`;AKZ/-Ch[u6Bl8$(Eb'<0/g*u2DeX)3F`\aDF_kl&+ELt(BlnH2F"AGFAnGaeBlnK<+DkP0EbTS;F(Jl5+Cno"Bju4++Dbt:ASj%B;g!/#ASu$mF)tn8Ch7N-An>dmF"AGN@;KLrF^\fh+DG@/DfT?%+EM+)/0K+YCiFN=@ + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-large-encoded-payload-with-no-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-large-encoded-payload-with-no-delimiters.txt new file mode 100644 index 00000000..497040b3 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-large-encoded-payload-with-no-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**ENCODED PAYLOAD** + +9Q+r_D'3P3F*2=BA8c:&EZfF;F-F(Jj'ATW'8+EV12CiseACgggfDJdmF!,@=DCco@Bk)7-D'3n.E+rm$/g*Q#DIm<#D..O.BlbD5@:OG$+CoV//0JMG+Eh16Bm"J>De*R#+DG7oF_kc5+CT@E+B*E(E+NotBle?,+E27@ASuU(/g*ksARf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FEMFCF`MA./0JMH+Cf>-F(Jj'ATW'8+Dtn7Bcq82Ch7[0Bk8DuF=n\2F_kl&D'3n2A0?&,Ch[u6@:LF'ASc(&+E27>FC?;%Df'?0A8a(C6uQsS@j#c6BlbD5BkMR)@3BW&A0>c(F(lb,Df'?0A8`T%Ch7dfF_kJ/F(o_=@;TRt/0JA2@s)X0@;[32AS`K2F`MG8F"SS6F`VM5DIdI&F(HJ(Df031ALnsGASc1*F!,X;C`m\;ATVX/D'3q7DI[BkF`):P+D#G)D'3n.E+rm$+DG7oF_kc5+DbV!FEMXU+DG^9An?""ASuU4D'3D2F>t@;]UiFu7BleB1EHPh8AS,Og@qg%-E\&>FASc(%+DbV!FEMXIAmoglBju4++E_^B@4WO0FE$Ci=>:ASu4!+E_cK@<,k#/g*o3Ci!Ns+CT)#EHP],+CTD*F_)\0DBNA.@s&o8F`V&,E+sDF+DG@/FE2):FD5`;AKZ/-Ch[u6Bl8$(Eb'<0/g*u2DeX)3F`\aDF_kl&+ELt(BlnH2F"AGFAnGaeBlnK<+DkP0EbTS;F(Jl5+Cno"Bju4++Dbt:ASj%B;g!/#ASu$mF)tn8Ch7N-An>dmF"AGN@;KLrF^\fh+DG@/DfT?%+EM+)/0K+YCiFN=@ + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-json-payload-with-no-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-json-payload-with-no-delimiters.txt new file mode 100644 index 00000000..c619fac1 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-json-payload-with-no-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**ENCODED PAYLOAD** + +HQkagAKj/i2_6.EDKKH1ATMs7,!&pP@W-1#F!<.ZB45XgF!<.X,"$BrF*(i,+B*ArGTpFA + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-custom-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-custom-delimiters.txt new file mode 100644 index 00000000..8ea881d7 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-custom-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**ENCODED PAYLOAD** + +CUSTOM_ENCODING_DELIMITER_LEFT87cURD_*#4DfTZ)+TMKBCUSTOM_ENCODING_DELIMITER_RIGHT + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-default-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-default-delimiters.txt new file mode 100644 index 00000000..fef8f427 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-default-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**ENCODED PAYLOAD** + +<~87cURD_*#4DfTZ)+TMKB~> + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-no-delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-no-delimiters.txt new file mode 100644 index 00000000..8447bcab --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/plugin-output-gh251-default-section-header-and-small-encoded-plaintext-payload-with-no-delimiters.txt @@ -0,0 +1,26 @@ +OK: Datastore HUSVM-DC1-vol6 space usage (0 VMs) is 0.01% of 18.0TB with 18.0TB remaining [WARNING: 90% , CRITICAL: 95%] +**THRESHOLDS** + +* CRITICAL: 95% datastore usage +* WARNING: 90% datastore usage + +**DETAILED INFO** + +Datastore Space Summary: + +* Name: HUSVM-DC1-vol6 +* Space Used: 2.3GB (0.01%) +* Space Remaining: 18.0TB (99.99%) +* VMs: 0 + + +--- + +* vSphere environment: https://vc1.example.com:443/sdk +* Plugin User Agent: check-vmware/v0.30.6-0-g25fdcdc + + +**ENCODED PAYLOAD** + +87cURD_*#4DfTZ)+TMKB + | 'time'=874ms;;;; diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_with_custom_delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_with_custom_delimiters.txt new file mode 100644 index 00000000..859a1f0a --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_with_custom_delimiters.txt @@ -0,0 +1 @@ +CUSTOM_ENCODING_DELIMITER_LEFTHQkagAKj/i2_6.EDKKH1ATMs7,!&pP@W-1#F!<.ZB45XgF!<.X,"$BrF*(i,+B*ArGTpFACUSTOM_ENCODING_DELIMITER_RIGHT \ No newline at end of file diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_with_default_delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_with_default_delimiters.txt new file mode 100644 index 00000000..3e0e50d7 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_with_default_delimiters.txt @@ -0,0 +1 @@ +<~HQkagAKj/i2_6.EDKKH1ATMs7,!&pP@W-1#F!<.ZB45XgF!<.X,"$BrF*(i,+B*ArGTpFA~> \ No newline at end of file diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_without_delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_without_delimiters.txt new file mode 100644 index 00000000..1b53fb76 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_encoded_without_delimiters.txt @@ -0,0 +1 @@ +HQkagAKj/i2_6.EDKKH1ATMs7,!&pP@W-1#F!<.ZB45XgF!<.X,"$BrF*(i,+B*ArGTpFA \ No newline at end of file diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_unencoded.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_unencoded.txt new file mode 100644 index 00000000..3a767789 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_json_payload_unencoded.txt @@ -0,0 +1 @@ +{"Age":17,"Interests":["books","games", "Crystal Stix"]} \ No newline at end of file diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_with_custom_delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_with_custom_delimiters.txt new file mode 100644 index 00000000..94b61ad5 --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_with_custom_delimiters.txt @@ -0,0 +1 @@ +CUSTOM_ENCODING_DELIMITER_LEFT87cURD_*#4DfTZ)+TMKBCUSTOM_ENCODING_DELIMITER_RIGHT \ No newline at end of file diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_with_default_delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_with_default_delimiters.txt new file mode 100644 index 00000000..7dc110ff --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_with_default_delimiters.txt @@ -0,0 +1 @@ +<~87cURD_*#4DfTZ)+TMKB~> \ No newline at end of file diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_without_delimiters.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_without_delimiters.txt new file mode 100644 index 00000000..0d7f36fb --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_encoded_without_delimiters.txt @@ -0,0 +1 @@ +87cURD_*#4DfTZ)+TMKB \ No newline at end of file diff --git a/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_unencoded.txt b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_unencoded.txt new file mode 100644 index 00000000..b45ef6fe --- /dev/null +++ b/vendor/github.com/atc0005/go-nagios/testdata/payload/small_plaintext_payload_unencoded.txt @@ -0,0 +1 @@ +Hello, World! \ No newline at end of file diff --git a/vendor/modules.txt b/vendor/modules.txt index 6b7a39f9..a5ce84ab 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/atc0005/go-nagios v0.16.2 +# github.com/atc0005/go-nagios v0.17.0-alpha.1 ## explicit; go 1.19 github.com/atc0005/go-nagios # github.com/grantae/certinfo v0.0.0-20170412194111-59d56a35515b