centreon / centreon-archived

Centreon is a network, system and application monitoring tool. Centreon is the only AIOps Platform Providing Holistic Visibility to Complex IT Workflows from Cloud to Edge.
https://www.centreon.com
GNU General Public License v2.0
574 stars 240 forks source link

19.04 - Custom view lost settings after upgrade #7875

Open mathieuchateau opened 5 years ago

mathieuchateau commented 5 years ago

Versions

[root@XXXXX centreon]# rpm -qa | grep centreon
centreon-engine-daemon-19.04.1-9.el7.centos.x86_64
centreon-connector-ssh-19.04.0-2.el7.centos.x86_64
centreon-plugin-Hardware-Ups-Standard-Rfc1628-Snmp-20190704-123459.el7.centos.noarch
centreon-database-19.04.4-6.el7.centos.noarch
centreon-widget-service-monitoring-19.04.2-1.el7.centos.noarch
centreon-plugin-Applications-Protocol-Ldap-20190704-123459.el7.centos.noarch
centreon-broker-19.04.0-2.el7.centos.x86_64
centreon-engine-19.04.1-9.el7.centos.x86_64
centreon-license-manager-common-19.04.0-1.el7.centos.noarch
centreon-pp-manager-19.04.0-3.el7.centos.noarch
centreon-plugin-Applications-Monitoring-Centreon-Poller-20190704-123459.el7.centos.noarch
centreon-widget-grid-map-19.04.0-5.el7.centos.noarch
centreon-broker-storage-19.04.0-2.el7.centos.x86_64
centreon-broker-cbmod-19.04.0-2.el7.centos.x86_64
centreon-connector-19.04.0-2.el7.centos.x86_64
centreon-auto-discovery-server-19.04.0-4.el7.centos.x86_64
centreon-widget-live-top10-cpu-usage-19.04.0-5.el7.centos.noarch
centreon-widget-hostgroup-monitoring-19.04.0-5.el7.centos.noarch
centreon-widget-engine-status-19.04.0-5.el7.centos.noarch
centreon-plugin-Applications-Monitoring-Centreon-Database-20190704-123459.el7.centos.noarch
centreon-nrpe3-plugin-3.2.1-7.el7.centos.x86_64
centreon-plugin-Applications-Protocol-Ftp-20190704-123459.el7.centos.noarch
centreon-plugin-Operatingsystems-Linux-Snmp-20190704-123459.el7.centos.noarch
centreon-plugin-Applications-Monitoring-Centreon-Map4-Jmx-20190704-123459.el7.centos.noarch
centreon-common-19.04.4-6.el7.centos.noarch
centreon-broker-core-19.04.0-2.el7.centos.x86_64
centreon-trap-19.04.4-6.el7.centos.noarch
centreon-broker-cbd-19.04.0-2.el7.centos.x86_64
centreon-poller-centreon-engine-19.04.4-6.el7.centos.noarch
centreon-web-19.04.4-6.el7.centos.noarch
centreon-base-config-centreon-engine-19.04.4-6.el7.centos.noarch
centreon-widget-tactical-overview-19.04.0-7.el7.centos.noarch
centreon-widget-graph-monitoring-19.04.0-5.el7.centos.noarch
centreon-widget-servicegroup-monitoring-19.04.0-7.el7.centos.noarch
centreon-plugins-base-1.18-2.el7.centos.noarch
centreon-nrpe3-daemon-3.2.1-7.el7.centos.x86_64
centreon-plugin-Hardware-Printers-Generic-Snmp-20190704-123459.el7.centos.noarch
centreon-plugin-Applications-Protocol-Dns-20190704-123459.el7.centos.noarch
centreon-plugin-Applications-Protocol-Http-20190704-123459.el7.centos.noarch
centreon-clib-19.04.0-1.el7.centos.x86_64
centreon-engine-extcommands-19.04.1-9.el7.centos.x86_64
centreon-plugin-Operatingsystems-Windows-Snmp-20190704-123459.el7.centos.noarch
centreon-license-manager-19.04.0-1.el7.centos.noarch
centreon-widget-host-monitoring-19.04.1-1.el7.centos.noarch
centreon-plugin-Applications-Databases-Mysql-20190704-123459.el7.centos.noarch
centreon-release-19.04-1.el7.centos.noarch
centreon-perl-libs-19.04.4-6.el7.centos.noarch
centreon-connector-perl-19.04.0-2.el7.centos.x86_64
centreon-plugin-Network-Cisco-Standard-Snmp-20190704-123459.el7.centos.noarch
centreon-19.04.4-6.el7.centos.noarch
centreon-plugin-Applications-Monitoring-Centreon-Central-20190704-123459.el7.centos.noarch
centreon-widget-live-top10-memory-usage-19.04.0-5.el7.centos.noarch

Operating System

CentOS

Browser used

Version: 77.0.3865.90

Additional environment details (AWS, VirtualBox, physical, etc.): Virtual Machine on Premise

Description

Since we upgraded from 2.8 to 19.04, we have impacts on custom views:

image

Steps to Reproduce

Please describe precisely the steps to reproduce the encountered issue.

  1. Create views with centreon 2.8.x, and share it with users
  2. Upgrade to 19.04 using yum repo from Centreon

Describe the received result

Graphs setting are lost on views, share status too. Try to set again Title, # column, public status, share with users. Not working

Describe the expected result

Views settings kept over upgrade.

Logs

PHP error logs


[25-Sep-2019 11:46:54 Europe/Paris] PHP Fatal error:  Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`centreon`
.`custom_view_default`, CONSTRAINT `fk_custom_view_default_cv_id` FOREIGN KEY (`custom_view_id`) REFERENCES `custom_views` (`custom_view_id`) ON DELETE CASCADE) in /usr/share/centreon/www/class/centreonDBSta
tement.class.php:111
Stack trace:
#0 /usr/share/centreon/www/class/centreonCustomView.class.php(243): CentreonDBStatement->execute()
#1 /usr/share/centreon/www/include/home/customViews/action.php(115): CentreonCustomView->setDefault('')
#2 {main}
  thrown in /usr/share/centreon/www/class/centreonDBStatement.class.php on line 111
[25-Sep-2019 11:49:41 Europe/Paris] PHP Notice:  Undefined variable: columnClass in /usr/share/centreon/www/include/home/customViews/views.php on line 114
[25-Sep-2019 11:49:41 Europe/Paris] PHP Notice:  Undefined variable: viewId in /usr/share/centreon/www/include/home/customViews/views.php on line 115
[25-Sep-2019 11:49:41 Europe/Paris] PHP Notice:  Undefined variable: permission in /usr/share/centreon/www/include/home/customViews/views.php on line 116
[25-Sep-2019 11:49:41 Europe/Paris] PHP Notice:  Undefined variable: ownership in /usr/share/centreon/www/include/home/customViews/views.php on line 117
[25-Sep-2019 11:49:41 Europe/Paris] PHP Notice:  Undefined variable: centreon in /usr/share/centreon/www/include/home/customViews/views.php on line 118
[25-Sep-2019 11:49:41 Europe/Paris] PHP Notice:  Trying to get property of non-object in /usr/share/centreon/www/include/home/customViews/views.php on line 118
[25-Sep-2019 11:49:41 Europe/Paris] PHP Notice:  Trying to get property of non-object in /usr/share/centreon/www/include/home/customViews/views.php on line 118
[25-Sep-2019 11:49:41 Europe/Paris] PHP Notice:  Undefined variable: widgets in /usr/share/centreon/www/include/home/customViews/views.php on line 182
[25-Sep-2019 11:49:41 Europe/Paris] PHP Warning:  Invalid argument supplied for foreach() in /usr/share/centreon/www/include/home/customViews/views.php on line 182
[25-Sep-2019 11:50:29 Europe/Paris] PHP Notice:  Undefined index: custom_view_id in /usr/share/centreon/www/class/centreonCustomView.class.php on line 708
[25-Sep-2019 11:52:28 Europe/Paris] PHP Notice:  Element 'contact_passwd' does not exist in /usr/share/centreon/www/lib/HTML/QuickForm/HTML_QuickFormCustom.php on line 168

### Additional relevant information (e.g. frequency, ...)
itsul commented 5 years ago

The problem is not only known in 19.04.

We have it on different customer installations after upgrading to Centreon 2.8.29 from 2.8.28.

sc979 commented 5 years ago

Hi @mathieuchateau and @itsul , We're going to try to investigate and reproduce you issue. But we may need more data. Could you send us the result of this query : SHOW CREATE TABLE custom_view_default;

And @mathieuchateau -> Please could you send us the /var/log/centreon/sql-error.log file from last september, 25th ? (should be a compressed file and named like "sql-error.log-201909xx.gz")

Best Regards, sc979

mathieuchateau commented 5 years ago

