Skip to content

Commit

Permalink
update dev + deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jabdr committed Aug 24, 2019
1 parent 6be1345 commit 9c91e72
Show file tree
Hide file tree
Showing 24 changed files with 151 additions and 59 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# statusengine naemon/nagios broker module (alpha)
# statusengine naemon/nagios broker module

For a production ready broker module [click here](https://github.com/statusengine/module).

Expand Down Expand Up @@ -115,7 +115,7 @@ docker exec -t -i broker_naemon_1 /usr/bin/queuestatus
## License

statusengine - the missing event broker
Copyright (C) 2018 The statusengine team
Copyright (C) 2019 The statusengine team

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
93 changes: 68 additions & 25 deletions devtools/buildenv/statusengine.toml
Original file line number Diff line number Diff line change
@@ -1,35 +1,78 @@
[Queues]
HostStatus = true
HostCheck = true
OCHP = true
ServiceStatus = true
ServiceCheck = true
ServicePerfData = true
OCSP = true
StateChange = true
LogData = true
SystemCommandData = true
CommentData = true
ExternalCommandData = true
AcknowledgementData = true
FlappingData = true
DowntimeData = true
NotificationData = true
ProgramStatusData = true
ContactStatusData = true
ContactNotificationData = true
ContactNotificationMethodData = true
EventHandlerData = true
ProcessData = true
RestartData = true

[[Gearman]]
URL = "gearman:4730"

HostStatus = "statusngin_hoststatus"
HostCheck = "statusngin_hostchecks"
ServiceStatus = "statusngin_servicestatus"
ServiceCheck = "statusngin_servicechecks"
ServicePerfData = "statusngin_service_perfdata"
StateChange = "statusngin_statechanges"
AcknowledgementData = "statusngin_acknowledgements"
FlappingData = "statusngin_flappings"
DowntimeData = "statusngin_downtimes"
ContactNotificationMethodData = "statusngin_contactnotificationmethod"
RestartData = "statusngin_core_restart"
OCHP = "statusngin_ochp"
OCSP = "statusngin_ocsp"
WorkerCommand = "statusngin_cmd"
#WorkerOCHP = "statusngin_ochp"
#WorkerOCSP = "statusngin_ocsp"

SystemCommandData = "statusngin_systemcommands"
CommentData = "statusngin_comments"
ExternalCommandData = "statusngin_externalcommands"
NotificationData = "statusngin_notifications"
ProgramStatusData = "statusngin_programmstatus"
ContactStatusData = "statusngin_contactstatus"
ContactNotificationData = "statusngin_contactnotificationdata"
EventHandlerData = "statusngin_eventhandler"
ProcessData = "statusngin_processdata"
LogData = "statusngin_logentries"


[[Rabbitmq]]
Hostname = "rabbit"
Username = "statusengine"
Password = "statusengine"

HostStatus = "statusngin_hoststatus"
HostCheck = "statusngin_hostchecks"
ServiceStatus = "statusngin_servicestatus"
ServiceCheck = "statusngin_servicechecks"
ServicePerfData = "statusngin_service_perfdata"
StateChange = "statusngin_statechanges"
AcknowledgementData = "statusngin_acknowledgements"
FlappingData = "statusngin_flappings"
DowntimeData = "statusngin_downtimes"
ContactNotificationMethodData = "statusngin_contactnotificationmethod"
RestartData = "statusngin_core_restart"
OCHP = "statusngin_ochp"
OCSP = "statusngin_ocsp"
WorkerCommand = "statusngin_cmd"
#WorkerOCHP = "statusngin_ochp"
#WorkerOCSP = "statusngin_ocsp"

SystemCommandData = "statusngin_systemcommands"
CommentData = "statusngin_comments"
ExternalCommandData = "statusngin_externalcommands"
NotificationData = "statusngin_notifications"
ProgramStatusData = "statusngin_programmstatus"
ContactStatusData = "statusngin_contactstatus"
ContactNotificationData = "statusngin_contactnotificationdata"
EventHandlerData = "statusngin_eventhandler"
ProcessData = "statusngin_processdata"
LogData = "statusngin_logentries"

[Scheduler]
# Used to fix a nasty scheduler behaviour in naemon when you often restart naemon
# If next_schedule of a service or host is in the past during startup, we reschedule
# the service/host within $StartupScheduleMax seconds instead of the check_intervall of the host/service.
StartupScheduleMax = 30

[Bulk]
## Maximum number of messages in one bulk message
Maximum = 2
## Flush Bulk messages every X seconds dispite number of cached messages
FlushInterval = 5
## List of queue identifier which should be created as bulk message. This is a global option for all connections
Queues = ["HostStatus", "HostCheck", "ServiceStatus", "ServiceCheck", "ServicePerfData", "StateChange", "OCHP", "OCSP", "LogData"]
4 changes: 2 additions & 2 deletions devtools/ci/naemon/buildopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
#define NAEMON_LOCALSTATEDIR "/opt/naemon/var"
#define NAEMON_LOGDIR "/opt/naemon/var/log/naemon"
#define NAEMON_LOCKFILE "/opt/naemon/var/cache/naemon/naemon.pid"
#define NAEMON_GROUP "naemon"
#define NAEMON_USER "naemon"
#define NAEMON_GROUP "jdrummer"
#define NAEMON_USER "jdrummer"
#endif
2 changes: 1 addition & 1 deletion devtools/ci/naemon/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ NAGIOS_END_DECL
#define CHECK_OPTION_NONE 0 /* no check options */
#define CHECK_OPTION_FORCE_EXECUTION 1 /* force execution of a check (ignores disabled services/hosts, invalid timeperiods) */
#define CHECK_OPTION_FRESHNESS_CHECK 2 /* this is a freshness check */
/* 4 used to be CHECK_OPTION_ORPHAN_CHECK, but is no longer used */
#define CHECK_OPTION_ORPHAN_CHECK 4 /* flag for scheduled checks from orphan event handler */
#define CHECK_OPTION_DEPENDENCY_CHECK 8 /* dependency check. different scheduling rules apply */
#define CHECK_OPTION_ALLOW_POSTPONE 16 /* allow the check to take precedence over an earlier (sooner) scheduled check */

Expand Down
2 changes: 2 additions & 0 deletions devtools/ci/naemon/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define DEFAULT_MAX_CHECK_RESULT_AGE 3600 /* maximum number of seconds that a check result file is considered to be valid */
#define DEFAULT_MAX_PARALLEL_SERVICE_CHECKS 0 /* maximum number of service checks we can have running at any given time (0=unlimited) */
#define DEFAULT_RETENTION_UPDATE_INTERVAL 60 /* minutes between auto-save of retention data */
#define DEFAULT_RETAINED_SCHEDULING_RANDOMIZE_WINDOW 60 /* number of seconds used for randomizing the re-scheduling of checks missed over a restart */
#define DEFAULT_RETENTION_SCHEDULING_HORIZON 900 /* max seconds between program restarts that we will preserve scheduling information */
#define DEFAULT_STATUS_UPDATE_INTERVAL 60 /* seconds between aggregated status data updates */
#define DEFAULT_FRESHNESS_CHECK_INTERVAL 60 /* seconds between service result freshness checks */
Expand Down Expand Up @@ -86,6 +87,7 @@

#define DEFAULT_ALLOW_EMPTY_HOSTGROUP_ASSIGNMENT 2 /* Allow assigning to empty hostgroups by default, but warn about it */
#define DEFAULT_ALLOW_CIRCULAR_DEPENDENCIES 0 /* Allow circular depdendencies */
#define DEFAULT_HOST_DOWN_DISABLE_SERVICE_CHECKS 0 /* run service checks if the host is down */

#define DEFAULT_HOST_PERFDATA_FILE_TEMPLATE "[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$"
#define DEFAULT_SERVICE_PERFDATA_FILE_TEMPLATE "[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$"
Expand Down
2 changes: 2 additions & 0 deletions devtools/ci/naemon/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ extern int retain_state_information;
extern int retention_update_interval;
extern int use_retained_program_state;
extern int use_retained_scheduling_info;
extern int retained_scheduling_randomize_window;
extern int retention_scheduling_horizon;
extern char *retention_file;
extern unsigned long retained_host_attribute_mask;
Expand Down Expand Up @@ -144,6 +145,7 @@ extern unsigned long max_debug_file_size;

extern int allow_empty_hostgroup_assignment;
extern int allow_circular_dependencies;
extern int host_down_disable_service_checks;

extern time_t last_program_stop;
extern time_t event_start;
Expand Down
3 changes: 3 additions & 0 deletions devtools/ci/naemon/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ const char *get_program_version(void);

void cleanup(void); /* cleanup after ourselves (before quitting or restarting) */

char *escape_plugin_output(const char *);
char *unescape_plugin_output(const char *);

NAGIOS_END_DECL

#endif
17 changes: 15 additions & 2 deletions devtools/ci/nagios/cgiutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ NAGIOS_BEGIN_DECL
#define NAGFUNCS_CSS "nag_funcs.css"

/********************************* JAVASCRIPT INCLUDES **********************/
#define JQUERY_JS "jquery-1.7.1.min.js"
#define JQUERY_JS "jquery-1.12.4.min.js"
#define NAGFUNCS_JS "nag_funcs.js"

/********************************* ICONS ************************************/
Expand Down Expand Up @@ -439,16 +439,25 @@ typedef struct lifo_struct {
struct lifo_struct *next;
} lifo;

struct nagios_extcmd {
const char *name;
int id;
int cmt_opt; /* 0 = not allowed, 1 = optional, 2 = required */
char *default_comment;
};

/******************************** FUNCTIONS *******************************/

typedef void (*read_config_callback)(const char*, const char*);

void reset_cgi_vars(void);
void cgi_init(void (*doc_header)(int), void (*doc_footer)(void), int object_options, int status_options);
void free_memory(void);

const char *get_cgi_config_location(void); /* gets location of the CGI config file to read */
const char *get_cmd_file_location(void); /* gets location of external command file to write to */

int read_cgi_config_file(const char *);
int read_cgi_config_file(const char *, read_config_callback);
int read_main_config_file(const char *);
int read_all_object_configuration_data(const char *, int);
int read_all_status_data(const char *, int);
Expand Down Expand Up @@ -494,5 +503,9 @@ void free_lifo_memory(void);
int push_lifo(char *);
char *pop_lifo(void);

struct nagios_extcmd* extcmd_get_command_id(int);
struct nagios_extcmd* extcmd_get_command_name(const char *);
const char *extcmd_get_name(int);

NAGIOS_END_DECL
#endif
4 changes: 2 additions & 2 deletions devtools/ci/nagios/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

#include "shared.h"

#define PROGRAM_VERSION "4.3.4"
#define PROGRAM_MODIFICATION_DATE "2017-08-24"
#define PROGRAM_VERSION "4.4.5"
#define PROGRAM_MODIFICATION_DATE "2019-08-20"

NAGIOS_BEGIN_DECL

Expand Down
4 changes: 2 additions & 2 deletions devtools/ci/nagios/lib/iobroker.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ extern int iobroker_max_usable_fds(void);
* @param arg Argument passed to input handler on available input
* @param handler The callback function to call when input is available
*
* @return 0 on succes. < 0 on errors.
* @return 0 on success. < 0 on errors.
*/
extern int iobroker_register(iobroker_set *iobs, int sd, void *arg, int (*handler)(int, int, void *));

Expand Down Expand Up @@ -131,7 +131,7 @@ extern int iobroker_get_max_fds(iobroker_set *iobs);
*
* @param iobs The socket set to remove the socket from
* @param sd The socket descriptor to remove
* @return 0 on succes. < 0 on errors.
* @return 0 on success. < 0 on errors.
*/
extern int iobroker_unregister(iobroker_set *iobs, int sd);

Expand Down
2 changes: 1 addition & 1 deletion devtools/ci/nagios/lib/iocache.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extern unsigned long iocache_size(iocache *ioc);
/**
* Returns remaining read capacity of the io cache
* @param ioc The io cache to operate on
* @return The number of bytes available to read
* @return The number of bytes available to read, or -1 if ioc is null, -2 if the buffer is null, or -2 if the buffer size is <= 0
*/
extern unsigned long iocache_capacity(iocache *ioc);

Expand Down
2 changes: 1 addition & 1 deletion devtools/ci/nagios/lib/nsock.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern const char *nsock_strerror(int code);
*
* @param path The path to connect to or create
* @param flags Various options controlling the mode of the socket
* @return An NSOCK_E macro on errors, the created socket on succes
* @return An NSOCK_E macro on errors, the created socket on success
*/
extern int nsock_unix(const char *path, unsigned int flags);

Expand Down
2 changes: 1 addition & 1 deletion devtools/ci/nagios/lib/nspath.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extern char *nspath_absolute(const char *rel_path, const char *base);
* errno gets properly set in case of errors.
* @param rel_path The path to transform
* @param base The base we should operate relative to
* @return Newly allocated canonical path on succes, NULL on errors
* @return Newly allocated canonical path on success, NULL on errors
*/
extern char *nspath_real(const char *rel_path, const char *base);

Expand Down
9 changes: 7 additions & 2 deletions devtools/ci/nagios/lib/nwrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@
*/
static inline ssize_t nwrite(int fd, const void *buf, size_t count, ssize_t *written)
{
/*
* Given the API we have to assume (unsigned) size_t 'count' fits into
* a (signed) ssize_t because we can't return a larger value.
* https://stackoverflow.com/questions/29722999/will-write2-always-write-less-than-or-equal-to-ssize-max
*/
ssize_t out, tot = 0;

if (!buf || count == 0)
return 0;

while (tot < count) {
out = write(fd, buf + tot, count - tot);
while ((size_t) tot < count) {
out = write(fd, (const char *) buf + tot, count - tot);
if (out > 0)
tot += out;
else if(errno == EAGAIN || errno == EINTR)
Expand Down
2 changes: 1 addition & 1 deletion devtools/ci/nagios/lib/pqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ typedef struct pqueue_t
* @param getpos the callback function to get the current element's position
* @param setpos the callback function to set the current element's position
*
* @return the handle or NULL for insufficent memory
* @return the handle or NULL for insufficient memory
*/
pqueue_t *
pqueue_init(unsigned int n,
Expand Down
3 changes: 1 addition & 2 deletions devtools/ci/nagios/lib/runcmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ extern const char *runcmd_strerror(int code);
* @param[in] iobregarg The "arg" value to pass to iobroker_register()
*/
extern int runcmd_open(const char *cmd, int *pfd, int *pfderr, char **env,
void (*iobreg)(int, int, void *), void *iobregarg)
__attribute__((__nonnull__(1, 2, 3, 5, 6)));
void (*iobreg)(int, int, void *), void *iobregarg);

/**
* Close a command and return its exit status
Expand Down
2 changes: 1 addition & 1 deletion devtools/ci/nagios/lib/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ extern int send_kvvec(int sd, struct kvvec *kvv)
* @param[in] ioc The io cache
* @param[out] size Out buffer for buffer length
* @param[in] flags Currently unused
* @return A buffer from the iocache on succes; NULL on errors
* @return A buffer from the iocache on success; NULL on errors
*/
extern char *worker_ioc2msg(iocache *ioc, unsigned long *size, int flags);

Expand Down
5 changes: 3 additions & 2 deletions devtools/ci/nagios/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define DEBUGL_ALL -1
#define DEBUGL_NONE 0
#define DEBUGL_FUNCTIONS 1
#define DEBUGL_CONFIG 2
#define DEBUGL_CONFIG 2
#define DEBUGL_PROCESS 4
#define DEBUGL_STATUSDATA 4
#define DEBUGL_RETENTIONDATA 4
Expand All @@ -58,9 +58,10 @@
#define DEBUGL_MACROS 2048
#define DEBUGL_IPC 4096
#define DEBUGL_SCHEDULING 8192
#define DEBUGL_WORKERS 16384

#define DEBUGV_BASIC 0
#define DEBUGV_MORE 1
#define DEBUGV_MORE 1
#define DEBUGV_MOST 2

NAGIOS_BEGIN_DECL
Expand Down
6 changes: 5 additions & 1 deletion devtools/ci/nagios/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#define MAX_USER_MACROS 256 /* maximum number of $USERx$ macros */

#define MACRO_X_COUNT 159 /* size of macro_x[] array */
#define MACRO_X_COUNT 163 /* size of macro_x[] array */

NAGIOS_BEGIN_DECL

Expand Down Expand Up @@ -220,6 +220,10 @@ typedef struct nagios_macros nagios_macros;
#define MACRO_HOSTGROUPMEMBERADDRESSES 156
#define MACRO_HOSTINFOURL 157
#define MACRO_SERVICEINFOURL 158
#define MACRO_HOSTNOTIFICATIONENABLED 159
#define MACRO_SERVICENOTIFICATIONENABLED 160
#define MACRO_HOSTNOTIFICATIONPERIOD 161
#define MACRO_SERVICENOTIFICATIONPERIOD 162


/************* MACRO CLEANING OPTIONS *****************/
Expand Down
Loading

0 comments on commit 9c91e72

Please sign in to comment.