Documentation ¶
Index ¶
- Constants
- Variables
- func AddCallback(callbackType int, callback Callback)
- func CallbackTypeToString(callbackType int) string
- func CoreDump(v interface{})
- func CoreFLog(format string, a ...interface{})
- func CoreFLogWithoutPrefix(format string, a ...interface{})
- func CoreLog(msg string)
- func CoreToString() string
- func DeregisterGenericCallback(callbacktype int64)
- func Dump(v interface{})
- func Generic_Callback(callbackType int, data unsafe.Pointer) int
- func GetCoreType() int
- func GetHosts() structs.HostList
- func GetServices() structs.ServiceList
- func GoNebModuleDeinit(flags, reason int) C.int
- func GoNebModuleInit(flags int, args *C.char) C.int
- func IsCoreNaemon() bool
- func IsCoreNagios3() bool
- func IsCoreNagios4() bool
- func RegisterGenericCallback(callbacktype int64)
- type Callback
- type Statistics
Constants ¶
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 )
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 )
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 )
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 )
const ( //InfoMessage log level for messages InfoMessage = C.NSLOG_INFO_MESSAGE )
Variables ¶
var Author = ""
Author is used for the module info
var CallbackTimeout = time.Duration(10) * time.Millisecond
CallbackTimeout is the duration each callback has to return. This can be changed at the beginning.
var CoreLogPrefix = ""
CoreLogPrefix change this to your custom prefix for the core log
var Desc = ""
Desc is used for the module info
var License = ""
License is used for the module info
var Name = "go_neb_broker"
Name is used for some default logs
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
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
var Title = ""
Title is used for the module info
var Version = ""
Version is used for the module info
Functions ¶
func AddCallback ¶
AddCallback can be uses to register a function for a certain event
func CallbackTypeToString ¶
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 Generic_Callback ¶
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 GetServices ¶
func GetServices() structs.ServiceList
func GoNebModuleDeinit ¶
func RegisterGenericCallback ¶
func RegisterGenericCallback(callbacktype int64)
RegisterGenericCallback capsules the c function neb_register_callback and passes the generic_callback handler
Types ¶
type Callback ¶
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.