neb

package
v0.0.0-...-42e4d17 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2017 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProcessData                   = C.NEBCALLBACK_PROCESS_DATA
	TimedEventData                = C.NEBCALLBACK_TIMED_EVENT_DATA
	LogData                       = C.NEBCALLBACK_LOG_DATA
	SystemCommandData             = C.NEBCALLBACK_SYSTEM_COMMAND_DATA
	EventHandlerData              = C.NEBCALLBACK_EVENT_HANDLER_DATA
	NotificationData              = C.NEBCALLBACK_NOTIFICATION_DATA
	ServiceCheckData              = C.NEBCALLBACK_SERVICE_CHECK_DATA
	HostCheckData                 = C.NEBCALLBACK_HOST_CHECK_DATA
	CommentData                   = C.NEBCALLBACK_COMMENT_DATA
	DowntimeData                  = C.NEBCALLBACK_DOWNTIME_DATA
	FlappingData                  = C.NEBCALLBACK_FLAPPING_DATA
	ProgramStatusData             = C.NEBCALLBACK_PROGRAM_STATUS_DATA
	HostStatusData                = C.NEBCALLBACK_HOST_STATUS_DATA
	ServiceStatusData             = C.NEBCALLBACK_SERVICE_STATUS_DATA
	AdaptiveProgramData           = C.NEBCALLBACK_ADAPTIVE_PROGRAM_DATA
	AdaptiveHostData              = C.NEBCALLBACK_ADAPTIVE_HOST_DATA
	AdaptiveServiceData           = C.NEBCALLBACK_ADAPTIVE_SERVICE_DATA
	ExternalCommandData           = C.NEBCALLBACK_EXTERNAL_COMMAND_DATA
	AggregatedStatusData          = C.NEBCALLBACK_AGGREGATED_STATUS_DATA
	RetentionData                 = C.NEBCALLBACK_RETENTION_DATA
	ContactNotificationData       = C.NEBCALLBACK_CONTACT_NOTIFICATION_DATA
	ContactNotificationMethodData = C.NEBCALLBACK_CONTACT_NOTIFICATION_METHOD_DATA
	AcknowledgementData           = C.NEBCALLBACK_ACKNOWLEDGEMENT_DATA
	StateChangeData               = C.NEBCALLBACK_STATE_CHANGE_DATA
	ContactStatusData             = C.NEBCALLBACK_CONTACT_STATUS_DATA
	AdaptiveContactData           = C.NEBCALLBACK_ADAPTIVE_CONTACT_DATA
)
View Source
const (
	//CoreNagios3 is an constant which represents the nagios3 core
	CoreNagios3 = C.CORE_NAGIOS3
	//CoreNagios4 is an constant which represents the nagios4 core
	CoreNagios4 = C.CORE_NAGIOS4
	//CoreNaemon is an constant which represents the naemon core
	CoreNaemon = C.CORE_NAEMON
)
View Source
const (
	//ServicecheckInitiate a check of the route to the host has been initiated
	ServicecheckInitiate = C.NEBTYPE_SERVICECHECK_INITIATE
	//ServicecheckProcessed the processed/final result of a service check
	ServicecheckProcessed = C.NEBTYPE_SERVICECHECK_PROCESSED

	//HostcheckInitiate a check of the route to the host has been initiated
	HostcheckInitiate = C.NEBTYPE_HOSTCHECK_INITIATE
	//HostcheckProcessed the processed/final result of a host check
	HostcheckProcessed = C.NEBTYPE_HOSTCHECK_PROCESSED

	NotificationStart = C.NEBTYPE_NOTIFICATION_START
	NotificationEnd   = C.NEBTYPE_NOTIFICATION_END

	ContactNotificationStart = C.NEBTYPE_CONTACTNOTIFICATION_START
	ContactNotificationEnd   = C.NEBTYPE_CONTACTNOTIFICATION_END
)
View Source
const (
	//Ok OK
	Ok = C.NEB_OK
	//Error Error
	Error = C.NEB_ERROR
	// True True
	True = C.NEB_TRUE
	//False False
	False = C.NEB_FALSE
	//errorNomem memory could not be allocated
	ErrorNomem = C.NEBERROR_NOMEM
	//errorNocallbackfunc no callback function was specified
	ErrorNocallbackfunc = C.NEBERROR_NOCALLBACKFUNC
	// errorNocallbacklist callback list not initialized
	ErrorNocallbacklist = C.NEBERROR_NOCALLBACKLIST
	//errorCallbackbounds callback type was out of bounds
	ErrorCallbackbounds = C.NEBERROR_CALLBACKBOUNDS
	//errorCallbacknotfound the callback could not be found
	ErrorCallbacknotfound = C.NEBERROR_CALLBACKNOTFOUND
	//errorNomodulehandle no module handle specified
	ErrorNomodulehandle = C.NEBERROR_NOMODULEHANDLE
	//errorBadmodulehandle bad module handle
	ErrorBadmodulehandle = C.NEBERROR_BADMODULEHANDLE
	//errorCallbackoverride module wants to override default Nagios handling of event
	ErrorCallbackoverride = C.NEBERROR_CALLBACKOVERRIDE
	//errorCallbackcancel module wants to cancel callbacks to other modules
	ErrorCallbackcancel = C.NEBERROR_CALLBACKCANCEL
	//errorNomodule no module was specified
	ErrorNomodule = C.NEBERROR_NOMODULE
	//errorModinfobounds module info index was out of bounds
	ErrorModinfobounds = C.NEBERROR_MODINFOBOUNDS
)
View Source
const (
	//InfoMessage log level for messages
	InfoMessage = C.NSLOG_INFO_MESSAGE
)

