Skip to content
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

Audit plugin exit states to determine if another state (e.g., UNKNOWN) would be more applicable #171

Open
atc0005 opened this issue Mar 2, 2023 · 1 comment

Comments

@atc0005
Copy link
Owner

atc0005 commented Mar 2, 2023

Overview

While implementing performance data handling as part of atc0005/check-cert#445 I found myself choosing to do one of:

  • emitting an error and continuing
  • exiting with an UNKNOWN status

Either seemed more appropriate than exiting with either of CRITICAL or WARNING state.

To keep mostly current logic intact I opted to just emit the error as a log message and continue:

	pd, perfDataErr := getPerfData(certChain, cfg.AgeCritical, cfg.AgeWarning)
	if perfDataErr != nil {
		log.Error().
			Err(perfDataErr).
			Msg("failed to generate performance data")

		// Surface the error in plugin output.
		plugin.AddError(perfDataErr)

		// TODO: Abort plugin execution with UNKNOWN status?
	}

	if err := plugin.AddPerfData(false, pd...); err != nil {
		log.Error().
			Err(err).
			Msg("failed to add performance data")

		// Surface the error in plugin output.
		plugin.AddError(err)

		// TODO: Abort plugin execution with UNKNOWN status?
	}

I'm filing this GH issue as a reminder to revisit that decision in the larger context of current plugin logic as it pertains to the Nagios Plugin Guidelines (see refs):

Numeric Value Service Status Status Description
0 OK The plugin was able to check the service and it appeared to be functioning properly
1 Warning The plugin was able to check the service, but it appeared to be above some "warning" threshold or did not appear to be working properly
2 Critical The plugin detected that either the service was not running or it was above some "critical" threshold
3 Unknown Invalid command line arguments were supplied to the plugin or low-level failures internal to the plugin (such as unable to fork, or open a tcp socket) that prevent it from performing the specified operation. Higher-level errors (such as name resolution errors, socket timeouts, etc) are outside of the control of plugins and should generally NOT be reported as UNKNOWN states.

References

@atc0005 atc0005 added this to the Next Release milestone Mar 2, 2023
@atc0005 atc0005 self-assigned this Mar 2, 2023
atc0005 added a commit that referenced this issue May 18, 2023
Update handling of invalid flags/values to use an UNKNOWN
exit state to comply with Nagios Plugin Guideline
recommendations.

refs GH-171
refs atc0005/todo#55
refs https://nagios-plugins.org/doc/guidelines.html
@atc0005 atc0005 reopened this May 18, 2023
@atc0005
Copy link
Owner Author

atc0005 commented May 18, 2023

#187 resolved one issue, but others remain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant