nagiosPlugin

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 6 Imported by: 6

README

go-nagios

Library for Nagios plugin in Golang

Documentation

Overview

This file permit to handle the perfdata

Index

Constants

View Source
const (
	STATUS_UNKNOWN  = 3
	STATUS_CRITICAL = 2
	STATUS_WARNING  = 1
	STATUS_OK       = 0
)

Nagios status

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitoring

type Monitoring struct {
	// contains filtered or unexported fields
}

Monitoring data

func NewMonitoring

func NewMonitoring() *Monitoring

NewMonitoring permit to create monitoring object The status is inizialized to Ok

func (*Monitoring) AddMessage

func (m *Monitoring) AddMessage(message string, params ...interface{})

AddMessage permit to add message to display in monitoring tools

func (*Monitoring) AddPerfdata

func (m *Monitoring) AddPerfdata(label string, value int, unit string) error

AddPerfdata permit to add perfdata to display in monitoring tools

func (*Monitoring) AddPerfdataOrDie added in v0.0.2

func (m *Monitoring) AddPerfdataOrDie(label string, value int, unit string)

AddPerfdata permit to add perfdata.It die if some error appear.

func (*Monitoring) Message

func (m *Monitoring) Message(index int) (string, error)

Message permit to get message on given index

func (*Monitoring) Messages

func (m *Monitoring) Messages() []string

Messages permit to get all messages

func (*Monitoring) Perfdata

func (m *Monitoring) Perfdata(index int) (*Perfdata, error)

Perfdata permit to get perfdata on given index

func (*Monitoring) Perfdatas

func (m *Monitoring) Perfdatas() Perfdatas

Perfdatas permit to get all perfdatas

func (*Monitoring) SetStatus

func (m *Monitoring) SetStatus(status int) error

SetStatus permit to set new monitoring status if the current status is more critical that the previous status

func (*Monitoring) SetStatusAsString

func (m *Monitoring) SetStatusAsString(statusString string) error

SetStatusAsString permit to set new monitoring status as string if the current status is more critical that the previous status

func (*Monitoring) SetStatusOrDie

func (m *Monitoring) SetStatusOrDie(status int)

SetStatusOrDie permit to set new monitoring status. It die if some error appear

func (*Monitoring) Status

func (m *Monitoring) Status() int

Status permit to get the monitoring status

func (*Monitoring) ToSdtOut

func (m *Monitoring) ToSdtOut()

ToSdtOut permit to print the state on stdout and exit with the right status code

func (*Monitoring) ToString

func (m *Monitoring) ToString() string

ToString permit to get string from monitoring data

type Perfdata

type Perfdata struct {
	// contains filtered or unexported fields
}

Perfdata struct

func NewPerfdata

func NewPerfdata(label string, value int, unit string) (*Perfdata, error)

NewPerfdata permit to create new perfdata struct It 's' return Perfdata object It's return error if label is empty

func (*Perfdata) Label

func (p *Perfdata) Label() string

Label permit to get label

func (*Perfdata) SetLabel

func (p *Perfdata) SetLabel(label string) error

SetLabel permit to set label

func (*Perfdata) SetUnit

func (p *Perfdata) SetUnit(unit string)

SetUnit permit to set unit

func (*Perfdata) SetValue

func (p *Perfdata) SetValue(value int)

SetValue permit to set value

func (*Perfdata) Unit

func (p *Perfdata) Unit() string

Unit permit to get unit It's return unit as string

func (*Perfdata) Value

func (p *Perfdata) Value() int

Value permit to get value

type Perfdatas

type Perfdatas []*Perfdata

Jump to

Keyboard shortcuts

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