Variables

View Source
var Author = ""

Author is used for the module info

View Source
var CallbackTimeout = time.Duration(10) * time.Millisecond

CallbackTimeout is the duration each callback has to return. This can be changed at the beginning.

View Source
var CoreLogPrefix = ""

CoreLogPrefix change this to your custom prefix for the core log

View Source
var Desc = ""

Desc is used for the module info

View Source
var License = ""

License is used for the module info

View Source
var Name = "go_neb_broker"

Name is used for some default logs

View Source
var NebModuleDeinitHook func(flags, reason int) int

NebModuleDeinitHook gives you access to the flags and reason which the core passes to the brokers, when it's unloading your code. This function will be called at the end of the deinit function return Ok if everything went well

View Source
var NebModuleInitHook func(flags int, args string) int

NebModuleInitHook gives you access to the flags and args which the core passes to the brokers, when it's loading your code. This function will be called at the end of the init function return Ok if everything went well

View Source
var Title = ""

Title is used for the module info

View Source
var Version = ""

Version is used for the module info

Functions

func AddCallback

func AddCallback(callbackType int, callback Callback)

AddCallback can be uses to register a function for a certain event

func CallbackTypeToString

func CallbackTypeToString(callbackType int) string

func CoreDump

func CoreDump(v interface{})

CoreDump dumps the object as string to the core log

func CoreFLog

func CoreFLog(format string, a ...interface{})

CoreFLog will log to the corelog with prefix

func CoreFLogWithoutPrefix

func CoreFLogWithoutPrefix(format string, a ...interface{})

CoreFLogWithoutPrefix will log to the corelog without prefix

func CoreLog

func CoreLog(msg string)

CoreLog passes the given string to the core which logs in the configured file

func CoreToString

func CoreToString() string

CoreToString will return the core name for which the code is compile for

func DeregisterGenericCallback

func DeregisterGenericCallback(callbacktype int64)

DeregisterGenericCallback capsules the c function neb_deregister_callback and passes the generic_callback handler

func Dump

func Dump(v interface{})

Dump can be uses to dump any data to stderr

func Generic_Callback

func Generic_Callback(callbackType int, data unsafe.Pointer) int

Generic_Callback this is a mapping function for C, do not use it on your own.

func GetCoreType

func GetCoreType() int

GetCoreType returns the C const CORE_TYPE which defines on which core the code is compiled

func GetHosts

func GetHosts() structs.HostList

func GetServices

func GetServices() structs.ServiceList

func GoNebModuleDeinit

func GoNebModuleDeinit(flags, reason int) C.int

func GoNebModuleInit

func GoNebModuleInit(flags int, args *C.char) C.int

func IsCoreNaemon

func IsCoreNaemon() bool

IsCoreNaemon the code was compiled for naemon

func IsCoreNagios3

func IsCoreNagios3() bool

IsCoreNagios3 the code was compiled for nagios3

func IsCoreNagios4

func IsCoreNagios4() bool

IsCoreNagios4 the code was compiled for nagios4

func RegisterGenericCallback

func RegisterGenericCallback(callbacktype int64)

RegisterGenericCallback capsules the c function neb_register_callback and passes the generic_callback handler

Types

type Callback

type Callback func(int, unsafe.Pointer) int

Callback defines an function, which will be called by the core Return your result in the channel

type Statistics

type Statistics struct {
	OverallCallbackDuration   chan map[int]time.Duration
	RegisteredCallbacksByType chan map[int]int
}
var Stats *Statistics

Statistics if you create an Statistics object and place it here, make sure you are reading the channels, otherwise the whole module will be slowed down! This can be changed at the beginning.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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