SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near ")" LINE 6: ...xxxxx.yyy.zz' AND LOWER(so.name2) = 'disk' AND () ) ORDER ... ^, query was: SELECT hs.problem_has_been_acknowledged AS host_acknowledged, hs.active_checks_enabled AS host_active_checks_enabled, h.address AS host_address, h.alias AS host_alias, h.display_name AS host_display_name, CASE WHEN (hs.problem_has_been_acknowledged + hs.scheduled_downtime_depth) > 0 THEN 1 ELSE 0 END AS host_handled, CASE WHEN (hs.scheduled_downtime_depth = 0) THEN 0 ELSE 1 END AS host_in_downtime, CASE WHEN ((hs.last_state_change) < '1970-01-03 00:00:00+00'::timestamp with time zone) THEN 0 ELSE UNIX_TIMESTAMP((hs.last_state_change)) END AS host_last_state_change, ho.name1 AS host_name, hs.notifications_enabled AS host_notifications_enabled, hs.passive_checks_enabled AS host_passive_checks_enabled, CASE WHEN hs.has_been_checked = 0 OR hs.has_been_checked IS NULL THEN 99 ELSE hs.current_state END AS host_state, ss.problem_has_been_acknowledged AS service_acknowledged, s.action_url AS service_action_url, ss.active_checks_enabled AS service_active_checks_enabled, CASE WHEN ss.active_checks_enabled=s.active_checks_enabled THEN 0 ELSE 1 END AS service_active_checks_enabled_changed, ss.current_check_attempt || '/' || ss.max_check_attempts AS service_attempt, ss.check_command AS service_check_command, ss.execution_time AS service_check_execution_time, ss.latency AS service_check_latency, ss.check_source AS service_check_source, ss.current_notification_number AS service_current_notification_number, so.name2 AS service_description, s.display_name AS service_display_name, ss.event_handler_enabled AS service_event_handler_enabled, CASE WHEN ss.event_handler_enabled=s.event_handler_enabled THEN 0 ELSE 1 END AS service_event_handler_enabled_changed, ss.flap_detection_enabled AS service_flap_detection_enabled, CASE WHEN ss.flap_detection_enabled=s.flap_detection_enabled THEN 0 ELSE 1 END AS service_flap_detection_enabled_changed, CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) > 0 THEN 1 ELSE 0 END AS service_handled, CASE WHEN (ss.scheduled_downtime_depth = 0 OR ss.scheduled_downtime_depth IS NULL) THEN 0 ELSE 1 END AS service_in_downtime, ss.is_flapping AS service_is_flapping, ss.is_reachable AS service_is_reachable, CASE WHEN ((ss.last_check) < '1970-01-03 00:00:00+00'::timestamp with time zone) THEN 0 ELSE UNIX_TIMESTAMP((ss.last_check)) END AS service_last_check, CASE WHEN ((ss.last_notification) < '1970-01-03 00:00:00+00'::timestamp with time zone) THEN 0 ELSE UNIX_TIMESTAMP((ss.last_notification)) END AS service_last_notification, CASE WHEN ((ss.last_state_change) < '1970-01-03 00:00:00+00'::timestamp with time zone) THEN 0 ELSE UNIX_TIMESTAMP((ss.last_state_change)) END AS service_last_state_change, ss.long_output AS service_long_output, CASE WHEN ((ss.next_check) < '1970-01-03 00:00:00+00'::timestamp with time zone) THEN 0 ELSE UNIX_TIMESTAMP((ss.next_check)) END AS service_next_check, s.notes_url AS service_notes_url, ss.notifications_enabled AS service_notifications_enabled, CASE WHEN ss.notifications_enabled=s.notifications_enabled THEN 0 ELSE 1 END AS service_notifications_enabled_changed, ss.obsess_over_service AS service_obsessing, CASE WHEN ss.obsess_over_service=s.obsess_over_service THEN 0 ELSE 1 END AS service_obsessing_changed, ss.output AS service_output, ss.passive_checks_enabled AS service_passive_checks_enabled, CASE WHEN ss.passive_checks_enabled=s.passive_checks_enabled THEN 0 ELSE 1 END AS service_passive_checks_enabled_changed, ss.percent_state_change AS service_percent_state_change, ss.perfdata AS service_perfdata, ss.process_performance_data AS service_process_perfdata, CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END AS service_state, ss.state_type AS service_state_type FROM icinga_objects AS ho INNER JOIN icinga_hoststatus AS hs ON ho.object_id = hs.host_object_id AND ho.is_active = 1 AND ho.objecttype_id = 1 INNER JOIN icinga_hosts AS h ON hs.host_object_id = h.host_object_id INNER JOIN icinga_services AS s ON s.host_object_id = h.host_object_id INNER JOIN icinga_objects AS so ON so.object_id = s.service_object_id AND so.is_active = 1 LEFT JOIN icinga_servicestatus AS ss ON so.object_id = ss.service_object_id WHERE (LOWER(ho.name1) = 'wwwww.xxxxx.yyy.zz' AND LOWER(so.name2) = 'disk' AND () ) ORDER BY s.display_name ASC, h.display_name ASC