naglib

package
v0.0.0-...-d7dc65d Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_COMMAND_TIMEOUT = 60 // nrpe.c
View Source
const DEFAULT_TIMEOUT = 60 * time.Second
View Source
const MAX_FILENAME_LENGTH = 256 // common.h
View Source
const MAX_INPUT_BUFFER = 2048 // common.h
View Source
const MAX_PLUGIN_OUTPUT_LENGTH = 4095
View Source
const NRPE_BAD_COMMAND = "Invalid command specified in config file '%s' - Line %d"
View Source
const NRPE_BAD_TIMEOUT = "Invalid command_timeout specified in config file '%s' - Line %d"
View Source
const NRPE_DIR_OPEN_ERR = "Could not open config directory '%s' for reading."
View Source
const NRPE_FILE_OPEN_ERR = "Unable to open config file '%s' for reading"
View Source
const NRPE_NO_VAL_ERR = "No variable value specified in config file '%s' - Line '%d'"
View Source
const NRPE_NO_VAR_ERR = "No variable name specified in config file '%s' - Line '%d'"

Variables

This section is empty.

Functions

func DefaultOutputIfBlank

func DefaultOutputIfBlank(output string, status PluginStatus) string

func TruncateAndEnforceNewline

func TruncateAndEnforceNewline(output string) string

func TruncateUTF8StringAtByte

func TruncateUTF8StringAtByte(str string, at int) string

Types

type ExitStatusTreatment

type ExitStatusTreatment struct {
	CriticalWarnings bool
	CriticalUnknowns bool
	CriticalExcess   bool
	TolerantExcess   bool
}

type Message

type Message struct {
	Message  string
	Severity PluginStatus
	Err      error
}

type NagiosConfig

type NagiosConfig struct {
	RunAsUser      string
	RunAsGroup     string
	AllowArguments bool
	CommandPrefix  string
	CommandTimeout time.Duration
	NonFatalErrors []error
	Commands       map[string]string
}

func NewNagiosConfig

func NewNagiosConfig() *NagiosConfig

func ParseConfig

func ParseConfig(filename string) (*NagiosConfig, error)

type PluginContext

type PluginContext struct {
	NagiosConfig        *NagiosConfig
	ExitStatusTreatment *ExitStatusTreatment
	Messages            []Message
}

func (*PluginContext) Add

func (pc *PluginContext) Add(severity PluginStatus, message string)

type PluginResult

type PluginResult struct {
	OriginalOutput string
	Output         string
	Status         PluginStatus
}

func RunPlugin

func RunPlugin(context *PluginContext, command string, args ...string) (PluginResult, error)

type PluginStatus

type PluginStatus int
const (
	OK       PluginStatus = 0
	WARNING  PluginStatus = 1
	CRITICAL PluginStatus = 2
	UNKNOWN  PluginStatus = 3
)

func ExitStatusToPluginStatus

func ExitStatusToPluginStatus(exitStatus int, treatment *ExitStatusTreatment) PluginStatus

func (PluginStatus) Color

func (pluginStatus PluginStatus) Color() ct.Color

func (PluginStatus) String

func (pluginStatus PluginStatus) String() string

Jump to

Keyboard shortcuts

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