Skip to content

Commit

Permalink
Merge pull request #150 from ccztux/devel
Browse files Browse the repository at this point in the history
Release 2.3.0
  • Loading branch information
ccztux authored Dec 13, 2020
2 parents 6d75974 + 344492a commit c369cbb
Show file tree
Hide file tree
Showing 11 changed files with 280 additions and 143 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ before_install:

script:
- docker run koalaman/shellcheck:stable --version
- docker run -v $(pwd):/scripts koalaman/shellcheck:stable --color=always --external-sources /scripts/usr/local/modpd/bin/modpd
- docker run -v $(pwd):/scripts koalaman/shellcheck:stable --color=always /scripts/usr/local/modpd/etc/modpd.sample.conf
- docker run -v $(pwd):/scripts koalaman/shellcheck:stable --color=always --external-sources /scripts/etc/init.d/modpd
- docker run -v $(pwd):/scripts koalaman/shellcheck:stable --color=always --check-sourced --external-sources /scripts/usr/local/modpd/bin/modpd
- docker run -v $(pwd):/scripts koalaman/shellcheck:stable --color=always --check-sourced --external-sources /scripts/etc/init.d/modpd

matrix:
fast_finish: true
Expand Down
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)
# 2020-12-10
# 2020-12-13
#
# Version 2.2.10
# Version 2.3.0
#
# Description: Makefile for the modpd NEB module
#
Expand Down
301 changes: 205 additions & 96 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.10
2.3.0
4 changes: 2 additions & 2 deletions etc/init.d/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)
# 2020-12-10
# 2020-12-13
#
# Version 2.2.10
# Version 2.3.0
#
# Description: init script for modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down
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)
# 2020-12-10
# 2020-12-13
#
# Version 2.2.10
# Version 2.3.0
#
# Description: logrotate 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)
# 2020-12-10
# 2020-12-13
#
# Version 2.2.10
# Version 2.3.0
#
# Description: Config parameters for the init script of the modpd daemon
# (Monitoring Obsessing Data Processor Daemon)
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)
# 2020-12-10
# 2020-12-13
#
# Version 2.2.10
# Version 2.3.0
#
# Description: Makefile for the modpd NEB module
#
Expand Down
8 changes: 4 additions & 4 deletions src/modpd.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)
* 2020-12-10
* 2020-12-13
*
* Version 2.2.10
* Version 2.3.0
*
* Description: NEB module to write obsessing data to unix socket
* Based on example: nagioscore/module/helloworld.c
Expand Down Expand Up @@ -83,12 +83,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-2020 Christian Zettel (ccztux), all rights reserved");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_VERSION, "2.2.10");
neb_set_module_info(modpd_module_handle, NEBMODULE_MODINFO_VERSION, "2.3.0");
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-2020 Christian Zettel (ccztux), all rights reserved, Version: 2.2.10", NSLOG_INFO_MESSAGE);
write_to_all_logs("modpd: Copyright © 2017-2020 Christian Zettel (ccztux), all rights reserved, Version: 2.3.0", NSLOG_INFO_MESSAGE);

/* log a message to the Nagios log file */
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "modpd: Starting...\n");
Expand Down
76 changes: 54 additions & 22 deletions usr/local/modpd/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)
# 2020-12-10
# 2020-12-13
#
# Version 2.2.10
# Version 2.3.0
#
# Description: modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down Expand Up @@ -466,8 +466,11 @@ setRequiredVariables()
# log file
g_log_file="${g_log_directory}/${g_name}.log"

# debug log file
g_debug_log_file="${g_log_directory}/${g_name}.debug.log"
# debug log file monitoring rawdata
g_debug_log_file_monitoring="${g_log_directory}/${g_name}.monitoring.debug.log"

# debug log file obsessing data
g_debug_log_file_obsessing="${g_log_directory}/${g_name}.obsessing.debug.log"

# named pipe
g_named_pipe_file="${g_base_path}/var/rw/${g_name}.cmd"
Expand Down Expand Up @@ -1184,22 +1187,21 @@ timerHandler()

generateDebugLogOutput()
{
local debug_type="${1}"
local log_timestamp=
log_timestamp="$(eval "${date_bin} ${g_date_cmd_format_prefix}${log_timestamp_format}${g_date_cmd_format_suffix}")"

printf "********** START (%s) %s debug log cycle **********\\n" "${log_timestamp}" "${g_name}"

if [ "${debug_log_monitoring_data}" == "1" ]
if [ "${debug_type}" == "monitoring" ]
then
printf "*** START (raw data received from monitoring) ***\\n\\n"
printf "%s\\n" "${g_job_raw_data[@]}"
printf "${log_timestamp}: %s\\n" "${g_job_raw_data[@]}"
printf "\\n*** END (raw data received from monitoring) ***\\n"
fi

if [ "${debug_log_obsessing_data}" == "1" ]
elif [ "${debug_type}" == "obsessing" ]
then
printf "*** START (raw data prepared to send via %s) ***\\n\\n" "${obsessing_interface}"
printf "%s\\n" "${g_job_data[@]}"
printf "${log_timestamp}: %s\\n" "${g_job_data[@]}"
printf "\\n*** END (raw data prepared to send via %s) ***\\n" "${obsessing_interface}"
fi

Expand All @@ -1208,7 +1210,38 @@ generateDebugLogOutput()

debugLog()
{
generateDebugLogOutput >> "${g_debug_log_file}"
if [ "${debug_log_monitoring_data}" == "1" ]
then
generateDebugLogOutput "monitoring" >> "${g_debug_log_file_monitoring}"
fi

if [ "${debug_log_obsessing_data}" == "1" ]
then
generateDebugLogOutput "obsessing" >> "${g_debug_log_file_obsessing}"
fi
}

truncateDebugLogs()
{
if [ "${debug_log_monitoring_data}" == "1" ]
then
if : >| "${g_debug_log_file_monitoring}" 2>&1 | logHandler
then
logHandler "Truncating the debug logfile for monitoring data was successful"
else
logHandler "Truncating the debug logfile for monitoring data was not successful"
fi
fi

if [ "${debug_log_obsessing_data}" == "1" ]
then
if : >| "${g_debug_log_file_obsessing}" 2>&1 | logHandler
then
logHandler "Truncating the debug logfile for obsessing data was successful"
else
logHandler "Truncating the debug logfile for obsessing data was not successful"
fi
fi
}

setSeparators()
Expand Down Expand Up @@ -1462,19 +1495,18 @@ dataProcessor()

if [ "${debug_log_monitoring_data}" == "1" ]
then
g_job_raw_data+=("${host_name}${g_md_sep}${service_description}${g_md_sep}${state_id}${g_md_sep}${plugin_output}${g_md_sep}${junk}")
if [ -z "${junk}" ]
then
g_job_raw_data+=("${host_name}${g_md_sep}${service_description}${g_md_sep}${state_id}${g_md_sep}${plugin_output}")
else
g_job_raw_data+=("${host_name}${g_md_sep}${service_description}${g_md_sep}${state_id}${g_md_sep}${plugin_output}${g_md_sep}${junk}")
fi
fi

if timerHandler "${debug_log_truncate_interval}" "${timer_result_last_debug_log_truncation}"
then
timer_result_last_debug_log_truncation="$(( timer_result_last_debug_log_truncation + 1 ))"

if : >| "${g_debug_log_file}" 2>&1 | logHandler
then
logHandler "Truncating the debug logfile was successful"
else
logHandler "Truncating the debug logfile was not successful"
fi
truncateDebugLogs
fi
fi

Expand All @@ -1487,7 +1519,7 @@ dataProcessor()
fi
fi

if [ "${job_interval_helper}" -le "${SECONDS}" ]
if [ "${job_interval_helper}" -le "${SECONDS}" ] || [ "${#g_job_data[@]}" == "${job_max_bulk_size}" ]
then
jobHandler
g_job_data=()
Expand Down Expand Up @@ -1546,11 +1578,11 @@ _main()
g_pid="${$}"
g_argc="${#}"
g_name="${0##*/}"
g_version="2.2.10"
g_version="2.3.0"
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="2020-12-10"
g_last_modification_date="2020-12-13"
g_minimal_required_bash_version="3"
g_license="GNU GPLv2"
g_description="${g_name} (Monitoring Obsessing Data Processor Daemon)"
Expand Down
11 changes: 4 additions & 7 deletions usr/local/modpd/etc/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)
# 2020-12-10
# 2020-12-13
#
# Version 2.2.10
# Version 2.3.0
#
# Description: Config file for modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand All @@ -35,9 +35,6 @@
#
#========================================================================================================

# shellcheck disable=SC2034
# shellcheck disable=SC2154


#---------------------------------------------------
# In case of direct execution, write output and exit
Expand Down Expand Up @@ -175,7 +172,7 @@ log_invalid_data="1"
# Debugging
#----------

# enable debug log of the raw data prepared to send via obsessing_interface
# enable debug log of the raw data processed via obsessing_interface
# (valid values: 1|0)
debug_log_obsessing_data="0"

Expand All @@ -202,7 +199,7 @@ job_timeout="8"
job_exec_interval="4"

# job max bulk size
job_max_bulk_size="50"
job_max_bulk_size="250"

# log unsuccessful job commands
# (valid values: 1|0)
Expand Down

0 comments on commit c369cbb

Please sign in to comment.