results

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package results implements a helper that can be used to store the results of a Nagios, Centreon, Icinga... service monitoring plugin, and convert them to text which can be sent to the monitoring server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Results

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

Results represents the monitoring plugin's results, including its name, return status and message, additional lines of text, and performance data to be encoded in the output.

func New

func New(name string) *Results

New creates the plugin with `name` as its name and an unknown status.

func (*Results) AddLine

func (p *Results) AddLine(line string)

AddLine adds the specified string to the extra output text buffer.

func (*Results) AddLinef

func (p *Results) AddLinef(format string, data ...interface{})

AddLinef formats the input and adds it to the text buffer.

func (*Results) AddLines

func (p *Results) AddLines(lines []string)

AddLines add the specified `lines` to the output text.

func (*Results) AddPerfData

func (p *Results) AddPerfData(pd *perfdata.PerfData)

AddPerfData adds performance data described by the "pd" argument to the output's performance data. If two performance data records are added for the same label, the program panics.

func (*Results) ExitCode

func (p *Results) ExitCode() int

ExitCode returns the plugin's exit code.

func (*Results) SetState

func (p *Results) SetState(status status.Status, message string)

SetState sets the plugin's output code to `status` and its message to the specified `message`.

func (*Results) String

func (p *Results) String() string

String generates the plugin's text output from its name, status, text data and performance data.

Jump to

Keyboard shortcuts

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