Package: pnp4nagios-bin Version: 0.6.16-2 Severity: normal Tags: patch
Hello, i use debian stable (7.4) as my nagios server and have some checks with large perfdata. I use the npcdmod.o to write this perfdata to file (broker_module). If the perfdata is to long, the string will not terminted by newline and the next line append to this line. See Attached file: perfdata.dump.gz zgrep ".DATATYPE" perfdata.dump.gz #will help to find the line/problem ---- this is one line ---- DATATYPE::SERVICEPERFDATA TIMET::1395924718 HOSTNAME::xx2.rz.uni-jena.de SERVICEDESC::multi_nrpe_stat-fc3 SERVICEPERFDATA::check_multi::check_multi::plugins=19 time=1.530292 stat_dev_sdi::stat_dev::sdi_readB=1578376192c; .... sdbx_readB=189207294976c; sdbx_writeB=11083DATATYPE::SERVICEPERFDATA TIMET::1395924718 HOSTNAME::mailout1.rz.uni-jena.de SERVICEDESC::multi_nrpe_stat SERVICEPERFDATA::check_multi::check_multi::plugins=4 time=0.125382 stat_net::stat_net::eth0_in=895375029c; eth0_out=470741808c; eth0_in_err=0c; eth0_in_drop=0c; eth0_out_err=0c; eth0_out_drop=0c; lo_in=14205c; lo_out=14205c; lo_in_err=0c; lo_in_drop=0c; lo_out_err=0c; lo_out_drop=0c; stat_dev::stat_dev::sda_readB=567335936c; sda_writeB=5723353088c; sda_read_time=62052c; sda_write_time=899829c; sda_read=23177c; sda_write=412738c; sda_read_merged=4104c; sda_write_merged=1000449c; sda_io_wait=0; sda_io_time=340722c; sda_io_weighted=961474c; SERVICECHECKCOMMAND::my_check_multi!nrpe_stat.cmd!-t 35 -T 60 SERVICESTATE::0 SERVICESTATETYPE::1 ---------------------------- So this perfdata will be assigned to an other host/service ... I converted this code (npcdmod.c) from snprintf with fput to fprintf only, see patch attached. So the length of perfdata is not relevant. In my environment i tested this patch successfully. best regards Thomas Sesselmann -- Thomas Sesselmann, Dipl.-Inf. Friedrich-Schiller-Universität Jena Rechenzentrum Am Johannisfriedhof 2 D-07743 Jena Tel.: 03641/9-40530 Fax.: 03641/9-40630
perfdata.dump.gz
Description: application/gzip
--- pnp4nagios-0.6.16/src/npcdmod.c-orig 2014-03-27 14:23:11.560204139 +0100 +++ pnp4nagios-0.6.16/src/npcdmod.c 2014-03-27 14:39:52.508100371 +0100 @@ -187,7 +187,7 @@ service *service=NULL; // char temp_buffer[1024]; - char perfdatafile_template[9216]; +// char perfdatafile_template[9216]; /* what type of event/data do we have? */ switch (event_type) { @@ -213,8 +213,9 @@ if (hostchkdata->type == NEBTYPE_HOSTCHECK_PROCESSED && hostchkdata->perf_data != NULL) { - snprintf(perfdatafile_template, sizeof(perfdatafile_template) - - 1, "DATATYPE::HOSTPERFDATA\t" +// snprintf(perfdatafile_template, sizeof(perfdatafile_template) - 1, + fprintf(fp, + "DATATYPE::HOSTPERFDATA\t" "TIMET::%d\t" "HOSTNAME::%s\t" "HOSTPERFDATA::%s\t" @@ -224,9 +225,9 @@ hostchkdata->host_name, hostchkdata->perf_data, hostchkdata->command_name, hostchkdata->command_args, hostchkdata->state, hostchkdata->state_type); - perfdatafile_template[sizeof(perfdatafile_template) - 1] - = '\x0'; - fputs(perfdatafile_template, fp); +// perfdatafile_template[sizeof(perfdatafile_template) - 1] +// = '\x0'; +// fputs(perfdatafile_template, fp); } } break; @@ -254,8 +255,9 @@ write_to_all_logs(temp_buffer, NSLOG_INFO_MESSAGE); */ - snprintf(perfdatafile_template, sizeof(perfdatafile_template) - - 1, "DATATYPE::SERVICEPERFDATA\t" +// snprintf(perfdatafile_template, sizeof(perfdatafile_template) - 1, + fprintf(fp, + "DATATYPE::SERVICEPERFDATA\t" "TIMET::%d\t" "HOSTNAME::%s\t" "SERVICEDESC::%s\t" @@ -266,9 +268,9 @@ srvchkdata->host_name, srvchkdata->service_description, srvchkdata->perf_data, service->service_check_command, srvchkdata->state, srvchkdata->state_type); - perfdatafile_template[sizeof(perfdatafile_template) - 1] - = '\x0'; - fputs(perfdatafile_template, fp); +// perfdatafile_template[sizeof(perfdatafile_template) - 1] +// = '\x0'; +// fputs(perfdatafile_template, fp); } } break;
smime.p7s
Description: S/MIME Cryptographic Signature