New upstream version 0.6.27

This commit is contained in:
geos_one
2025-08-06 18:11:51 +02:00
parent a6b4158f1f
commit 56a986c0ba
563 changed files with 45811 additions and 35282 deletions

7
src/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
*.o
npcd
pnpsender
utils
Makefile
config.c
npcdmod.c

View File

@@ -32,7 +32,6 @@ MOD_CFLAGS=@MOD_CFLAGS@
prefix=@prefix@
exec_prefix=@exec_prefix@
LOGDIR=@localstatedir@
CFGDIR=@sysconfdir@
BINDIR=@bindir@
LIBEXECDIR=@libexecdir@
LIBDIR=@libdir@
@@ -113,6 +112,8 @@ devclean: distclean
###############################
#
# Install
# leaving out npcdmod.o since
# Nagios changed plugin API
#
################################
@@ -124,14 +125,14 @@ install-unstripped:
$(MAKE) install-basic
install-basic:
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 -d $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(LIBDIR)
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(PERFDATA_DIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(PERFDATA_SPOOL_DIR)
$(INSTALL) -m 754 $(INSTALL_OPTS) @npcd_name@ $(DESTDIR)$(BINDIR)
$(INSTALL) -m 754 $(INSTALL_OPTS) npcdmod.o $(DESTDIR)$(LIBDIR)
$(INSTALL) -m 755 npcd $(DESTDIR)$(BINDIR)
#$(INSTALL) -m 754 $(INSTALL_OPTS) npcdmod.o $(DESTDIR)$(LIBDIR)
strip-post-install:
$(STRIP) $(DESTDIR)$(BINDIR)/@npcd_name@
$(STRIP) $(DESTDIR)$(LIBDIR)/npcdmod.o
$(STRIP) $(DESTDIR)$(BINDIR)/npcd
#$(STRIP) $(DESTDIR)$(LIBDIR)/npcdmod.o

View File

@@ -63,10 +63,12 @@ void process_configfile(char *config_file) {
while (feof(fh_config_file) == 0) {
line_number++;
temp = fgets(current_config_line, 1024, fh_config_file);
temp = NULL;
if (current_config_line == NULL) {
printf("Error reading config\n");
exit(1);
if (temp == NULL) {
if (ferror(fh_config_file) != 0) {
printf("Error reading config\n");
exit(1);
}
break;
}
if (current_config_line[0] == '#' || current_config_line[0] == '\n')
@@ -554,7 +556,7 @@ int prepare_vars() {
if (macro_x[CONFIG_OPT_SCANDIR] != NULL) {
directory = macro_x[CONFIG_OPT_SCANDIR];
} else {
directory = "/usr/local/nagios/var/spool/perfdata/";
directory = "@PERFDATA_SPOOL_DIR@/";
printf(
"WARNING - Adapting a hardcoded default perfdata spooldir - '%s'\n",
directory);
@@ -563,7 +565,7 @@ int prepare_vars() {
if (macro_x[CONFIG_OPT_PIDFILE] != NULL) {
pidfile = macro_x[CONFIG_OPT_PIDFILE];
} else
pidfile = "/var/run/npcd.pid";
pidfile = "@piddir@/npcd.pid";
if (macro_x[CONFIG_OPT_LOGLEVEL] != NULL) {
loglevel = atoi(macro_x[CONFIG_OPT_LOGLEVEL]);

View File

@@ -185,7 +185,7 @@ int main(int argc, char **argv) {
strerror(errno));
exit(EXIT_FAILURE);
} else {
fprintf(fppid, "%d", getpid());
fprintf(fppid, "%d\n", getpid());
fclose(fppid);
}
}
@@ -245,7 +245,7 @@ int main(int argc, char **argv) {
filecounter, directory);
LOG(2, buffer);
for (i = 0, namelist; i < filecounter; i++) {
for (i = 0; i < filecounter; i++) {
#ifdef HAVE_GETLOADAVG
if (use_load_threshold == TRUE) {
@@ -356,7 +356,7 @@ int main(int argc, char **argv) {
if (we_should_stop == TRUE)
break;
for (i = 0, namelist; i < filecounter; i++) {
for (i = 0; i < filecounter; i++) {
free(namelist[i]);
}
@@ -479,7 +479,7 @@ int process_arguments(int argc, char **argv) {
printf("\t\tPath to config file\n");
printf("\n");
printf(
"Visit the Website at http://sourceforge.net/projects/pnp4nagios/ for bug fixes, \n");
"Visit the Website at https://github.com/pnp4nagios for bug fixes, \n");
printf("new releases, online documentation, FAQs, Mailinglists.\n");
printf("\n");

View File

@@ -45,9 +45,9 @@ extern int process_performance_data;
FILE *fp = NULL;
void *npcdmod_module_handle = NULL;
char *perfdata_file = "/usr/local/nagios/var/perfdata";
char *perfdata_file = "@PERFDATA_DIR@/perf.data";
char *perfdata_spool_filename = "perfdata";
char *spool_dir = NULL;
char *spool_dir = "@PERFDATA_SPOOL_DIR@";
char *perfdata_file_processing_interval = "15";
void npcdmod_file_roller();
@@ -166,6 +166,14 @@ void npcdmod_file_roller() {
/* move the original file */
result = my_rename(perfdata_file, spool_file);
if (result != 0) {
snprintf(temp_buffer, sizeof(temp_buffer) - 1,
"npcdmod: Could not rename perfdata file. %s", strerror(errno));
temp_buffer[sizeof(temp_buffer) - 1] = '\x0';
write_to_all_logs(temp_buffer, NSLOG_INFO_MESSAGE);
return;
}
/* open a new file */
if ((fp = fopen(perfdata_file, "a")) == NULL) {

View File

@@ -239,7 +239,7 @@ int process_arguments(int argc, char **argv) {
" like \"serviceperfdata\", \"hostperfdata\", \"eventhandler\"\n");
printf("\n\n");
printf(
"Visit the PNP website at http://www.pnp4nagios.org/pnp/ for bug fixes, new\n");
"Visit the PNP website at https://github.com/pnp4nagios for bug fixes, new\n");
printf(
"releases, online documentation, FAQs, information on subscribing to\n");
printf("the mailing lists.\n");

View File

@@ -207,7 +207,7 @@ void check_sig(int signr) {
break;
default:
snprintf(buffer, sizeof(buffer - 1),
snprintf(buffer, MAX_LOGMESSAGE_SIZE - 1,
"Caught the Signal '%d' but don't care about this.\n", signr);
LOG(2, buffer);
break;