Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

blank page after massive change on notification settings #10014

Open
3 tasks
rmorandell-pgum opened this issue Jul 21, 2021 · 4 comments
Open
3 tasks

blank page after massive change on notification settings #10014

rmorandell-pgum opened this issue Jul 21, 2021 · 4 comments

Comments

@rmorandell-pgum
Copy link

rmorandell-pgum commented Jul 21, 2021

BUG REPORT INFORMATION

Versions

all versions greater than 20.10.x. Tested also on 21.04.x

$ centreon-20.10.8-5.el7.centos.noarch
centreon-auto-discovery-server-20.10.3-2.el7.centos.noarch
centreon-awie-20.10.0-1.el7.centos.noarch
centreon-base-config-centreon-engine-20.10.8-5.el7.centos.noarch
centreon-broker-20.10.5-2.el7.centos.x86_64
centreon-broker-cbd-20.10.5-2.el7.centos.x86_64
centreon-broker-cbmod-20.10.5-2.el7.centos.x86_64
centreon-broker-core-20.10.5-2.el7.centos.x86_64
centreon-broker-graphite-20.10.5-2.el7.centos.x86_64
centreon-broker-influxdb-20.10.5-2.el7.centos.x86_64
centreon-broker-storage-20.10.5-2.el7.centos.x86_64
centreon-clib-20.10.2-1.el7.centos.x86_64
centreon-common-20.10.8-5.el7.centos.noarch
centreon-connector-20.10.1-1.el7.centos.x86_64
centreon-connector-perl-20.10.1-1.el7.centos.x86_64
centreon-connector-ssh-20.10.1-1.el7.centos.x86_64
centreon-database-20.10.8-5.el7.centos.noarch
centreon-engine-20.10.5-3.el7.centos.x86_64
centreon-engine-daemon-20.10.5-3.el7.centos.x86_64
centreon-engine-extcommands-20.10.5-3.el7.centos.x86_64
centreon-fingerprint-20.10.0-2.el7.centos.x86_64
centreon-gorgone-20.10.4-1.el7.centos.noarch
centreon-gorgone-centreon-config-20.10.3-1.el7.centos.noarch
centreon-license-manager-20.10.3-3.el7.centos.noarch
centreon-license-manager-common-20.10.3-3.el7.centos.noarch
centreon-open-tickets-20.10.2-1.el7.centos.noarch
centreon-perl-libs-20.10.8-5.el7.centos.noarch
centreon-poller-centreon-engine-20.10.8-5.el7.centos.noarch
centreon-pp-manager-20.10.1-3.el7.centos.noarch
centreon-release-20.10-2.el7.centos.noarch
centreon-trap-20.10.8-5.el7.centos.noarch
centreon-web-20.10.8-5.el7.centos.noarch
centreon-widget-engine-status-20.10.0-5.el7.centos.noarch
centreon-widget-global-health-20.10.0-5.el7.centos.noarch
centreon-widget-graph-monitoring-20.10.0-5.el7.centos.noarch
centreon-widget-grid-map-20.10.0-5.el7.centos.noarch
centreon-widget-hostgroup-monitoring-20.10.0-5.el7.centos.noarch
centreon-widget-host-monitoring-20.10.0-5.el7.centos.noarch
centreon-widget-httploader-20.10.0-5.el7.centos.noarch
centreon-widget-live-top10-cpu-usage-20.10.0-5.el7.centos.noarch
centreon-widget-live-top10-memory-usage-20.10.0-5.el7.centos.noarch
centreon-widget-servicegroup-monitoring-20.10.0-5.el7.centos.noarch
centreon-widget-service-monitoring-20.10.0-5.el7.centos.noarch
centreon-widget-tactical-overview-20.10.0-5.el7.centos.noarch

Operating System

CentOS

Browser used

  • [X ] Google Chrome
  • Firefox
  • Internet Explorer IE11
  • Safari

Version: 91.0.4472.124

Description

Massive change of two or more hosts with changes to the notification settings including the "Contact group additive inheritance" field leads to a blank page.

Steps to Reproduce

Please describe precisely the steps to reproduce the encountered issue.

  1. I logged in Centreon
  2. Add two new hosts
  3. Massive change for this two hosts
  4. Changes: Notification Enabled => default, Contact group additive inheritance => YES, Linked Contact Groups => a random contact group

changes:

image

Logs

PHP error logs

[21-Jul-2021 15:31:06 Europe/Paris] PHP Fatal error:  Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'g_additive_inheritance' in 'field list' in /usr/share/centreon/www/class/centreonDBStatement.class.php:111
Stack trace:
#0 /usr/share/centreon/www/include/configuration/configObject/host/DB-Func.php(1405): CentreonDBStatement->execute()
#1 /usr/share/centreon/www/include/configuration/configObject/host/DB-Func.php(645): updateHost_MC(415)
#2 /usr/share/centreon/www/include/configuration/configObject/host/formHost.php(1217): updateHostInDB(415, true)
#3 /usr/share/centreon/www/include/configuration/configObject/host/host.php(109): require_once('/usr/share/cent...')
#4 /usr/share/centreon/www/main.get.php(258): include_once('/usr/share/cent...')
#5 {main}
  thrown in /usr/share/centreon/www/class/centreonDBStatement.class.php on line 111
[21-Jul-2021 15:32:01 Europe/Paris] PHP Warning:  Illegal string offset 'host_register' in /usr/share/centreon/www/include/configuration/configObject/host/DB-Func.php on line 2573
[21-Jul-2021 15:32:01 Europe/Paris] PHP Warning:  Illegal string offset 'host_register' in /usr/share/centreon/www/include/configuration/configObject/host/DB-Func.php on line 2574
[21-Jul-2021 15:32:01 Europe/Paris] PHP Fatal error:  Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'g_additive_inheritance' in 'field list' in /usr/share/centreon/www/class/centreonDBStatement.class.php:111
Stack trace:
#0 /usr/share/centreon/www/include/configuration/configObject/host/DB-Func.php(1405): CentreonDBStatement->execute()
#1 /usr/share/centreon/www/include/configuration/configObject/host/DB-Func.php(645): updateHost_MC(415)
#2 /usr/share/centreon/www/include/configuration/configObject/host/formHost.php(1217): updateHostInDB(415, true)
#3 /usr/share/centreon/www/include/configuration/configObject/host/host.php(109): require_once('/usr/share/cent...')
#4 /usr/share/centreon/www/main.get.php(258): include_once('/usr/share/cent...')
#5 {main}
  thrown in /usr/share/centreon/www/class/centreonDBStatement.class.php on line 111

Additional relevant information (e.g. frequency, ...)

@itsul
Copy link

itsul commented Oct 19, 2021

We've got same Problem on Centreon 21.04.6 and 21.04.7
Any news to this?
Do you have any plans, when it will be fixed?

@lpinsivy
Copy link
Contributor

@itsul can you compare the schema of centreon.host with this one:

MariaDB [centreon]> desc  host;
+-----------------------------------+-----------------------+------+-----+---------+----------------+
| Field                             | Type                  | Null | Key | Default | Extra          |
+-----------------------------------+-----------------------+------+-----+---------+----------------+
| host_id                           | int(11)               | NO   | PRI | NULL    | auto_increment |
| host_template_model_htm_id        | int(11)               | YES  | MUL | NULL    |                |
| command_command_id                | int(11)               | YES  | MUL | NULL    |                |
| command_command_id_arg1           | text                  | YES  |     | NULL    |                |
| timeperiod_tp_id                  | int(11)               | YES  | MUL | NULL    |                |
| timeperiod_tp_id2                 | int(11)               | YES  | MUL | NULL    |                |
| command_command_id2               | int(11)               | YES  | MUL | NULL    |                |
| command_command_id_arg2           | text                  | YES  |     | NULL    |                |
| host_name                         | varchar(200)          | YES  | MUL | NULL    |                |
| host_alias                        | varchar(200)          | YES  | MUL | NULL    |                |
| host_address                      | varchar(255)          | YES  |     | NULL    |                |
| display_name                      | varchar(255)          | YES  |     | NULL    |                |
| host_max_check_attempts           | int(11)               | YES  |     | NULL    |                |
| host_check_interval               | int(11)               | YES  |     | NULL    |                |
| host_retry_check_interval         | int(11)               | YES  |     | NULL    |                |
| host_active_checks_enabled        | enum('0','1','2')     | YES  |     | NULL    |                |
| host_passive_checks_enabled       | enum('0','1','2')     | YES  |     | NULL    |                |
| host_checks_enabled               | enum('0','1','2')     | YES  |     | NULL    |                |
| initial_state                     | enum('o','d','u')     | YES  |     | NULL    |                |
| host_obsess_over_host             | enum('0','1','2')     | YES  |     | NULL    |                |
| host_check_freshness              | enum('0','1','2')     | YES  |     | NULL    |                |
| host_freshness_threshold          | int(11)               | YES  |     | NULL    |                |
| host_event_handler_enabled        | enum('0','1','2')     | YES  |     | NULL    |                |
| host_low_flap_threshold           | int(11)               | YES  |     | NULL    |                |
| host_high_flap_threshold          | int(11)               | YES  |     | NULL    |                |
| host_flap_detection_enabled       | enum('0','1','2')     | YES  |     | NULL    |                |
| flap_detection_options            | varchar(255)          | YES  |     | NULL    |                |
| host_process_perf_data            | enum('0','1','2')     | YES  |     | NULL    |                |
| host_retain_status_information    | enum('0','1','2')     | YES  |     | NULL    |                |
| host_retain_nonstatus_information | enum('0','1','2')     | YES  |     | NULL    |                |
| host_notification_interval        | int(11)               | YES  |     | NULL    |                |
| host_recovery_notification_delay  | int(11)               | YES  |     | NULL    |                |
| host_notification_options         | varchar(200)          | YES  |     | NULL    |                |
| host_notifications_enabled        | enum('0','1','2')     | YES  |     | NULL    |                |
| contact_additive_inheritance      | tinyint(1)            | YES  |     | 0       |                |
| cg_additive_inheritance           | tinyint(1)            | YES  |     | 0       |                |
| host_first_notification_delay     | int(11)               | YES  |     | NULL    |                |
| host_acknowledgement_timeout      | int(11)               | YES  |     | NULL    |                |
| host_stalking_options             | varchar(200)          | YES  |     | NULL    |                |
| host_snmp_community               | varchar(255)          | YES  |     | NULL    |                |
| host_snmp_version                 | varchar(255)          | YES  |     | NULL    |                |
| host_location                     | int(11)               | YES  |     | 0       |                |
| host_comment                      | text                  | YES  |     | NULL    |                |
| geo_coords                        | varchar(32)           | YES  |     | NULL    |                |
| host_locked                       | tinyint(1)            | YES  |     | 0       |                |
| host_register                     | enum('0','1','2','3') | YES  | MUL | NULL    |                |
| host_activate                     | enum('0','1','2')     | YES  |     | 1       |                |
+-----------------------------------+-----------------------+------+-----+---------+----------------+

Specially this part:

| contact_additive_inheritance      | tinyint(1)            | YES  |     | 0       |                |
| cg_additive_inheritance           | tinyint(1)            | YES  |     | 0       |                |

@itsul
Copy link

itsul commented Oct 21, 2021

@lpinsivy Sure, but it seems to be the same:

