[patch] postgresql abstime problem

Mariusz Sawicki numedides at konto.pl
Fri Apr 16 08:12:41 CEST 2004


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.


-------------- next part --------------
*** 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_name,persistent,entry_time,author_name,comment_data) VALUES ('%s','%d',%lu::abstime::timestamp,'%s','%s')",XCDDB_HOSTCOMMENTS_TABLE,escaped_host_name,persistent,entry_time,escaped_author_name,escaped_comment_data);
  #endif
  	sql_statement[sizeof(sql_statement)-1]='\x0';
--- 712,716 ----
  #endif
  #ifdef USE_XCDPGSQL
! 	snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,persistent,entry_time,author_name,comment_data) VALUES ('%s','%d',%lu::int4::abstime::timestamp,'%s','%s')",XCDDB_HOSTCOMMENTS_TABLE,escaped_host_name,persistent,entry_time,escaped_author_name,escaped_comment_data);
  #endif
  	sql_statement[sizeof(sql_statement)-1]='\x0';
***************
*** 810,814 ****
  #endif
  #ifdef USE_XCDPGSQL
! 	snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,service_description,persistent,entry_time,author_name,comment_data) VALUES ('%s','%s','%d',%lu::abstime::timestamp,'%s','%s')",XCDDB_SERVICECOMMENTS_TABLE,escaped_host_name,escaped_svc_description,persistent,entry_time,escaped_author_name,escaped_comment_data);
  #endif
  	sql_statement[sizeof(sql_statement)-1]='\x0';
--- 810,814 ----
  #endif
  #ifdef USE_XCDPGSQL
! 	snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,service_description,persistent,entry_time,author_name,comment_data) VALUES ('%s','%s','%d',%lu::int4::abstime::timestamp,'%s','%s')",XCDDB_SERVICECOMMENTS_TABLE,escaped_host_name,escaped_svc_description,persistent,entry_time,escaped_author_name,escaped_comment_data);
  #endif
  	sql_statement[sizeof(sql_statement)-1]='\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_name,entry_time,author_name,comment_data,start_time,end_time,fixed,duration) VALUES ('%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,fixed,duration);
  #endif
  	sql_statement[sizeof(sql_statement)-1]='\x0';
--- 752,756 ----
  #endif
  #ifdef USE_XDDPGSQL
! 	snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,entry_time,author_name,comment_data,start_time,end_time,fixed,duration) VALUES ('%s',%lu::int4::abstime::timestamp,'%s','%s',%lu::int4::abstime::timestamp,%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]='\x0';
***************
*** 850,854 ****
  #endif
  #ifdef USE_XDDPGSQL
! 	snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,service_description,entry_time,author_name,comment_data,start_time,end_time,fixed,duration) VALUES ('%s','%s',%lu::abstime::timestamp,'%s','%s',%lu::abstime::timestamp,%lu::abstime::timestamp,'%d','%lu')",XDDDB_SERVICEDOWNTIME_TABLE,escaped_host_name,escaped_svc_description,entry_time,escaped_author_name,escaped_comment_data,start_time,end_time,fixed,duration);
  #endif
  	sql_statement[sizeof(sql_statement)-1]='\x0';
--- 850,854 ----
  #endif
  #ifdef USE_XDDPGSQL
! 	snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,service_description,entry_time,author_name,comment_data,start_time,end_time,fixed,duration) VALUES ('%s','%s',%lu::int4::abstime::timestamp,'%s','%s',%lu::int4::abstime::timestamp,%lu::int4::abstime::timestamp,'%d','%lu')",XDDDB_SERVICEDOWNTIME_TABLE,escaped_host_name,escaped_svc_description,entry_time,escaped_author_name,escaped_comment_data,start_time,end_time,fixed,duration);
  #endif
  	sql_statement[sizeof(sql_statement)-1]='\x0';
*** nagios-1.2/xdata/xsddb.c	Sat May 31 22:44:27 2003
--- nagios-1.2-new/xdata/xsddb.c	Wed Apr  7 11:44:10 2004
***************
*** 910,914 ****
  #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 (%lu::abstime::timestamp,%lu::abstime::timestamp,'%d','%d',%lu::abstime::timestamp,%lu::abstime::timestamp,'%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
  	        }
