nagios

package module
v0.0.0-...-551b6ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2020 License: BSD-2-Clause Imports: 2 Imported by: 4

README

Archived header

Go Nagios

This is a package with simple support for writing Nagios checks in Go. Includes a few simple types and methods for behaving as a Nagios check.

Supports aggregating multiple check statuses into a final status and message, with the highest priority winning out.

You might check out check_docker for a good example of how to use it.

Contributions

Contributions are more than welcome. Bug reports with specific reproduction steps are great. If you have a code contribution you'd like to make, open a pull request with suggested code.

Pull requests should:

  • Clearly state their intent in the title
  • Have a description that explains the need for the changes
  • Include tests!
  • Not break the public API

Copyright (c) 2014 New Relic, Inc. All rights reserved.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Critical

func Critical(err error)

Exit with an CRITICAL status and appropriate message

func ExitWithStatus

func ExitWithStatus(status *NagiosStatus)

Exit with a particular NagiosStatus

func Ok

func Ok(output string)

Exit with an OK status and appropriate message

func Unknown

func Unknown(output string)

Exit with an UNKNOWN status and appropriate message

func Warning

func Warning(output string)

Exit with an WARNING status and appropriate message

Types

type NagiosStatus

type NagiosStatus struct {
	Message string
	Value   NagiosStatusVal
}

A type representing a Nagios check status. The Value is a the exit code expected for the check and the Message is the specific output string.

func (*NagiosStatus) Aggregate

func (status *NagiosStatus) Aggregate(otherStatuses []*NagiosStatus)

Take a bunch of NagiosStatus pointers and find the highest value, then combine all the messages. Things win in the order of highest to lowest.

type NagiosStatusVal

type NagiosStatusVal int
const (
	NAGIOS_OK NagiosStatusVal = iota
	NAGIOS_WARNING
	NAGIOS_CRITICAL
	NAGIOS_UNKNOWN
)

The values with which a Nagios check can exit

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL