nagios

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: MIT Imports: 0 Imported by: 36

README

go-nagios

Shared Golang package for Nagios plugins

Latest Release GoDoc Validate Docs

Overview

This package contains common types and package-level variables used when developing Nagios plugins. The intent is to reduce code duplication between various plugins.

Features

  • Nagios state constants

Changelog

See the CHANGELOG.md file for the changes associated with each release of this application. Changes that have been merged to master, but not yet an official release may also be noted in the file under the Unreleased section. A helpful link to the Git commit history since the last official release is also provided for further review.

How to use

Assuming that you're using Go Modules, add this line to your imports like so:

package main

import (
  "fmt"
  "log"
  "os"

  "github.com/atc0005/go-nagios"
)

Then in your code reference the data types as you would from any other package:

fmt.Println("OK: All checks have passed")
os.Exit(nagios.StateOK)

When you next build your package this one should be pulled in.

License

From the LICENSE file:

MIT License

Copyright (c) 2020 Adam Chalkley

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

References

Documentation

Overview

Package nagios provides common types and package-level variables for use with Nagios plugins.

OVERVIEW

This package contains common types and package-level variables. The intent is to reduce code duplication between various plugins that we maintain.

PROJECT HOME

See our GitHub repo (https://github.com/atc0005/go-nagios) for the latest code, to file an issue or submit improvements for review and potential inclusion into the project.

HOW TO USE

Assuming that you're using Go Modules (https://blog.golang.org/using-go-modules), add this line to your imports like so:

package main

import (
"fmt"
"log"
"os"

"github.com/atc0005/go-nagios"
)

Then in your code reference the data types as you would from any other package:

fmt.Println("OK: All checks have passed")
os.Exit(nagios.StateOK)

When you next build your package this one should be pulled in.

Package nagios is a small collection of common types and package-level variables intended for use with various plugins to reduce code duplication.

Index

Constants

View Source
const (
	StateOK        int = 0
	StateWARNING   int = 1
	StateCRITICAL  int = 2
	StateUNKNOWN   int = 3
	StateDEPENDENT int = 4
)

Nagios plugin/service check states. These constants replicate the values from utils.sh which is normally found at one of these two locations, depending on which Linux distribution you're using:

/usr/lib/nagios/plugins/utils.sh
/usr/local/nagios/libexec/utils.sh

See also http://nagios-plugins.org/doc/guidelines.html

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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