Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL error on adding host #56

Open
p4k8 opened this issue Feb 29, 2024 · 1 comment · May be fixed by #61
Open

SQL error on adding host #56

p4k8 opened this issue Feb 29, 2024 · 1 comment · May be fixed by #61
Assignees
Labels

Comments

@p4k8
Copy link

p4k8 commented Feb 29, 2024

Expected Behavior

Adding host to the map via Nagvis menu while using icingadb backend should add host object without errors and display map afterwards.

Current Behavior

Adding a host to the map using icingadb backend fails with SQL error and same error is displayed on a map after page reload and map stops working until added object is removed from it.
Capture_sql

Possible Solution

It stops displaying error if recognize_services on host object is explicitly set to No and map seems to be working fine with added hosts.

Steps to Reproduce (for bugs)

  1. Follow installation docs
  2. Go to any map
  3. Add host object to a map via menu
  4. Observe SQL error

Context

Your Environment

  • Module version (System - About): icingaweb2-module-nagvis-fix-unreachable-state-filters
  • Icinga Web 2 version and modules (System - About): 2.12.0, director, icingadb, nagvis
  • Icinga 2 version (icinga2 --version): 2.14.0-1
  • Operating System and version: Debian 12
  • Webserver, PHP versions: PHP 8.2
@adamparker
Copy link

adamparker commented Jul 22, 2024

During my testing I experienced this same error when I was using pgsql as the backend for icingadb.

This was not the case when using mysql as the backend.

The full error:

pgsql-1 | 2024-07-22 14:54:38.673 UTC [3281] ERROR: column "service.id" must appear in the GROUP BY clause or be used in an aggregate function at character 8

pgsql-1 | 2024-07-22 14:54:38.673 UTC [3281] STATEMENT: SELECT service.id, service.name, service.name_ci, (SUM(CASE WHEN service_state.soft_state = 99 THEN 1 ELSE 0 END)) AS services_pending, (SUM(CASE WHEN service_state.soft_state = 0 THEN 1 ELSE 0 END)) AS services_ok, (SUM(CASE WHEN service_state.soft_state = 0 AND service_state.in_downtime = 'y' THEN 1 ELSE 0 END)) AS services_ok_downtime, (SUM(CASE WHEN service_state.soft_state = 1 AND service_state.is_handled = 'n' THEN 1 ELSE 0 END)) AS services_warning, (SUM(CASE WHEN service_state.soft_state = 1 AND service_state.in_downtime = 'y' AND service_state.is_acknowledged = 'n' THEN 1 ELSE 0 END)) AS services_warning_downtime, (SUM(CASE WHEN service_state.soft_state = 1 AND service_state.is_acknowledged != 'n' THEN 1 ELSE 0 END)) AS services_warning_ack, (SUM(CASE WHEN service_state.soft_state = 2 AND service_state.is_handled = 'n' THEN 1 ELSE 0 END)) AS services_critical, (SUM(CASE WHEN service_state.soft_state = 2 AND service_state.in_downtime = 'y' AND service_state.is_acknowledged = 'n' THEN 1 ELSE 0 END)) AS services_critical_downtime, (SUM(CASE WHEN service_state.soft_state = 2 AND service_state.is_acknowledged != 'n' THEN 1 ELSE 0 END)) AS services_critical_ack, (SUM(CASE WHEN service_state.soft_state = 3 AND service_state.is_handled = 'n' THEN 1 ELSE 0 END)) AS services_unknown, (SUM(CASE WHEN service_state.soft_state = 3 AND service_state.in_downtime = 'y' AND service_state.is_acknowledged = 'n' THEN 1 ELSE 0 END)) AS services_unknown_downtime, (SUM(CASE WHEN service_state.soft_state = 3 AND service_state.is_acknowledged != 'n' THEN 1 ELSE 0 END)) AS services_unknown_ack, service_host.name AS host_name, service_host.name_ci AS host_nameci FROM service LEFT JOIN host service_host ON service_host.id = service.host_id LEFT JOIN service_state ON service_state.service_id = service.id WHERE service_host.name = $1 GROUP BY service_host.id, host_nameci, host_name

@yhabteab yhabteab added the bug label Sep 13, 2024
@yhabteab yhabteab self-assigned this Sep 13, 2024
@yhabteab yhabteab linked a pull request Sep 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants