nsca

package module
v0.0.0-...-3c266cf Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2016 License: BSD-3-Clause Imports: 11 Imported by: 1

README

Package nsca

import "github.com/Syncbak-Git/nsca"

Package logging is a Go client for the Nagios Service Check Acceptor.

Documentation is available via godoc.

Documentation

Overview

Package nsca is a Go client for the Nagios Service Check Acceptor (NSCA).

Index

Constants

View Source
const (
	STATE_OK = iota
	STATE_WARNING
	STATE_CRITICAL
	STATE_UNKNOWN
)
View Source
const (
	ENCRYPT_NONE        = iota /* no encryption */
	ENCRYPT_XOR                /* not really encrypted, just obfuscated */
	ENCRYPT_DES                /* DES */
	ENCRYPT_3DES               /* 3DES or Triple DES */
	ENCRYPT_CAST128            /* CAST-128 */            /* UNUSED */
	ENCRYPT_CAST256            /* CAST-256 */            /* UNUSED */
	ENCRYPT_XTEA               /* xTEA */                /* UNUSED */
	ENCRYPT_3WAY               /* 3-WAY */               /* UNUSED */
	ENCRYPT_BLOWFISH           /* SKIPJACK */            /* UNUSED */
	ENCRYPT_TWOFISH            /* TWOFISH */             /* UNUSED */
	ENCRYPT_LOKI97             /* LOKI97 */              /* UNUSED */
	ENCRYPT_RC2                /* RC2 */                 /* UNUSED */
	ENCRYPT_ARCFOUR            /* RC4 */                 /* UNUSED */
	ENCRYPT_RC6                /* RC6 */                 /* UNUSED */
	ENCRYPT_RIJNDAEL128        /* RIJNDAEL-128 */        /* AES-128 */
	ENCRYPT_RIJNDAEL192        /* RIJNDAEL-192 */        /* AES-192 */
	ENCRYPT_RIJNDAEL256        /* RIJNDAEL-256 */        /* AES-256 */
	ENCRYPT_MARS               /* MARS */                /* UNUSED */
	ENCRYPT_PANAMA             /* PANAMA */              /* UNUSED */
	ENCRYPT_WAKE               /* WAKE */                /* UNUSED */
	ENCRYPT_SERPENT            /* SERPENT */             /* UNUSED */
	ENCRYPT_IDEA               /* IDEA */                /* UNUSED */
	ENCRYPT_ENIGMA             /* ENIGMA (Unix crypt) */ /* UNUSED */
	ENCRYPT_GOST               /* GOST */                /* UNUSED */
	ENCRYPT_SAFER64            /* SAFER-sk64 */          /* UNUSED */
	ENCRYPT_SAFER128           /* SAFER-sk128 */         /* UNUSED */
	ENCRYPT_SAFERPLUS          /* SAFER+ */              /* UNUSED */
)

Variables

This section is empty.

Functions

func RunEndpoint

func RunEndpoint(connectInfo ServerInfo, quit <-chan interface{}, messages <-chan *Message)

RunEndpoint creates a long-lived connection to an NSCA server. Messages sent into the messages channel are sent to the NSCA server. Close the quit channel to end the routine. RunEndpoint does it's own initialization, cleanup and error recovery and can safely be used from multiple threads.

Types

type Message

type Message struct {
	// State is one of {STATE_OK, STATE_WARNING, STATE_CRITICAL, STATE_UNKNOWN}
	State int16
	// Host is the host name to set for the NSCA message
	Host string
	// Service is the service name to set for the NSCA message [optional]
	Service string
	// Message is the "plugin output" of the NSCA message [optional]
	Message string
	// Status is an optional channel that recieves the status of a message delivery attempt
	Status chan<- error
}

Message is the contents of an NSCA message

type NSCAServer

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

NSCAServer can be used as a lower-level alternative to RunEndpoint. It is NOT safe to use an instance across mutiple threads.

func (*NSCAServer) Close

func (n *NSCAServer) Close()

Close the connection and clean up.

func (*NSCAServer) Connect

func (n *NSCAServer) Connect(connectInfo ServerInfo) error

Connect to an NSCA server.

func (*NSCAServer) Send

func (n *NSCAServer) Send(message *Message) error

Send an NSCA message.

type ServerInfo

type ServerInfo struct {
	// Host is the IP address or host name of the NSCA server. Leave empty for localhost.
	Host string
	// Port is the IP port number (no default)
	Port string
	// EncryptionMethod specifies the message encryption to use on NSCA messages. It defaults to ENCRYPT_NONE.
	EncryptionMethod int
	// Password is used in encryption.
	Password string
	// Timeout is the connect/read/write network timeout
	Timeout time.Duration
}

ServerInfo contains the configuration information for an NSCA server

Jump to

Keyboard shortcuts

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