diff --git a/go.mod b/go.mod index d9b05619..9e972fed 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ module github.com/atc0005/check-vmware go 1.19 require ( - github.com/atc0005/go-nagios v0.14.0 + github.com/atc0005/go-nagios v0.15.0 github.com/google/go-cmp v0.5.9 github.com/rs/zerolog v1.29.1 github.com/vmware/govmomi v0.30.4 diff --git a/go.sum b/go.sum index 20f8a652..9127585a 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/atc0005/go-nagios v0.14.0 h1:xtOa/MJDvk4SSicAV5B8VlyiHu/85+Ode/aUGj99euw= -github.com/atc0005/go-nagios v0.14.0/go.mod h1:U9k9W4hUskZhVCo9vGBILW2+eWRZh1ZaA+SN5g69CbY= +github.com/atc0005/go-nagios v0.15.0 h1:CxAR6fLXkSvMFZxsYh/HSErp/oad94vl9j65RcZaOjA= +github.com/atc0005/go-nagios v0.15.0/go.mod h1:TlE2JBMuI64lM01MqobahTA94hgtVefvEzyKtvIHToo= 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= @@ -18,7 +18,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/vmware/govmomi v0.30.4 h1:BCKLoTmiBYRuplv3GxKEMBLtBaJm8PA56vo9bddIpYQ= github.com/vmware/govmomi v0.30.4/go.mod h1:F7adsVewLNHsW/IIm7ziFURaXDaHEwcc+ym4r3INMdY= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/vendor/github.com/atc0005/go-nagios/CHANGELOG.md b/vendor/github.com/atc0005/go-nagios/CHANGELOG.md index 5c2a7cd3..57644650 100644 --- a/vendor/github.com/atc0005/go-nagios/CHANGELOG.md +++ b/vendor/github.com/atc0005/go-nagios/CHANGELOG.md @@ -26,6 +26,28 @@ The following types of changes will be recorded in this file: - placeholder +## [v0.15.0] - 2023-05-31 + +### Added + +- (GH-192) Add another perfdata success parsing test case +- (GH-203) Add state lookup helper functions +- (GH-204) Add "quick" Makefile recipe + +### Changed + +- Dependencies + - `stretchr/testify` + - `v1.8.1` to `v1.8.4` +- (GH-194) Drop `Push Validation` workflow +- (GH-195) Rework workflow scheduling +- (GH-197) Remove `Push Validation` workflow status badge + +### Fixed + +- (GH-199) Update vuln analysis GHAW to use on.push hook +- (GH-201) Fix revive linting errors + ## [v0.14.0] - 2023-01-27 ### Added @@ -455,7 +477,8 @@ Initial package state - Nagios state map -[Unreleased]: https://github.com/atc0005/go-nagios/compare/v0.14.0...HEAD +[Unreleased]: https://github.com/atc0005/go-nagios/compare/v0.15.0...HEAD +[v0.15.0]: https://github.com/atc0005/go-nagios/releases/tag/v0.15.0 [v0.14.0]: https://github.com/atc0005/go-nagios/releases/tag/v0.14.0 [v0.13.0]: https://github.com/atc0005/go-nagios/releases/tag/v0.13.0 [v0.12.1]: https://github.com/atc0005/go-nagios/releases/tag/v0.12.1 diff --git a/vendor/github.com/atc0005/go-nagios/Makefile b/vendor/github.com/atc0005/go-nagios/Makefile index 93bdcebd..bee2d7cf 100644 --- a/vendor/github.com/atc0005/go-nagios/Makefile +++ b/vendor/github.com/atc0005/go-nagios/Makefile @@ -100,6 +100,11 @@ pristine: goclean gitclean all: clean build @echo "Completed build process ..." +.PHONY: quick +## quick: alias for build recipe +quick: clean build + @echo "Completed tasks for quick build" + .PHONY: build ## build: ensure that packages build build: diff --git a/vendor/github.com/atc0005/go-nagios/README.md b/vendor/github.com/atc0005/go-nagios/README.md index ef5f68cf..76d92773 100644 --- a/vendor/github.com/atc0005/go-nagios/README.md +++ b/vendor/github.com/atc0005/go-nagios/README.md @@ -8,7 +8,6 @@ Shared Golang package for Nagios plugins [![go.mod Go version](https://img.shields.io/github/go-mod/go-version/atc0005/go-nagios)](https://github.com/atc0005/go-nagios) [![Lint and Build](https://github.com/atc0005/go-nagios/actions/workflows/lint-and-build.yml/badge.svg)](https://github.com/atc0005/go-nagios/actions/workflows/lint-and-build.yml) [![Project Analysis](https://github.com/atc0005/go-nagios/actions/workflows/project-analysis.yml/badge.svg)](https://github.com/atc0005/go-nagios/actions/workflows/project-analysis.yml) -[![Push Validation](https://github.com/atc0005/go-nagios/actions/workflows/push-validation.yml/badge.svg)](https://github.com/atc0005/go-nagios/actions/workflows/push-validation.yml) ## Table of contents diff --git a/vendor/github.com/atc0005/go-nagios/nagios.go b/vendor/github.com/atc0005/go-nagios/nagios.go index 43b14889..0fe61b07 100644 --- a/vendor/github.com/atc0005/go-nagios/nagios.go +++ b/vendor/github.com/atc0005/go-nagios/nagios.go @@ -438,3 +438,91 @@ func defaultTimeMetric(start time.Time) PerformanceData { UnitOfMeasurement: defaultTimeMetricUnitOfMeasurement, } } + +// SupportedStateLabels returns a list of valid plugin state labels. +func SupportedStateLabels() []string { + return []string{ + StateOKLabel, + StateWARNINGLabel, + StateCRITICALLabel, + StateUNKNOWNLabel, + StateDEPENDENTLabel, + } +} + +// SupportedExitCodes returns a list of valid plugin exit codes. +func SupportedExitCodes() []int { + return []int{ + StateOKExitCode, + StateWARNINGExitCode, + StateCRITICALExitCode, + StateUNKNOWNExitCode, + StateDEPENDENTExitCode, + } +} + +// SupportedServiceStates returns a collection of valid plugin service states. +func SupportedServiceStates() []ServiceState { + return []ServiceState{ + { + Label: StateOKLabel, + ExitCode: StateOKExitCode, + }, + { + Label: StateWARNINGLabel, + ExitCode: StateWARNINGExitCode, + }, + { + Label: StateCRITICALLabel, + ExitCode: StateCRITICALExitCode, + }, + { + Label: StateUNKNOWNLabel, + ExitCode: StateUNKNOWNExitCode, + }, + { + Label: StateDEPENDENTLabel, + ExitCode: StateDEPENDENTExitCode, + }, + } +} + +// StateLabelToExitCode returns the corresponding plugin exit code for the +// given plugin state label. If an invalid value is provided the +// StateUNKNOWNExitCode value is returned. +func StateLabelToExitCode(label string) int { + switch strings.ToUpper(label) { + case StateOKLabel: + return StateOKExitCode + case StateWARNINGLabel: + return StateWARNINGExitCode + case StateCRITICALLabel: + return StateCRITICALExitCode + case StateUNKNOWNLabel: + return StateUNKNOWNExitCode + case StateDEPENDENTLabel: + return StateDEPENDENTExitCode + default: + return StateUNKNOWNExitCode + } +} + +// ExitCodeToStateLabel returns the corresponding plugin state label for the +// given plugin exit code. If an invalid value is provided the +// StateUNKNOWNLabel value is returned. +func ExitCodeToStateLabel(exitCode int) string { + switch exitCode { + case StateOKExitCode: + return StateOKLabel + case StateWARNINGExitCode: + return StateWARNINGLabel + case StateCRITICALExitCode: + return StateCRITICALLabel + case StateUNKNOWNExitCode: + return StateUNKNOWNLabel + case StateDEPENDENTExitCode: + return StateDEPENDENTLabel + default: + return StateUNKNOWNLabel + } +} diff --git a/vendor/github.com/atc0005/go-nagios/perfdata.go b/vendor/github.com/atc0005/go-nagios/perfdata.go index e949ea7f..2e6a8513 100644 --- a/vendor/github.com/atc0005/go-nagios/perfdata.go +++ b/vendor/github.com/atc0005/go-nagios/perfdata.go @@ -230,11 +230,7 @@ func (pd PerformanceData) Validate() error { return err } - if err := validatePerfDataMaxField(pd.Max); err != nil { - return err - } - - return nil + return validatePerfDataMaxField(pd.Max) } // String provides a PerformanceData metric in format ready for use in plugin diff --git a/vendor/modules.txt b/vendor/modules.txt index 53314326..c376c2af 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/atc0005/go-nagios v0.14.0 +# github.com/atc0005/go-nagios v0.15.0 ## explicit; go 1.19 github.com/atc0005/go-nagios # github.com/google/go-cmp v0.5.9