--- 910,914 ----
  #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 (%lu::int4::abstime::timestamp,%lu::int4::abstime::timestamp,'%d','%d',%lu::int4::abstime::timestamp,%lu::int4::abstime::timestamp,'%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
  	        }
***************
*** 920,924 ****
  #endif
  #ifdef USE_XSDPGSQL
! 		snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET last_update=%lu::abstime::timestamp,program_start=%lu::abstime::timestamp,nagios_pid='%d',daemon_mode='%d',last_command_check=%lu::abstime::timestamp,last_log_rotation=%lu::abstime::timestamp,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
  	        }
--- 920,924 ----
  #endif
  #ifdef USE_XSDPGSQL
! 		snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET last_update=%lu::int4::abstime::timestamp,program_start=%lu::int4::abstime::timestamp,nagios_pid='%d',daemon_mode='%d',last_command_check=%lu::int4::abstime::timestamp,last_log_rotation=%lu::int4::abstime::timestamp,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
  	        }
***************
*** 1000,1004 ****
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,host_status,last_update,last_check,last_state_change,problem_acknowledged,time_up,time_down,time_unreachable,last_notification,current_notification,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,plugin_output) VALUES ('%s','PENDING',%lu::abstime::timestamp,0::abstime::timestamp,0::abstime::timestamp,'0','0','0','0',0::abstime::timestamp,'0','%d','%d','%d','%d','0','0.0','%d','%d','%d','(Not enough data to determine host status yet)')",XSDDB_HOSTSTATUS_TABLE,escaped_host_name,(unsigned long)last_update,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data);
  #endif
  		        }
--- 1000,1004 ----
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,host_status,last_update,last_check,last_state_change,problem_acknowledged,time_up,time_down,time_unreachable,last_notification,current_notification,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,plugin_output) VALUES ('%s','PENDING',%lu::int4::abstime::timestamp,0::int4::abstime::timestamp,0::int4::abstime::timestamp,'0','0','0','0',0::int4::abstime::timestamp,'0','%d','%d','%d','%d','0','0.0','%d','%d','%d','(Not enough data to determine host status yet)')",XSDDB_HOSTSTATUS_TABLE,escaped_host_name,(unsigned long)last_update,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data);
  #endif
  		        }
***************
*** 1010,1014 ****
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,host_status,last_update,last_check,last_state_change,problem_acknowledged,time_up,time_down,time_unreachable,last_notification,current_notification,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,plugin_output) VALUES ('%s','%s',%lu::abstime::timestamp,%lu::abstime::timestamp,%lu::abstime::timestamp,'%d','%lu','%lu','%lu',%lu::abstime::timestamp,'%d','%d','%d','%d','%d','%d','%f','%d','%d','%d','%s')",XSDDB_HOSTSTATUS_TABLE,escaped_host_name,status,(unsigned long)last_update,(unsigned long)last_check,(unsigned long)last_state_change,problem_has_been_acknowledged,time_up,time_down,time_unreachable,(unsigned long)last_notification,current_notification_number,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,escaped_plugin_output);
  #endif
  		        }
--- 1010,1014 ----
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,host_status,last_update,last_check,last_state_change,problem_acknowledged,time_up,time_down,time_unreachable,last_notification,current_notification,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,plugin_output) VALUES ('%s','%s',%lu::int4::abstime::timestamp,%lu::int4::abstime::timestamp,%lu::int4::abstime::timestamp,'%d','%lu','%lu','%lu',%lu::int4::abstime::timestamp,'%d','%d','%d','%d','%d','%d','%f','%d','%d','%d','%s')",XSDDB_HOSTSTATUS_TABLE,escaped_host_name,status,(unsigned long)last_update,(unsigned long)last_check,(unsigned long)last_state_change,problem_has_been_acknowledged,time_up,time_down,time_unreachable,(unsigned long)last_notification,current_notification_number,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,escaped_plugin_output);
  #endif
  		        }
