Skip to content

Commit

Permalink
Merge pull request #188 from ccztux/issue-187
Browse files Browse the repository at this point in the history
Done: Update the naemon header files (#187)
  • Loading branch information
ccztux committed May 22, 2024
2 parents f5c629b + d0067df commit 5240719
Show file tree
Hide file tree
Showing 29 changed files with 60 additions and 48 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2024-05-22
#
# Version 3.0.0
# Version 3.0.1
#
# Description: Makefile for the modpd NEB module
#
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.0.1
4 changes: 2 additions & 2 deletions etc/logrotate.d/modpd
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2024-05-22
#
# Version 3.0.0
# Version 3.0.1
#
# Description: logrotate config file for modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down
4 changes: 2 additions & 2 deletions etc/modpd/modpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2024-05-22
#
# Version 3.0.0
# Version 3.0.1
#
# Description: Config file for modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down
4 changes: 2 additions & 2 deletions etc/modpd/modpd.sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2024-05-22
#
# Version 3.0.0
# Version 3.0.1
#
# Description: Config file for modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down
4 changes: 2 additions & 2 deletions etc/sysconfig/modpd
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2024-05-22
#
# Version 3.0.0
# Version 3.0.1
#
# Description: Config parameters for the init script of the modpd daemon
# (Monitoring Obsessing Data Processor Daemon)
Expand Down
2 changes: 1 addition & 1 deletion naemon/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Description

This folder contains the original sources from naemon 1.3.0
This folder contains the original sources from naemon 1.4.1
2 changes: 1 addition & 1 deletion naemon/broker.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void broker_adaptive_contact_data(int, int, int, contact *, int, unsigned long,
int broker_external_command(int, int, int, int, time_t, char *, char *);
void broker_aggregated_status_data(int, int, int);
void broker_retention_data(int, int, int);
void broker_acknowledgement_data(int, int, int, int, void *, char *, char *, int, int, int);
void broker_acknowledgement_data(int, int, int, int, void *, char *, char *, int, int, int, time_t);
void broker_statechange_data(int, int, int, int, void *, int, int, int, int);
int broker_vault_macro(char *, char **, int *, nagios_macros *);

Expand Down
2 changes: 1 addition & 1 deletion naemon/buildopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define NAEMON_SYSCONFDIR "/etc/naemon"
#define NAEMON_LOCALSTATEDIR "/var/lib/naemon"
#define NAEMON_LOGDIR "/var/log/naemon"
#define NAEMON_LOCKFILE "/var/run/naemon/naemon.pid"
#define NAEMON_LOCKFILE "/run/naemon/naemon.pid"
#define NAEMON_GROUP "naemon"
#define NAEMON_USER "naemon"
#endif
4 changes: 4 additions & 0 deletions naemon/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "objects_contact.h"
#include "objects_host.h"
#include "objects_service.h"
#include "events.h"

NAGIOS_BEGIN_DECL

Expand Down Expand Up @@ -220,6 +221,9 @@ int shutdown_command_file_worker(void);
int disconnect_command_file_worker(void);
int command_worker_get_pid(void);

void handle_host_acknowledgement_expire_event(struct nm_event_execution_properties *evprop); /* removes an expired host acknowledgement */
void handle_service_acknowledgement_expire_event(struct nm_event_execution_properties *evprop); /* removes an expired service acknowledgement */

NAGIOS_END_DECL

#endif
4 changes: 3 additions & 1 deletion naemon/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ NAGIOS_END_DECL
#define CMD_DEL_DOWNTIME_BY_HOSTGROUP_NAME 171
#define CMD_DEL_DOWNTIME_BY_START_TIME_COMMENT 172

#define CMD_ACKNOWLEDGE_HOST_PROBLEM_EXPIRE 173
#define CMD_ACKNOWLEDGE_SVC_PROBLEM_EXPIRE 174

/* custom command introduced in Nagios 3.x */
#define CMD_CUSTOM_COMMAND 999

Expand Down Expand Up @@ -471,7 +474,6 @@ NAGIOS_END_DECL
#define MAX_FILENAME_LENGTH 256 /* max length of path/filename that Nagios will process */
#define MAX_INPUT_BUFFER 1024 /* size in bytes of max. input buffer (for reading files, misc stuff) */
#define MAX_COMMAND_BUFFER 8192 /* max length of raw or processed command line */
#define MAX_EXTERNAL_COMMAND_LENGTH 8192 /* max length of an external command */

#define MAX_DATETIME_LENGTH 48

Expand Down
2 changes: 1 addition & 1 deletion naemon/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
#define UPDATE_CHECK_RETRY_INTERVAL_WOBBLE 60*60*3 /* 3 hour wobble on top of base retry interval */

#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_ALLOW_CIRCULAR_DEPENDENCIES 0 /* Allow circular dependencies */
#define DEFAULT_HOST_DOWN_DISABLE_SERVICE_CHECKS 0 /* run service checks if the host is down */
#define DEFAULT_SKIP_CHECK_STATUS -1 /* do not change status by default */

Expand Down
1 change: 1 addition & 0 deletions naemon/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ long get_timed_event_time_left_ms(timed_event *ev);
/* Main function */
void init_event_queue(void); /* creates the queue nagios_squeue */
int event_poll(void); /* main monitoring/event handler loop */
void clear_event_queue(void); /* remove all events from the event queue */
void destroy_event_queue(void); /* destroys the queue nagios_squeue */

NAGIOS_END_DECL
Expand Down
2 changes: 1 addition & 1 deletion naemon/lib/kvvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ extern int kvvec_destroy(struct kvvec *kvv, int flags);
/**
* Free key/value pairs associated with a key/value vector
* @param kvv The key/value vector to operate on
* @param flags flags or'ed combination of KVVEC_FREE_{KEYS,VALUES}, or KVVEC_FREE_ALL
* @param flags or'ed combination of KVVEC_FREE_{KEYS,VALUES}, or KVVEC_FREE_ALL
*/
void kvvec_free_kvpairs(struct kvvec *kvv, int flags);

Expand Down
5 changes: 5 additions & 0 deletions naemon/lib/lnae-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
# define veclen ARRAY_SIZE
#endif

/* sets a limit for max open files if ulimit is set to unlimited or a unusual high value */
#ifndef MAX_FD_LIMIT
#define MAX_FD_LIMIT 100000
#endif

#ifndef offsetof
/** standard offsetof macro */
# define offsetof(t, f) ((unsigned long)&((t *)0)->f)
Expand Down
6 changes: 6 additions & 0 deletions naemon/lib/nsutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#endif

#include <sys/types.h>
#include <fcntl.h>

NAGIOS_BEGIN_DECL

Expand Down Expand Up @@ -114,6 +115,11 @@ extern int tv_delta_msec(const struct timeval *start, const struct timeval *stop
*/
extern float tv_delta_f(const struct timeval *start, const struct timeval *stop);

/**
* close and reopen stdin, stdout and stderr to /dev/null
*/
void close_standard_fds(void);

NAGIOS_END_DECL

/** @} */
Expand Down
1 change: 1 addition & 0 deletions naemon/lib/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "lnae-utils.h"
#include "kvvec.h"
#include "bufferqueue.h"
#include "nsutils.h"

/**
* @file worker.h
Expand Down
10 changes: 0 additions & 10 deletions naemon/naemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@
* header before use.
*/

/************* MISC LENGTH/SIZE DEFINITIONS ***********/

/*
NOTE: Plugin length is artificially capped at 8k to prevent runaway plugins from returning MBs/GBs of data
back to Nagios. If you increase the 8k cap by modifying this value, make sure you also increase the value
of MAX_EXTERNAL_COMMAND_LENGTH in common.h to allow for passive checks results received through the external
command file. EG 10/19/07
*/
#define MAX_PLUGIN_OUTPUT_LENGTH 8192 /* max length of plugin output (including perf data) */

/*********** ROUTE CHECK PROPAGATION TYPES ************/

#define PROPAGATE_TO_PARENT_HOSTS 1
Expand Down
2 changes: 1 addition & 1 deletion naemon/nebmods.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int neb_cb_result_returncode(neb_cb_result *cb_result);
/**
* Frees a \p neb_cb_resultset and associated resources. Note
* that this also frees all the contained \p neb_cb_results contained
* withing the set.
* within the set.
* @param cb_resultset a \p neb_cb_resultset
*/
void neb_cb_resultset_destroy(neb_cb_resultset *);
Expand Down
1 change: 1 addition & 0 deletions naemon/nebstructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ typedef struct nebstruct_acknowledgement_struct {
int persistent_comment;
int notify_contacts;
void *object_ptr;
time_t end_time;
} nebstruct_acknowledgement_data;


Expand Down
1 change: 1 addition & 0 deletions naemon/objects_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ struct host {
customvariablesmember *custom_variables;
int problem_has_been_acknowledged;
int acknowledgement_type;
time_t acknowledgement_end_time;
int check_type;
int current_state;
int last_state;
Expand Down
1 change: 1 addition & 0 deletions naemon/objects_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct service {
struct customvariablesmember *custom_variables;
int problem_has_been_acknowledged;
int acknowledgement_type;
time_t acknowledgement_end_time;
int host_problem_at_last_check;
int check_type;
int current_state;
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2024-05-22
#
# Version 3.0.0
# Version 3.0.1
#
# Description: Makefile for the modpd NEB module
#
Expand Down
4 changes: 2 additions & 2 deletions src/naemon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2024-05-22
#
# Version 3.0.0
# Version 3.0.1
#
# Description: Makefile for the modpd NEB module
#
Expand Down
8 changes: 4 additions & 4 deletions src/naemon/modpd_naemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Project website: https://github.com/ccztux/modpd
*
* Last Modification: Christian Zettel (ccztux)
* 2023-01-09
* 2024-05-22
*
* Version 3.0.0
* Version 3.0.1
*
* Description: NEB module to write obsessing data to unix socket
* Based on example: nagioscore/module/helloworld.c
Expand Down Expand Up @@ -72,12 +72,12 @@ int nebmodule_init(int flags, char *args, nebmodule *handle)
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_TITLE, "modpd");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_AUTHOR, "Christian Zettel (ccztux)");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_TITLE, "Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_VERSION, "3.0.0");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_VERSION, "3.0.1");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_LICENSE, "GPL v2");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_DESC, "Obsessing NEB Module.");

/* log module info to the Naemon log file */
nm_log(NSLOG_INFO_MESSAGE, "modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.0.0");
nm_log(NSLOG_INFO_MESSAGE, "modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.0.1");

/* log a message to the Naemon log file */
nm_log(NSLOG_INFO_MESSAGE, "modpd: Starting...");
Expand Down
4 changes: 2 additions & 2 deletions src/nagios3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2024-05-22
#
# Version 3.0.0
# Version 3.0.1
#
# Description: Makefile for the modpd NEB module
#
Expand Down
8 changes: 4 additions & 4 deletions src/nagios3/modpd_nagios3.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Project website: https://github.com/ccztux/modpd
*
* Last Modification: Christian Zettel (ccztux)
* 2023-01-09
* 2024-05-22
*
* Version 3.0.0
* Version 3.0.1
*
* Description: NEB module to write obsessing data to unix socket
* Based on example: nagioscore/module/helloworld.c
Expand Down Expand Up @@ -84,12 +84,12 @@ int nebmodule_init(int flags, char *args, nebmodule *handle)
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_TITLE, "modpd");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_AUTHOR, "Christian Zettel (ccztux)");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_TITLE, "Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_VERSION, "3.0.0");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_VERSION, "3.0.1");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_LICENSE, "GPL v2");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_DESC, "Obsessing NEB Module.");

/* log module info to the Nagios log file */
write_to_all_logs("modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.0.0", NSLOG_INFO_MESSAGE);
write_to_all_logs("modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.0.1", NSLOG_INFO_MESSAGE);

/* log a message to the Nagios log file */
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "modpd: Starting...\n");
Expand Down
8 changes: 4 additions & 4 deletions usr/bin/modpd
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2024-05-22
#
# Version 3.0.0
# Version 3.0.1
#
# Description: modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down Expand Up @@ -1769,11 +1769,11 @@ _main()

g_pid="${$}"
g_name="${0##*/}"
g_version="3.0.0"
g_version="3.0.1"
g_author="Christian Zettel (ccztux)"
g_copyright="Copyright © 2017-2020 ${g_author}, all rights reserved"
g_project_website="https://github.com/ccztux/${g_name}"
g_last_modification_date="2023-01-09"
g_last_modification_date="2024-05-22"
g_minimal_required_bash_version="3"
g_license="GNU GPLv2"
g_description="${g_name} (Monitoring Obsessing Data Processor Daemon)"
Expand Down
4 changes: 2 additions & 2 deletions usr/lib/systemd/system/modpd.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2024-05-22
#
# Version 3.0.0
# Version 3.0.1
#
# Description: modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down

0 comments on commit 5240719

Please sign in to comment.