Postgres patch

jbearce at citistreetonline.com jbearce at citistreetonline.com
Wed Nov 6 18:41:03 CET 2002


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(abstime
(%lu)),nagios_pid='%d',daemon_mode='%d',last_command_check=datetime(abstime(%lu)),last_log_rotation=datetime(abstime(%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);
+           snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET last_update=timestamptz(%lu),program_start=timestamptz(%lu),nagios_pid
='%d',daemon_mode='%d',last_command_check=timestamptz(%lu),last_log_rotation=timestamptz(%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
              }

@@ -999,7 +999,7 @@
                  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',FROM_UNIXTIME
(%lu),FROM_UNIXTIME(0),FROM_UNIXTIME(0),'0','0','0','0',FROM_UNIXTIME(0),'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
 #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',datetime(abstime
(%lu)),datetime(abstime(0)),datetime(abstime(0)),'0','0','0','0',datetime(abstime(0)),'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);

+                 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',timestamptz
(%lu),timestamptz(abstime(0)),timestamptz(abstime(0)),'0','0','0','0',timestamptz(abstime(0)),'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
                    }

@@ -1009,7 +1009,7 @@
                  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',FROM_UNIXTIME(%lu),FROM_UNIXTIME(%lu),FROM_UNIXTIME(%lu),'%d','%lu','%lu','%lu',FROM_UNIXTIME
(%lu),'%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
 #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',datetime(abstime(%lu)),datetime(abstime(%lu)),datetime(abstime(%lu)),'%d','%lu','%lu','%lu',datetime(abstime
(%lu)),'%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);
+                 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',timestamptz(%lu),timestamptz(%lu),timestamptz(%lu),'%d','%lu','%lu','%lu',timestamptz
(%lu),'%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
                    }
              }
@@ -1023,7 +1023,7 @@
                  snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET host_status='PENDING',last_update=FROM_UNIXTIME
(%lu),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
 #ifdef USE_XSDPGSQL
-                 snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET host_status='PENDING',last_update=datetime(abstime
(%lu)),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);
+                 snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET host_status='PENDING',last_update=timestamptz
(%lu),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
                    }

@@ -1033,7 +1033,7 @@
                  snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET host_status='%s',last_update=FROM_UNIXTIME
(%lu),last_check=FROM_UNIXTIME(%lu),last_state_change=FROM_UNIXTIME(%lu),problem_acknowledged='%d',time_up='%lu',time_down='%lu',time_unreachable
='%lu',last_notification=FROM_UNIXTIME(%lu),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
 #ifdef USE_XSDPGSQL
-                 snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET host_status='%s',last_update=datetime(abstime
(%lu)),last_check=datetime(abstime(%lu)),last_state_change=datetime(abstime(%lu)),problem_acknowledged='%d',time_up='%lu',time_down
='%lu',time_unreachable='%lu',last_notification=datetime(abstime(%lu)),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);
+                 snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET host_status='%s',last_update=timestamptz(%lu),last_check=timestamptz
(%lu),last_state_change=timestamptz(%lu),problem_acknowledged='%d',time_up='%lu',time_down='%lu',time_unreachable='%lu',last_notification=timestamptz
(%lu),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
                    }
              }
@@ -1138,7 +1138,7 @@
                  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',FROM_UNIXTIME(%lu),'0','%d','%s',FROM_UNIXTIME(0),FROM_UNIXTIME(%lu),'%d','%s','%d','%d','%d',FROM_UNIXTIME
(%lu),'%d','%s','%lu','%lu','%lu','%lu',FROM_UNIXTIME
(%lu),'%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
 #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',datetime(abstime(%lu)),'0','%d','%s',datetime(abstime(0)),datetime(abstime(%lu)),'%d','%s','%d','%d','%d',datetime(abstime
(%lu)),'%d','%s','%lu','%lu','%lu','%lu',datetime(abstime
(%lu)),'%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);


+                 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',timestamptz(%lu),'0','%d','%s',timestamptz(abstime(0)),timestamptz(%lu),'%d','%s','%d','%d','%d',timestamptz
(%lu),'%d','%s','%lu','%lu','%lu','%lu',timestamptz
(%lu),'%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
                    }

@@ -1149,7 +1149,7 @@
                  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',FROM_UNIXTIME(%lu),'%d','%d','%s',FROM_UNIXTIME(%lu),FROM_UNIXTIME(%lu),'%d','%s','%d','%d','%d',FROM_UNIXTIME