***************
*** 1024,1028 ****
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET host_status='PENDING',last_update=%lu::abstime::timestamp,notifications_enabled='%d',event_handler_enabled='%d',checks_enabled='%d',flap_detection_enabled='%d',is_flapping='%d',percent_state_change='%f',scheduled_downtime_depth='%d',failure_prediction_enabled='%d',process_performance_data='%d',plugin_output='(Not enough data to determine host status yet)' WHERE host_name='%s'",XSDDB_HOSTSTATUS_TABLE,(unsigned long)last_update,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,escaped_host_name);
  #endif
  		        }
--- 1024,1028 ----
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET host_status='PENDING',last_update=%lu::int4::abstime::timestamp,notifications_enabled='%d',event_handler_enabled='%d',checks_enabled='%d',flap_detection_enabled='%d',is_flapping='%d',percent_state_change='%f',scheduled_downtime_depth='%d',failure_prediction_enabled='%d',process_performance_data='%d',plugin_output='(Not enough data to determine host status yet)' WHERE host_name='%s'",XSDDB_HOSTSTATUS_TABLE,(unsigned long)last_update,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,escaped_host_name);
  #endif
  		        }
***************
*** 1034,1038 ****
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET host_status='%s',last_update=%lu::abstime::timestamp,last_check=%lu::abstime::timestamp,last_state_change=%lu::abstime::timestamp,problem_acknowledged='%d',time_up='%lu',time_down='%lu',time_unreachable='%lu',last_notification=%lu::abstime::timestamp,current_notification='%d',notifications_enabled='%d',event_handler_enabled='%d',checks_enabled='%d',flap_detection_enabled='%d',is_flapping='%d',percent_state_change='%f',scheduled_downtime_depth='%d',failure_prediction_enabled='%d',process_performance_data='%d',plugin_output='%s' WHERE host_name='%s'",XSDDB_HOSTSTATUS_TABLE,status,(unsigned long)last_update,(unsigned long)last_check,(unsigned long)last_state_change,problem_has_been_acknowledged,time_up,time_down,time_unreachable,(unsigned long)last_notification,current_notification_number,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,(last_check==(time_t)0)?"(Not enough data to determine host status yet)":escaped_plugin_output,escaped_host_name);
  #endif
  		        }
--- 1034,1038 ----
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET host_status='%s',last_update=%lu::int4::abstime::timestamp,last_check=%lu::int4::abstime::timestamp,last_state_change=%lu::int4::abstime::timestamp,problem_acknowledged='%d',time_up='%lu',time_down='%lu',time_unreachable='%lu',last_notification=%lu::int4::abstime::timestamp,current_notification='%d',notifications_enabled='%d',event_handler_enabled='%d',checks_enabled='%d',flap_detection_enabled='%d',is_flapping='%d',percent_state_change='%f',scheduled_downtime_depth='%d',failure_prediction_enabled='%d',process_performance_data='%d',plugin_output='%s' WHERE host_name='%s'",XSDDB_HOSTSTATUS_TABLE,status,(unsigned long)last_update,(unsigned long)last_check,(unsigned long)last_state_change,problem_has_been_acknowledged,time_up,time_down,time_unreachable,(unsigned long)last_notification,current_notification_number,notifications_enabled,event_handler_enabled,checks_enabled,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,(last_check==(time_t)0)?"(Not enough data to determine host status yet)":escaped_plugin_output,escaped_host_name);
  #endif
  		        }
***************
*** 1139,1143 ****
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,service_description,service_status,last_update,current_attempt,max_attempts,state_type,last_check,next_check,should_be_scheduled,check_type,checks_enabled,accept_passive_checks,event_handler_enabled,last_state_change,problem_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,last_notification,current_notification,notifications_enabled,latency,execution_time,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,plugin_output) VALUES ('%s','%s','PENDING',%lu::abstime::timestamp,'0','%d','%s',0::abstime::timestamp,%lu::abstime::timestamp,'%d','%s','%d','%d','%d',%lu::abstime::timestamp,'%d','%s','%lu','%lu','%lu','%lu',%lu::abstime::timestamp,'%d','%d','%d','%d','%d','0','0.0','%d','%d','%d','%d','%s')",XSDDB_SERVICESTATUS_TABLE,escaped_host_name,escaped_description,(unsigned long)last_update,max_attempts,(state_type==HARD_STATE)?"HARD":"SOFT",(unsigned long)next_check,should_be_scheduled,(check_type==SERVICE_CHECK_ACTIVE)?"ACTIVE":"PASSIVE",checks_enabled,accept_passive_service_checks,event_handler_enabled,(unsigned long)last_state_change,problem_has_been_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,(unsigned long)last_notification,current_notification_number,notifications_enabled,latency,execution_time,flap_detection_enabled,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,buffer); 
  #endif
  		        }
--- 1139,1143 ----
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,service_description,service_status,last_update,current_attempt,max_attempts,state_type,last_check,next_check,should_be_scheduled,check_type,checks_enabled,accept_passive_checks,event_handler_enabled,last_state_change,problem_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,last_notification,current_notification,notifications_enabled,latency,execution_time,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,plugin_output) VALUES ('%s','%s','PENDING',%lu::int4::abstime::timestamp,'0','%d','%s',0::int4::abstime::timestamp,%lu::int4::abstime::timestamp,'%d','%s','%d','%d','%d',%lu::int4::abstime::timestamp,'%d','%s','%lu','%lu','%lu','%lu',%lu::int4::abstime::timestamp,'%d','%d','%d','%d','%d','0','0.0','%d','%d','%d','%d','%s')",XSDDB_SERVICESTATUS_TABLE,escaped_host_name,escaped_description,(unsigned long)last_update,max_attempts,(state_type==HARD_STATE)?"HARD":"SOFT",(unsigned long)next_check,should_be_scheduled,(check_type==SERVICE_CHECK_ACTIVE)?"ACTIVE":"PASSIVE",checks_enabled,accept_passive_service_checks,event_handler_enabled,(unsigned long)last_state_change,problem_has_been_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,(unsigned long)last_notification,current_notification_number,notifications_enabled,latency,execution_time,flap_detection_enabled,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,buffer); 
  #endif
  		        }
***************
*** 1150,1154 ****
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,service_description,service_status,last_update,current_attempt,max_attempts,state_type,last_check,next_check,should_be_scheduled,check_type,checks_enabled,accept_passive_checks,event_handler_enabled,last_state_change,problem_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,last_notification,current_notification,notifications_enabled,latency,execution_time,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,plugin_output) VALUES ('%s','%s','%s',%lu::abstime::timestamp,'%d','%d','%s',%lu::abstime::timestamp,%lu::abstime::timestamp,'%d','%s','%d','%d','%d',%lu::abstime::timestamp,'%d','%s','%lu','%lu','%lu','%lu',%lu::abstime::timestamp,'%d','%d','%d','%d','%d','%d','%f','%d','%d','%d','%d','%s')",XSDDB_SERVICESTATUS_TABLE,escaped_host_name,escaped_description,status,(unsigned long)last_update,current_attempt,max_attempts,(state_type==HARD_STATE)?"HARD":"SOFT",(unsigned long)last_check,(unsigned long)next_check,should_be_scheduled,(check_type==SERVICE_CHECK_ACTIVE)?"ACTIVE":"PASSIVE",checks_enabled,accept_passive_service_checks,event_handler_enabled,(unsigned long)last_state_change,problem_has_been_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,(unsigned long)last_notification,current_notification_number,notifications_enabled,latency,execution_time,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,escaped_plugin_output);
  #endif
  		        }
--- 1150,1154 ----
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"INSERT INTO %s (host_name,service_description,service_status,last_update,current_attempt,max_attempts,state_type,last_check,next_check,should_be_scheduled,check_type,checks_enabled,accept_passive_checks,event_handler_enabled,last_state_change,problem_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,last_notification,current_notification,notifications_enabled,latency,execution_time,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,plugin_output) VALUES ('%s','%s','%s',%lu::int4::abstime::timestamp,'%d','%d','%s',%lu::int4::abstime::timestamp,%lu::int4::abstime::timestamp,'%d','%s','%d','%d','%d',%lu::int4::abstime::timestamp,'%d','%s','%lu','%lu','%lu','%lu',%lu::int4::abstime::timestamp,'%d','%d','%d','%d','%d','%d','%f','%d','%d','%d','%d','%s')",XSDDB_SERVICESTATUS_TABLE,escaped_host_name,escaped_description,status,(unsigned long)last_update,current_attempt,max_attempts,(state_type==HARD_STATE)?"HARD":"SOFT",(unsigned long)last_check,(unsigned long)next_check,should_be_scheduled,(check_type==SERVICE_CHECK_ACTIVE)?"ACTIVE":"PASSIVE",checks_enabled,accept_passive_service_checks,event_handler_enabled,(unsigned long)last_state_change,problem_has_been_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,(unsigned long)last_notification,current_notification_number,notifications_enabled,latency,execution_time,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,escaped_plugin_output);
  #endif
  		        }
***************
*** 1176,1180 ****
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET service_status='PENDING',last_update=%lu::abstime::timestamp,current_attempt='%d',max_attempts='%d',state_type='%s',last_check=%lu::abstime::timestamp,next_check=%lu::abstime::timestamp,should_be_scheduled='%d',check_type='%s',checks_enabled='%d',accept_passive_checks='%d',event_handler_enabled='%d',last_state_change=%lu::abstime::timestamp,problem_acknowledged='%d',last_hard_state='%s',time_ok='%lu',time_warning='%lu',time_unknown='%lu',time_critical='%lu',last_notification=%lu::abstime::timestamp,current_notification='%d',notifications_enabled='%d',latency='%d',execution_time='%d',flap_detection_enabled='%d',is_flapping='%d',percent_state_change='%f',scheduled_downtime_depth='%d',failure_prediction_enabled='%d',process_performance_data='%d',obsess_over_service='%d',plugin_output='%s' WHERE host_name='%s' AND service_description='%s'",XSDDB_SERVICESTATUS_TABLE,(unsigned long)last_update,current_attempt,max_attempts,(state_type==HARD_STATE)?"HARD":"SOFT",(unsigned long)last_check,(unsigned long)next_check,should_be_scheduled,(check_type==SERVICE_CHECK_ACTIVE)?"ACTIVE":"PASSIVE",checks_enabled,accept_passive_service_checks,event_handler_enabled,(unsigned long)last_state_change,problem_has_been_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,(unsigned long)last_notification,current_notification_number,notifications_enabled,latency,execution_time,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,buffer,escaped_host_name,escaped_description);
  #endif
  		        }
--- 1176,1180 ----
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET service_status='PENDING',last_update=%lu::int4::abstime::timestamp,current_attempt='%d',max_attempts='%d',state_type='%s',last_check=%lu::int4::abstime::timestamp,next_check=%lu::int4::abstime::timestamp,should_be_scheduled='%d',check_type='%s',checks_enabled='%d',accept_passive_checks='%d',event_handler_enabled='%d',last_state_change=%lu::int4::abstime::timestamp,problem_acknowledged='%d',last_hard_state='%s',time_ok='%lu',time_warning='%lu',time_unknown='%lu',time_critical='%lu',last_notification=%lu::int4::abstime::timestamp,current_notification='%d',notifications_enabled='%d',latency='%d',execution_time='%d',flap_detection_enabled='%d',is_flapping='%d',percent_state_change='%f',scheduled_downtime_depth='%d',failure_prediction_enabled='%d',process_performance_data='%d',obsess_over_service='%d',plugin_output='%s' WHERE host_name='%s' AND service_description='%s'",XSDDB_SERVICESTATUS_TABLE,(unsigned long)last_update,current_attempt,max_attempts,(state_type==HARD_STATE)?"HARD":"SOFT",(unsigned long)last_check,(unsigned long)next_check,should_be_scheduled,(check_type==SERVICE_CHECK_ACTIVE)?"ACTIVE":"PASSIVE",checks_enabled,accept_passive_service_checks,event_handler_enabled,(unsigned long)last_state_change,problem_has_been_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,(unsigned long)last_notification,current_notification_number,notifications_enabled,latency,execution_time,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,buffer,escaped_host_name,escaped_description);
  #endif
  		        }
