nrpe

package module
v0.0.0-...-53d9ca0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2017 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package nrpe implements NRPE client/server library for go.

It supports plain mode and fully compatible with standard nrpe library.

Index

Examples

Constants

View Source
const (
	StatusOK       = 0
	StatusWarning  = 1
	StatusCritical = 2
	StatusUnknown  = 3
)

Result status codes

Variables

This section is empty.

Functions

func ServeOne

func ServeOne(conn net.Conn, handler func(Command) (*CommandResult, error),
	isSSL bool, timeout time.Duration) error

ServeOne function will handle one request. After receiving request it will call handler callback function and the result of callback will be sent to requester.

Types

type Command

type Command struct {
	Name string
	Args []string
}

Command represents command name and argument list

func NewCommand

func NewCommand(name string, args ...string) Command

NewCommand creates Command object with the given name and optional argument list

type CommandResult

type CommandResult struct {
	StatusLine string
	StatusCode CommandStatus
}

CommandResult holds information returned from nrpe server

func Run

func Run(conn net.Conn, command Command, isSSL bool,
	timeout time.Duration) (*CommandResult, error)

Run specified command

Example
conn, err := net.Dial("tcp", "127.0.0.1:5666")
if err != nil {
	fmt.Println(err)
	return
}

command := NewCommand("check_load")

// ssl = true, timeout = 0
result, err := Run(conn, command, true, 0)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(result.StatusLine)
os.Exit(int(result.StatusCode))

type CommandStatus

type CommandStatus int

CommandStatus represents result status code

Directories

Path Synopsis
cmd
check_nrpe command
check_nrpe is a command line NRPE client.
check_nrpe is a command line NRPE client.

Jump to

Keyboard shortcuts

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