(%lu),'%d','%s','%lu','%lu','%lu','%lu',FROM_UNIXTIME
(%lu),'%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
 #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',datetime(abstime(%lu)),'%d','%d','%s',datetime(abstime(%lu)),datetime(abstime(%lu)),'%d','%s','%d','%d','%d',datetime(abstime
(%lu)),'%d','%s','%lu','%lu','%lu','%lu',datetime(abstime
(%lu)),'%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);
+                 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',timestamptz(%lu),'%d','%d','%s',timestamptz(%lu),timestamptz(%lu),'%d','%s','%d','%d','%d',timestamptz
(%lu),'%d','%s','%lu','%lu','%lu','%lu',timestamptz
(%lu),'%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
                    }

@@ -1175,7 +1175,7 @@
                  snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET service_status='PENDING',last_update=FROM_UNIXTIME
(%lu),current_attempt='%d',max_attempts='%d',state_type='%s',last_check=FROM_UNIXTIME(%lu),next_check=FROM_UNIXTIME(%lu),should_be_scheduled
='%d',check_type='%s',checks_enabled='%d',accept_passive_checks='%d',event_handler_enabled='%d',last_state_change=FROM_UNIXTIME
(%lu),problem_acknowledged='%d',last_hard_state='%s',time_ok='%lu',time_warning='%lu',time_unknown='%lu',time_critical
='%lu',last_notification=FROM_UNIXTIME(%lu),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
 #ifdef USE_XSDPGSQL
-                 snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET service_status='PENDING',last_update=datetime(abstime
(%lu)),current_attempt='%d',max_attempts='%d',state_type='%s',last_check=datetime(abstime(%lu)),next_check=datetime(abstime(%lu)),should_be_scheduled
='%d',check_type='%s',checks_enabled='%d',accept_passive_checks='%d',event_handler_enabled='%d',last_state_change=datetime(abstime
(%lu)),problem_acknowledged='%d',last_hard_state='%s',time_ok='%lu',time_warning='%lu',time_unknown='%lu',time_critical
='%lu',last_notification=datetime(abstime(%lu)),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);
+                 snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET service_status='PENDING',last_update=timestamptz(%lu),current_attempt
='%d',max_attempts='%d',state_type='%s',last_check=timestamptz(%lu),next_check=timestamptz(%lu),should_be_scheduled='%d',check_type
='%s',checks_enabled='%d',accept_passive_checks='%d',event_handler_enabled='%d',last_state_change=timestamptz(%lu),problem_acknowledged
='%d',last_hard_state='%s',time_ok='%lu',time_warning='%lu',time_unknown='%lu',time_critical='%lu',last_notification=timestamptz
(%lu),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
                    }

@@ -1185,7 +1185,7 @@
                  snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET service_status='%s',last_update=FROM_UNIXTIME(%lu),current_attempt
='%d',max_attempts='%d',state_type='%s',last_check=FROM_UNIXTIME(%lu),next_check=FROM_UNIXTIME(%lu),should_be_scheduled='%d',check_type
='%s',checks_enabled='%d',accept_passive_checks='%d',event_handler_enabled='%d',last_state_change=FROM_UNIXTIME(%lu),problem_acknowledged
='%d',last_hard_state='%s',time_ok='%lu',time_warning='%lu',time_unknown='%lu',time_critical='%lu',last_notification=FROM_UNIXTIME
(%lu),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
 #ifdef USE_XSDPGSQL
-                 snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET service_status='%s',last_update=datetime(abstime(%lu)),current_attempt
='%d',max_attempts='%d',state_type='%s',last_check=datetime(abstime(%lu)),next_check=datetime(abstime(%lu)),should_be_scheduled='%d',check_type
='%s',checks_enabled='%d',accept_passive_checks='%d',event_handler_enabled='%d',last_state_change=datetime(abstime(%lu)),problem_acknowledged
='%d',last_hard_state='%s',time_ok='%lu',time_warning='%lu',time_unknown='%lu',time_critical='%lu',last_notification=datetime(abstime
(%lu)),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);
+                 snprintf(sql_statement,sizeof(sql_statement)-1,"UPDATE %s SET service_status='%s',last_update=timestamptz(%lu),current_attempt
='%d',max_attempts='%d',state_type='%s',last_check=timestamptz(%lu),next_check=timestamptz(%lu),should_be_scheduled='%d',check_type
='%s',checks_enabled='%d',accept_passive_checks='%d',event_handler_enabled='%d',last_state_change=timestamptz(%lu),problem_acknowledged
='%d',last_hard_state='%s',time_ok='%lu',time_warning='%lu',time_unknown='%lu',time_critical='%lu',last_notification=timestamptz
(%lu),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
                    }
              }




-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm 
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en




More information about the Users mailing list