[Nagios-devel] [patch] postgresql abstime problem

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] [patch] postgresql abstime problem

Post by Guest »

--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I found some problems using nagios and postgresql on my debian
distribution. My nagios version is 1.2 and postgres - 7.2.1-2woody4.
If someone has in logs something like this:

ERROR: Bad abstime external representation '1081320063'

this is by bad timestamp representation in: xdata/xcddb.c, xdata/xdddb.c
and xdata/xsddb.c files. The problem is with conversion which in
original source is for example: %lu::abstime::timestamp, when it should
be: %lu::int4::abstime::timestamp.

Patch is incuded in attachment.

In init.d script may be helpful changing line 107:
su $Nagios -c "touch $NagiosVar/nagios.log $NagiosSav".

Regards

M.S.



--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="nagios_xdata.patch"
Content-Transfer-Encoding: quoted-printable

*** nagios-1.2/xdata/xcddb.c Sat May 31 22:44:27 2003
--- nagios-1.2-new/xdata/xcddb.c Wed Apr 7 12:06:54 2004
***************
*** 712,716 ****
#endif
#ifdef USE_XCDPGSQL
! snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_nam=
e,persistent,entry_time,author_name,comment_data) VALUES ('%s','%d',%lu::ab=
stime::timestamp,'%s','%s')",XCDDB_HOSTCOMMENTS_TABLE,escaped_host_name,per=
sistent,entry_time,escaped_author_name,escaped_comment_data);
#endif
sql_statement[sizeof(sql_statement)-1]=3D'\x0';
--- 712,716 ----
#endif
#ifdef USE_XCDPGSQL
! snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_nam=
e,persistent,entry_time,author_name,comment_data) VALUES ('%s','%d',%lu::in=
t4::abstime::timestamp,'%s','%s')",XCDDB_HOSTCOMMENTS_TABLE,escaped_host_na=
me,persistent,entry_time,escaped_author_name,escaped_comment_data);
#endif
sql_statement[sizeof(sql_statement)-1]=3D'\x0';
***************
*** 810,814 ****
#endif
#ifdef USE_XCDPGSQL
! snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_nam=
e,service_description,persistent,entry_time,author_name,comment_data) VALUE=
S ('%s','%s','%d',%lu::abstime::timestamp,'%s','%s')",XCDDB_SERVICECOMMENTS=
_TABLE,escaped_host_name,escaped_svc_description,persistent,entry_time,esca=
ped_author_name,escaped_comment_data);
#endif
sql_statement[sizeof(sql_statement)-1]=3D'\x0';
--- 810,814 ----
#endif
#ifdef USE_XCDPGSQL
! snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_nam=
e,service_description,persistent,entry_time,author_name,comment_data) VALUE=
S ('%s','%s','%d',%lu::int4::abstime::timestamp,'%s','%s')",XCDDB_SERVICECO=
MMENTS_TABLE,escaped_host_name,escaped_svc_description,persistent,entry_tim=
e,escaped_author_name,escaped_comment_data);
#endif
sql_statement[sizeof(sql_statement)-1]=3D'\x0';
*** nagios-1.2/xdata/xdddb.c Sat May 31 22:44:27 2003
--- nagios-1.2-new/xdata/xdddb.c Wed Apr 7 12:08:02 2004
***************
*** 752,756 ****
#endif
#ifdef USE_XDDPGSQL
! snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_nam=
e,entry_time,author_name,comment_data,start_time,end_time,fixed,duration) V=
ALUES ('%s',%lu::abstime::timestamp,'%s','%s',%lu::abstime::timestamp,%lu::=
abstime::timestamp,'%d','%lu')",XDDDB_HOSTDOWNTIME_TABLE,escaped_host_name,=
entry_time,escaped_author_name,escaped_comment_data,start_time,end_time,fix=
ed,duration);
#endif
sql_statement[sizeof(sql_statement)-1]=3D'\x0';
--- 752,756 ----
#endif
#ifdef USE_XDDPGSQL
! snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_nam=
e,entry_time,author_name,comment_data,start_time,end_time,fixed,duration) V=
ALUES ('%s',%lu::int4::abstime::timestamp,'%s','%s',%lu::int4::abstime::tim=
estamp,%lu::int4::abstime::timestamp,'%d','%lu')",XDDDB_HOSTDOWNTIME_TABLE,=
escaped_host_name,entry_time,escaped_author_name,escaped_comment_data,start=
_time,end_time,fixed,duration);
#endif
sql_statement[sizeof(sql_statement)-1]=3D'\x0';
***************
*** 850,854 ****
#endif
#ifdef USE_XDDPGSQL
! snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_nam=
e,service_description,entry_time,author_name,comment_data,start_time,end_ti=
me,fixed

...[email truncated]...


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