+-----------------------------------+-----------------------+------+-----+---------+----------------+
| Field                             | Type                  | Null | Key | Default | Extra          |
+-----------------------------------+-----------------------+------+-----+---------+----------------+
| host_id                           | int(11)               | NO   | PRI | NULL    | auto_increment |
| host_template_model_htm_id        | int(11)               | YES  | MUL | NULL    |                |
| command_command_id                | int(11)               | YES  | MUL | NULL    |                |
| command_command_id_arg1           | text                  | YES  |     | NULL    |                |
| timeperiod_tp_id                  | int(11)               | YES  | MUL | NULL    |                |
| timeperiod_tp_id2                 | int(11)               | YES  | MUL | NULL    |                |
| command_command_id2               | int(11)               | YES  | MUL | NULL    |                |
| command_command_id_arg2           | text                  | YES  |     | NULL    |                |
| host_name                         | varchar(200)          | YES  | MUL | NULL    |                |
| host_alias                        | varchar(200)          | YES  | MUL | NULL    |                |
| host_address                      | varchar(255)          | YES  |     | NULL    |                |
| display_name                      | varchar(255)          | YES  |     | NULL    |                |
| host_max_check_attempts           | int(11)               | YES  |     | NULL    |                |
| host_check_interval               | int(11)               | YES  |     | NULL    |                |
| host_retry_check_interval         | int(11)               | YES  |     | NULL    |                |
| host_active_checks_enabled        | enum('0','1','2')     | YES  |     | NULL    |                |
| host_passive_checks_enabled       | enum('0','1','2')     | YES  |     | NULL    |                |
| host_checks_enabled               | enum('0','1','2')     | YES  |     | NULL    |                |
| initial_state                     | enum('o','d','u')     | YES  |     | NULL    |                |
| host_obsess_over_host             | enum('0','1','2')     | YES  |     | NULL    |                |
| host_check_freshness              | enum('0','1','2')     | YES  |     | NULL    |                |
| host_freshness_threshold          | int(11)               | YES  |     | NULL    |                |
| host_event_handler_enabled        | enum('0','1','2')     | YES  |     | NULL    |                |
| host_low_flap_threshold           | int(11)               | YES  |     | NULL    |                |
| host_high_flap_threshold          | int(11)               | YES  |     | NULL    |                |
| host_flap_detection_enabled       | enum('0','1','2')     | YES  |     | NULL    |                |
| flap_detection_options            | varchar(255)          | YES  |     | NULL    |                |
| host_process_perf_data            | enum('0','1','2')     | YES  |     | NULL    |                |
| host_retain_status_information    | enum('0','1','2')     | YES  |     | NULL    |                |
| host_retain_nonstatus_information | enum('0','1','2')     | YES  |     | NULL    |                |
| host_notification_interval        | int(11)               | YES  |     | NULL    |                |
| host_recovery_notification_delay  | int(11)               | YES  |     | NULL    |                |
| host_notification_options         | varchar(200)          | YES  |     | NULL    |                |
| host_notifications_enabled        | enum('0','1','2')     | YES  |     | NULL    |                |
| contact_additive_inheritance      | tinyint(1)            | YES  |     | 0       |                |
| cg_additive_inheritance           | tinyint(1)            | YES  |     | 0       |                |
| host_first_notification_delay     | int(11)               | YES  |     | NULL    |                |
| host_acknowledgement_timeout      | int(11)               | YES  |     | NULL    |                |
| host_stalking_options             | varchar(200)          | YES  |     | NULL    |                |
| host_snmp_community               | varchar(255)          | YES  |     | NULL    |                |
| host_snmp_version                 | varchar(255)          | YES  |     | NULL    |                |
| host_location                     | int(11)               | YES  |     | 0       |                |
| host_comment                      | text                  | YES  |     | NULL    |                |
| geo_coords                        | varchar(32)           | YES  |     | NULL    |                |
| host_locked                       | tinyint(1)            | YES  |     | 0       |                |
| host_register                     | enum('0','1','2','3') | YES  | MUL | NULL    |                |
| host_activate                     | enum('0','1','2')     | YES  |     | 1       |                |
+-----------------------------------+-----------------------+------+-----+---------+----------------+

I can also say, that the SQL-Query is invalid, the Schema seems to be correct.
While checking the Source-Code i've found that the field name, which is invalid in the SQL-Query, is used from the POST Request variables. It looks to me like the name is cut for some reason and therefore the wrong field is tried to update.

It seems, that the first char of the fieldname is cut "ontact_additive_inheritance" / "g_additive_inheritance"

@rmorandell-pgum
Copy link
Author

Yes confirm ...

i fixed it in the mean time (just a quick fix) for me changing the ltrim function with a substring in the sanitizeFormHostParameters of
www/include/configuration/configObject/host/DB-Func.php class.

the ltrim just cuts of the "mc_c" and not only the "mc_".

https://stackoverflow.com/questions/23089101/php-rtrim-and-ltrim-are-trimming-more-than-supposed-to

case 'mc_cg_additive_inheritance':
$bindParams[':' . substr($inputName, 3)] = [
\PDO::PARAM_INT => (isset($ret[$inputName]) ? 1 : 0)
];
break;

hope that helps

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants