diff --git a/Makefile b/Makefile index c4a022b..97c6ca1 100644 --- a/Makefile +++ b/Makefile @@ -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 # diff --git a/VERSION b/VERSION index 4a36342..cb2b00e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0 +3.0.1 diff --git a/etc/logrotate.d/modpd b/etc/logrotate.d/modpd index 9a504b3..88465a8 100644 --- a/etc/logrotate.d/modpd +++ b/etc/logrotate.d/modpd @@ -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) # diff --git a/etc/modpd/modpd.conf b/etc/modpd/modpd.conf index d32ba6a..80afb38 100644 --- a/etc/modpd/modpd.conf +++ b/etc/modpd/modpd.conf @@ -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) # diff --git a/etc/modpd/modpd.sample.conf b/etc/modpd/modpd.sample.conf index d32ba6a..80afb38 100644 --- a/etc/modpd/modpd.sample.conf +++ b/etc/modpd/modpd.sample.conf @@ -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) # diff --git a/etc/sysconfig/modpd b/etc/sysconfig/modpd index bbd7e53..f5dd12e 100644 --- a/etc/sysconfig/modpd +++ b/etc/sysconfig/modpd @@ -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) diff --git a/naemon/README.md b/naemon/README.md index a6dc99e..7672662 100644 --- a/naemon/README.md +++ b/naemon/README.md @@ -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 diff --git a/naemon/broker.h b/naemon/broker.h index 47cc7ac..4e7b0b7 100644 --- a/naemon/broker.h +++ b/naemon/broker.h @@ -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 *); diff --git a/naemon/buildopts.h b/naemon/buildopts.h index 94daaba..3c85f5d 100644 --- a/naemon/buildopts.h +++ b/naemon/buildopts.h @@ -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 diff --git a/naemon/commands.h b/naemon/commands.h index b7539d9..21db023 100644 --- a/naemon/commands.h +++ b/naemon/commands.h @@ -10,6 +10,7 @@ #include "objects_contact.h" #include "objects_host.h" #include "objects_service.h" +#include "events.h" NAGIOS_BEGIN_DECL @@ -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 diff --git a/naemon/common.h b/naemon/common.h index a96c5eb..21e5bda 100644 --- a/naemon/common.h +++ b/naemon/common.h @@ -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 @@ -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 diff --git a/naemon/defaults.h b/naemon/defaults.h index a26b19d..c1dd48a 100644 --- a/naemon/defaults.h +++ b/naemon/defaults.h @@ -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 */ diff --git a/naemon/events.h b/naemon/events.h index 3868261..b12dba2 100644 --- a/naemon/events.h +++ b/naemon/events.h @@ -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 diff --git a/naemon/lib/kvvec.h b/naemon/lib/kvvec.h index 9437448..1285d02 100644 --- a/naemon/lib/kvvec.h +++ b/naemon/lib/kvvec.h @@ -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); diff --git a/naemon/lib/lnae-utils.h b/naemon/lib/lnae-utils.h index 5965e03..a8aac42 100644 --- a/naemon/lib/lnae-utils.h +++ b/naemon/lib/lnae-utils.h @@ -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) diff --git a/naemon/lib/nsutils.h b/naemon/lib/nsutils.h index 7b610b2..005460d 100644 --- a/naemon/lib/nsutils.h +++ b/naemon/lib/nsutils.h @@ -6,6 +6,7 @@ #endif #include +#include NAGIOS_BEGIN_DECL @@ -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 /** @} */ diff --git a/naemon/lib/worker.h b/naemon/lib/worker.h index 16eba69..6c3a9d8 100644 --- a/naemon/lib/worker.h +++ b/naemon/lib/worker.h @@ -8,6 +8,7 @@ #include "lnae-utils.h" #include "kvvec.h" #include "bufferqueue.h" +#include "nsutils.h" /** * @file worker.h diff --git a/naemon/naemon.h b/naemon/naemon.h index 02410b3..e2daf28 100644 --- a/naemon/naemon.h +++ b/naemon/naemon.h @@ -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 diff --git a/naemon/nebmods.h b/naemon/nebmods.h index ccb25ab..9d01fb6 100644 --- a/naemon/nebmods.h +++ b/naemon/nebmods.h @@ -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 *); diff --git a/naemon/nebstructs.h b/naemon/nebstructs.h index 68f701e..76c72cc 100644 --- a/naemon/nebstructs.h +++ b/naemon/nebstructs.h @@ -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; diff --git a/naemon/objects_host.h b/naemon/objects_host.h index 780a77f..3609deb 100644 --- a/naemon/objects_host.h +++ b/naemon/objects_host.h @@ -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; diff --git a/naemon/objects_service.h b/naemon/objects_service.h index d8358ee..4db8521 100644 --- a/naemon/objects_service.h +++ b/naemon/objects_service.h @@ -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; diff --git a/src/Makefile b/src/Makefile index 66fe993..5a5c11f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 # diff --git a/src/naemon/Makefile b/src/naemon/Makefile index 588dcc8..96eeb77 100644 --- a/src/naemon/Makefile +++ b/src/naemon/Makefile @@ -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 # diff --git a/src/naemon/modpd_naemon.c b/src/naemon/modpd_naemon.c index d349b62..b28f9d3 100644 --- a/src/naemon/modpd_naemon.c +++ b/src/naemon/modpd_naemon.c @@ -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 @@ -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..."); diff --git a/src/nagios3/Makefile b/src/nagios3/Makefile index efed485..c5b9c9c 100644 --- a/src/nagios3/Makefile +++ b/src/nagios3/Makefile @@ -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 # diff --git a/src/nagios3/modpd_nagios3.c b/src/nagios3/modpd_nagios3.c index 7e93e57..e2847d9 100644 --- a/src/nagios3/modpd_nagios3.c +++ b/src/nagios3/modpd_nagios3.c @@ -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 @@ -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"); diff --git a/usr/bin/modpd b/usr/bin/modpd index ccbfaf2..bfb491a 100644 --- a/usr/bin/modpd +++ b/usr/bin/modpd @@ -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) # @@ -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)" diff --git a/usr/lib/systemd/system/modpd.service b/usr/lib/systemd/system/modpd.service index 2590ed1..2fd14cc 100644 --- a/usr/lib/systemd/system/modpd.service +++ b/usr/lib/systemd/system/modpd.service @@ -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) #