@sc979 MariaDB [centreon]> SHOW CREATE TABLE custom_view_default; +---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | custom_view_default | CREATE TABLEcustom_view_default( user_idint(11) NOT NULL, custom_view_idint(11) NOT NULL, KEYfk_custom_view_default_user_id(user_id), KEYfk_custom_view_default_cv_id(custom_view_id), CONSTRAINTfk_custom_view_default_cv_idFOREIGN KEY (custom_view_id) REFERENCEScustom_views(custom_view_id) ON DELETE CASCADE, CONSTRAINTfk_custom_view_default_user_idFOREIGN KEY (user_id) REFERENCEScontact(contact_id) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 | +---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)

mathieuchateau commented 5 years ago

@sc979 All errors in september (gathered all sql errors content from september)

`2019-09-09 15:23|0|0|DB Error: constraint violation QUERY : UPDATE extended_host_information SET ehi_icon_image = 'REP_1', ehi_vrml_image = 'REP_1' WHERE host_host_id = '630'

2019-09-09 15:23|0|0|DB Error: constraint violation QUERY : UPDATE extended_host_information SET ehi_icon_image = 'REP_1', ehi_vrml_image = 'REP_1' WHERE host_host_id = '631'

2019-09-19 12:23|0|0| QUERY : SELECT auth.ar_id, auth.ar_sync_base_date, info.ari_value AS interval FROM auth_ressource auth INNER JOIN auth_ressource_info info ON auth.ar_id = info.ar_id WHERE auth.ar_enable = '1' AND info.ari_name = 'ldap_sync_interval'

2019-09-19 14:25|0|0| QUERY : SELECT auth.ar_id, auth.ar_sync_base_date, info.ari_value AS interval FROM auth_ressource auth INNER JOIN auth_ressource_info info ON auth.ar_id = info.ar_id WHERE auth.ar_enable = '1' AND info.ari_name = 'ldap_sync_interval'

2019-09-20 12:34|0|0| QUERY : SELECT s.state, h.name, s.description, s.last_check, s.next_check, s.last_state_change, s.last_notification, s.last_hard_state_change, s.last_hard_state, s.latency, s.last_time_ok, s.last_time_critical, s.last_time_unknown, s.last_time_warning, s.notification_number, s.scheduled_downtime_depth, s.output, s.notes, ROUND(s.percent_state_change) as percent_state_change, s.notify, s.perfdata, s.state_type, s.execution_time, s.event_handler_enabled, s.icon_image, s.display_name FROM hosts h, services s WHERE s.host_id = h.host_id AND s.host_id = 56 AND service_id = LIMIT 1

2019-09-20 12:34|0|0| QUERY : SELECT s.state, h.name, s.description, s.last_check, s.next_check, s.last_state_change, s.last_notification, s.last_hard_state_change, s.last_hard_state, s.latency, s.last_time_ok, s.last_time_critical, s.last_time_unknown, s.last_time_warning, s.notification_number, s.scheduled_downtime_depth, s.output, s.notes, ROUND(s.percent_state_change) as percent_state_change, s.notify, s.perfdata, s.state_type, s.execution_time, s.event_handler_enabled, s.icon_image, s.display_name FROM hosts h, services s WHERE s.host_id = h.host_id AND s.host_id = 66 AND service_id = LIMIT 1 `

sc979 commented 5 years ago

@mathieuchateau, Thanks for these information, this may help. Your "custom_view_default" table is properly set. Let us some time to investigate and try to reproduce it Best Regards, sc979

itsul commented 5 years ago

Hello together,

Attached you'll receive the query output of three different systems (2.8.27, 2.8.29 and 19.04). The 2.8.29/19.04 systems are the "faulty" ones. Actually they are all the same:

19.04

+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| Table | Create Table |

+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| custom_view_default | CREATE TABLE custom_view_default (

user_id int(11) NOT NULL,

custom_view_id int(11) NOT NULL,

KEY fk_custom_view_default_user_id (user_id),

KEY fk_custom_view_default_cv_id (custom_view_id),

CONSTRAINT fk_custom_view_default_cv_id FOREIGN KEY (custom_view_id) REFERENCES custom_views (custom_view_id) ON DELETE CASCADE,

CONSTRAINT fk_custom_view_default_user_id FOREIGN KEY (user_id) REFERENCES contact (contact_id) ON DELETE CASCADE

) ENGINE=InnoDB DEFAULT CHARSET=utf8 |

+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

2.8.29

+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| Table | Create Table |

+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| custom_view_default | CREATE TABLE custom_view_default (

user_id int(11) NOT NULL,

custom_view_id int(11) NOT NULL,

KEY fk_custom_view_default_user_id (user_id),

KEY fk_custom_view_default_cv_id (custom_view_id),

CONSTRAINT fk_custom_view_default_cv_id FOREIGN KEY (custom_view_id) REFERENCES custom_views (custom_view_id) ON DELETE CASCADE,

CONSTRAINT fk_custom_view_default_user_id FOREIGN KEY (user_id) REFERENCES contact (contact_id) ON DELETE CASCADE

) ENGINE=InnoDB DEFAULT CHARSET=utf8 |

+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

2.8.27

+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| Table | Create Table

+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| custom_view_default | CREATE TABLE custom_view_default (

user_id int(11) NOT NULL,

custom_view_id int(11) NOT NULL,

KEY fk_custom_view_default_user_id (user_id),

KEY fk_custom_view_default_cv_id (custom_view_id),

CONSTRAINT fk_custom_view_default_cv_id FOREIGN KEY (custom_view_id) REFERENCES custom_views (custom_view_id) ON DELETE CASCADE,

CONSTRAINT fk_custom_view_default_user_id FOREIGN KEY (user_id) REFERENCES contact (contact_id) ON DELETE CASCADE

) ENGINE=InnoDB DEFAULT CHARSET=utf8 |

+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Greetings,

TM

loiclau commented 5 years ago

Hi,

Do you have js error when you go on the custom views page? Have you all edit information for the different views when you go on : /centreon/api/internal.php?object=centreon_home_customview&action=listViews

Regards

itsul commented 5 years ago

Hi,

there are no js errors when I go to the custom view page.

On Centreon 19.04 I opened the link and got this: { "current": 15, "tabs": [ { "default": false, "name": "TestTest", "custom_view_id": "15", "public": "0", "nbCols": "column_1" } ] } which seems fine.

Regards

mathieuchateau commented 5 years ago

Me too, calling this web page looks all fine, got a json, but no Current:15 like @itsul Starting directly with: {"current":4,"tabs":[{"default":false,"name

loiclau commented 5 years ago

Hi, have you test to clean the browser cache or in private navigation? Regards

mathieuchateau commented 5 years ago

@loiclau As the creator of views, I was not impacted. Others, who are impacted, tried other browser and in private

garnier-quentin commented 5 years ago

It should work if you save the settings (it's a workaround)

mathieuchateau commented 5 years ago

@garnier-quentin I tried doing changes on view, but issues stays

loiclau commented 5 years ago

The creator is admin ? The shared user is admin ? The view is public ? The view is locked ? How many views are display on the page ?

itsul commented 5 years ago

The creator and the shared user are admins. The view is shared as "unlocked users". If I share it as "locked users" the content of the widget is behaving normal. So it seems to be a problem with "unlocked users". I have only one view in my test environment. But the issue is more about the settings of the widget in the view.

kozfelipe commented 4 years ago

Hey I had the same issue when I upgraded from 19.04.02 to 19.04.10

CREATE TABLE `custom_view_default` (
   `user_id` int(11) NOT NULL,
   `custom_view_id` int(11) NOT NULL,
   KEY `fk_custom_view_default_user_id` (`user_id`),
   KEY `fk_custom_view_default_cv_id` (`custom_view_id`),
   CONSTRAINT `fk_custom_view_default_cv_id` FOREIGN KEY (`custom_view_id`) REFERENCES 
  `custom_views` (`custom_view_id`) ON DELETE CASCADE,
   CONSTRAINT `fk_custom_view_default_user_id` FOREIGN KEY (`user_id`) REFERENCES `contact` (`contact_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8

Users created after upgrade have a messy shared view. As previous comment, is like widget settings get lost

I got this javascript error for messy views:

Mixed Content: The page at 'https://****************/centreon/main.php?p=103' was loaded over HTTPS, but requested an insecure frame 'http://www.centreon.com/'. This request has been blocked; the content must be served over HTTPS.

itsul commented 4 years ago

@kozfelipe Unfortunately the current behaviour has changed by design from centreon. We opened an issue/call as a centreon partner and got this official answer. The "solution" to get the old behaviour back, is to restore the "www/class/centreonWidget.class.php" file from 2019-12-02 (pull request 7641 - 2.8.x branch can be something else in 18.x or 19.x) or earlier...

We have not tested the new design in detail, if it is possible to archieve an similar "sharing of views" like the old function.

kozfelipe commented 4 years ago

Got it @itsul thank you