[Nagios-devel] ndoutils 1.4b7 bug?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] ndoutils 1.4b7 bug?

Post by Guest »

After searching and posting to forums I've yet to find anything on
this error so I thought I'd post up here.
When using ndoutils 1.4b7 on both the 2.x and 3.x releases, I get the
following error(s) on Nagios startup:

Feb 6 05:55:07 10-0-0-19 ndo2db-3x: Error: mysql_query() failed for
'INSERT INTO nagios_configfilevariables SET instance_id='1',
configfile_id='1', varname='cfg_file',
varvalue='/usr/local/nagios/etc/objects/contacts\.cfg''
Feb 6 05:55:07 10-0-0-19 ndo2db-3x: Error: mysql_query() failed for
'INSERT INTO nagios_configfilevariables SET instance_id='1',
configfile_id='1', varname='cfg_file',
varvalue='/usr/local/nagios/etc/objects/timeperiods\.cfg''
Feb 6 05:55:07 10-0-0-19 ndo2db-3x: Error: mysql_query() failed for
'INSERT INTO nagios_configfilevariables SET instance_id='1',
configfile_id='1', varname='cfg_file',
varvalue='/usr/local/nagios/etc/objects/templates\.cfg''
Feb 6 05:55:07 10-0-0-19 ndo2db-3x: Error: mysql_query() failed for
'INSERT INTO nagios_configfilevariables SET instance_id='1',
configfile_id='1', varname='cfg_file',
varvalue='/usr/local/nagios/etc/objects/localhost\.cfg''


I confirmed that this issue only shows up in 1.4b7 (I tested with
1.4b4-1.4b6). Just going through the differences in 1.4b6 vs. 1.4b7 I
found this change in dbhandlers.c in 1.4b7:

if(asprintf(&buf1,"INSERT INTO %s SET %s"
,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONFIGFILEVARIABLES]
,buf
,buf
)==-1)
buf1=NULL;


whereas 1.4b6 uses:

if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s"
,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONFIGFILEVARIABLES]
,buf
,buf
)==-1)
buf1=NULL;


To test, I just "patched" a 1.4b6 tarball so it was up-to-date with
1.4b7 BUT left the above section untouched. Doing this seemed to have
stopped the errors from showing up on startup.

Is this an actual "bug" or did I just do something wrong? If it is a
bug, is it safe to use the chunk of code from 1.4b6?

Thanks,
Eujon





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked