icinga2_go_checktools

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 7 Imported by: 0

README

ICINGA2 go-checktools

Project description

ICINGA2 go-checkltools is set of tools for writing ICINGA2 check module in GO.

Project dependencies

See go.mod files

Documentation

Index

Constants

View Source
const (

	// Ok SwStatus
	OkMsg  = "OK"
	OkExit = 0

	// Warning SwStatus
	WarMsg  = "WARNING"
	WarExit = 1

	// Critial SwStatus
	CriMsg  = "CRITICAL"
	CriExit = 2

	// Unknown SwStatus
	UnkMsg  = "UNKNOWN"
	UnkExit = 3
)

noinspection ALL

Variables

This section is empty.

Functions

This section is empty.

Types

type Icinga

type Icinga struct {
	Message string
	Exit    int
	Metric  string
}

func (Icinga) String

func (ict Icinga) String() string

Stringer to display/print Icinga struct

type SSHTools

type SSHTools struct {
	Stdout string
	// contains filtered or unexported fields
}

func NewSSHTools

func NewSSHTools(host string, username string, password string, identity string, port int) (*SSHTools, error)

NewSSHTools establish SSH connection to a server and return SSHTools object or nil if an error occurs

func (*SSHTools) CleanStdOutBuffer

func (ict *SSHTools) CleanStdOutBuffer()

func CleanStdOutBuffer Remove consecutive blank char and newline of Stdout

func (*SSHTools) SendSSH

func (ict *SSHTools) SendSSH(command string) error

func SendSSH Send command to remote SSH server and save Output in Stdout noinspection GoUnhandledErrorResult

func (*SSHTools) SendSSHhasPTY

func (ict *SSHTools) SendSSHhasPTY(commands []string, prompt string) error

SendSSHhasPTY send multiple command to remote SSH session simulating a "human" ssh connection SendSSH must be preferred as SendSSHhasPTY, if prompt is misconfigured function will block noinspection GoUnhandledErrorResult

type SwitchInterface

type SwitchInterface interface {
	ParseInterfaceStatus(response string) error
	ReturnIcingaResult() Icinga
	CheckInterfaceStatus(host string, username string, password string, identity string, port int) (Icinga, error)
	Status() []SwitchInterfaceStatus
}

type SwitchInterfaceStatus

type SwitchInterfaceStatus struct {
	Port   string
	Name   string
	Status string
	Vlan   string
	Duplex string
	Speed  string
	Type   string
}

Start Definition for switch monitoring

func (SwitchInterfaceStatus) String

func (sws SwitchInterfaceStatus) String() string

String to display/print Switch

type SwitchStatus

type SwitchStatus struct {
	Name     string
	SwStatus []SwitchInterfaceStatus
}

Jump to

Keyboard shortcuts

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