This is a patch to fix my problems with timestamps using Postgres 7.2.3...
I'm not sure if it's backwards compatible or what postgres version things
changed in but thought it might be useful to someone...
diff -aur nagios-1.0b6/xdata/xsddb.c nagios-1.0b6.fix/xdata/xsddb.c
--- nagios-1.0b6/xdata/xsddb.c Mon May 27 19:47:39 2002
+++ nagios-1.0b6.fix/xdata/xsddb.c Wed Nov 6 12:04:38 2002
@@ -909,7 +909,7 @@
snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s
(last_update,program_start,nagios_pid,daemon_mode,last_command_check,last_log_rotation,enable_notifications,execute_service_checks,accept_passive_service_checks,enable_event_handlers,obsess_over_services,enable_flap_detection,enable_failure_prediction,process_performance_data)
VALUES (FROM_UNIXTIME(%lu),FROM_UNIXTIME(%lu),'%d','%d',FROM_UNIXTIME(%lu),FROM_UNIXTIME
(%lu),'%d','%d','%d','%d','%d','%d','%d','%d')",XSDDB_PROGRAMSTATUS_TABLE,(unsigned long)current_time,(unsigned long)_program_start,_nagios_pid,
_daemon_mode,(unsigned long)_last_command_check,(unsigned long)_last_log_rotation,_enable_notifications,_execute_service_checks,
_accept_passive_service_checks,_enable_event_handlers,_obsess_over_services,_enable_flap_detection,_enable_failure_prediction,
_process_performance_data);
#endif
#ifdef USE_XSDPGSQL
- snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s
(last_update,program_start,nagios_pid,daemon_mode,last_command_check,last_log_rotation,enable_notifications,execute_service_checks,accept_passive_service_checks,enable_event_handlers,obsess_over_services,enable_flap_detection,enable_failure_prediction,process_performance_data)
VALUES (datetime(abstime(%lu)),datetime(abstime(%lu)),'%d','%d',datetime(abstime(%lu)),datetime(abstime
(%lu)),'%d','%d','%d','%d','%d','%d','%d','%d')",XSDDB_PROGRAMSTATUS_TABLE,(unsigned long)current_time,(unsigned long)_program_start,_nagios_pid,
_daemon_mode,(unsigned long)_last_command_check,(unsigned long)_last_log_rotation,_enable_notifications,_execute_service_checks,
_accept_passive_service_checks,_enable_event_handlers,_obsess_over_services,_enable_flap_detection,_enable_failure_prediction,
_process_performance_data);
+ snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s
(last_update,program_start,nagios_pid,daemon_mode,last_command_check,last_log_rotation,enable_notifications,execute_service_checks,accept_passive_service_checks,enable_event_handlers,obsess_over_services,enable_flap_detection,enable_failure_prediction,process_performance_data)
VALUES (timestamptz(%lu),timestamptz(%lu),'%d','%d',timestamptz(%lu),timestamptz
(%lu),'%d','%d','%d','%d','%d','%d','%d','%d')",XSDDB_PROGRAMSTATUS_TABLE,(unsigned long)current_time,(unsigned long)_program_start,_nagios_pid,
_daemon_mode,(unsigned long)_last_command_check,(unsigned long)_last_log_rotation,_enable_notifications,_execute_service_checks,
_accept_passive_service_checks,_enable_event_handlers,_obsess_over_services,_enable_flap_detection,_enable_failure_prediction,
_process_performance_data);
#endif
}
@@ -919,7 +919,7 @@
snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET last_update=FROM_UNIXTIME(%lu),program_start=FROM_UNIXTIME(%lu),nagios_pid
='%d',daemon_mode='%d',last_command_check=FROM_UNIXTIME(%lu),last_log_rotation=FROM_UNIXTIME(%lu),enable_notifications='%d',execute_service_checks
='%d',accept_passive_service_checks='%d',enable_event_handlers='%d',obsess_over_services='%d',enable_flap_detection='%d',enable_failure_prediction
='%d',process_performance_data='%d'",XSDDB_PROGRAMSTATUS_TABLE,(unsigned long)current_time,(unsigned long)_program_start,_nagios_pid,
_daemon_mode,(unsigned long)_last_command_check,(unsigned long)_last_log_rotation,_enable_notifications,_execute_service_checks,
_accept_passive_service_checks,_enable_event_handlers,_obsess_over_services,_enable_flap_detection,_enable_failure_prediction,
_process_performance_data);
#endif
#ifdef USE_XSDPGSQL
- snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET last_update=datetime(abstime(%lu)),program_start=datetime(abs
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: bearce@citistreetonline.co