***************
*** 1186,1190 ****
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET service_status='%s',last_update=%lu::abstime::timestamp,current_attempt='%d',max_attempts='%d',state_type='%s',last_check=%lu::abstime::timestamp,next_check=%lu::abstime::timestamp,should_be_scheduled='%d',check_type='%s',checks_enabled='%d',accept_passive_checks='%d',event_handler_enabled='%d',last_state_change=%lu::abstime::timestamp,problem_acknowledged='%d',last_hard_state='%s',time_ok='%lu',time_warning='%lu',time_unknown='%lu',time_critical='%lu',last_notification=%lu::abstime::timestamp,current_notification='%d',notifications_enabled='%d',latency='%d',execution_time='%d',flap_detection_enabled='%d',is_flapping='%d',percent_state_change='%f',scheduled_downtime_depth='%d',failure_prediction_enabled='%d',process_performance_data='%d',obsess_over_service='%d',plugin_output='%s' WHERE host_name='%s' AND service_description='%s'",XSDDB_SERVICESTATUS_TABLE,status,(unsigned long)last_update,current_attempt,max_attempts,(state_type==HARD_STATE)?"HARD":"SOFT",(unsigned long)last_check,(unsigned long)next_check,should_be_scheduled,(check_type==SERVICE_CHECK_ACTIVE)?"ACTIVE":"PASSIVE",checks_enabled,accept_passive_service_checks,event_handler_enabled,(unsigned long)last_state_change,problem_has_been_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,(unsigned long)last_notification,current_notification_number,notifications_enabled,latency,execution_time,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,escaped_plugin_output,escaped_host_name,escaped_description);
  #endif
  		        }
--- 1186,1190 ----
  #endif
  #ifdef USE_XSDPGSQL
! 			snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET service_status='%s',last_update=%lu::int4::abstime::timestamp,current_attempt='%d',max_attempts='%d',state_type='%s',last_check=%lu::int4::abstime::timestamp,next_check=%lu::int4::abstime::timestamp,should_be_scheduled='%d',check_type='%s',checks_enabled='%d',accept_passive_checks='%d',event_handler_enabled='%d',last_state_change=%lu::int4::abstime::timestamp,problem_acknowledged='%d',last_hard_state='%s',time_ok='%lu',time_warning='%lu',time_unknown='%lu',time_critical='%lu',last_notification=%lu::int4::abstime::timestamp,current_notification='%d',notifications_enabled='%d',latency='%d',execution_time='%d',flap_detection_enabled='%d',is_flapping='%d',percent_state_change='%f',scheduled_downtime_depth='%d',failure_prediction_enabled='%d',process_performance_data='%d',obsess_over_service='%d',plugin_output='%s' WHERE host_name='%s' AND service_description='%s'",XSDDB_SERVICESTATUS_TABLE,status,(unsigned long)last_update,current_attempt,max_attempts,(state_type==HARD_STATE)?"HARD":"SOFT",(unsigned long)last_check,(unsigned long)next_check,should_be_scheduled,(check_type==SERVICE_CHECK_ACTIVE)?"ACTIVE":"PASSIVE",checks_enabled,accept_passive_service_checks,event_handler_enabled,(unsigned long)last_state_change,problem_has_been_acknowledged,last_hard_state,time_ok,time_warning,time_unknown,time_critical,(unsigned long)last_notification,current_notification_number,notifications_enabled,latency,execution_time,flap_detection_enabled,is_flapping,percent_state_change,scheduled_downtime_depth,failure_prediction_enabled,process_performance_data,obsess_over_service,escaped_plugin_output,escaped_host_name,escaped_description);
  #endif
  		        }


More information about the Developers mailing list