Giter Site home page Giter Site logo

go-nagios's Introduction

go-nagios

This library is a small set of tools that make writing Nagios-style checks a bit easier. The goal is for the primitives that this library exports to follow the guidelines set forth in the Nagios Plugin Development Guidelines.

Installation

go get github.com/segfaultax/go-nagios

Usage

Check

The Check type represents a very barebones Nagios check. A complete example of how to use Check is in examples/check.

RangeCheck

The RangeCheck type represents a class of Nagios checks that are specifically checking ranges of numerical values. This logic is easy to implement yourself with the normal Check type, but it's repetitive to do so. RangeCheck offers a simple API for setting warning and critical ranges for your check. See a complete example in examples/rangecheck.

PerfData

The PerfData type represents Nagios performance data. Many monitoring systems (such as Nagios and Sensu) will interpret this data and store it for later querying. You can read about Nagios performance data here. Both the Check and RangeCheck types supporting adding arbitrary performance data to the check results. See the examples/ directory on how to do that.

Range

The Range type represents a Nagios threshold range.

Ref: Nagios Documentation

import "github.com/segfaultax/go-nagios"

r1 := nagios.NewRange(0, 100, false) // exclusive range outside of 0 - 100
r1.InRange(50) // false
r1.InRange(250) // true

r2 := nagios.NewRange(0, 100, true) // inclusive range between 0 - 100
r2.InRange(50) // true
r2.InRange(250) // false

Range also supports parsing a Nagios-style threshold string.

import "github.com/segfaultax/go-nagios"

r1 := nagios.ParseRange("100") // exclusive range outside of 0 - 100
r1.InRange(50) // false
r1.InRange(250) // true

r2 := nagios.ParseRange("@100") // inclusive range between 0 - 100
r1.InRange(50) // false
r1.InRange(250) // true

See the Nagios documentation for a full description of the range format specification.

Contributors

  • Michael-Keith Bernard (@segfaultax)

License

This project is released under the MIT license. See LICENSE for details.

go-nagios's People

Contributors

segfaultax avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.