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
576 stars 240 forks source link

Centreon from and to 20.04 import gives a "Invalid datetime format" #8727

Open Tangeek42 opened 4 years ago

Tangeek42 commented 4 years ago

BUG REPORT INFORMATION

Prerequisites

Versions

centreon-widget-hostgroup-monitoring-20.04.0-5.el7.centos.noarch
centreon-release-20.04-1.el7.centos.noarch
centreon-license-manager-20.04.1-1.el7.centos.noarch
centreon-web-20.04.0-7.el7.centos.noarch
centreon-widget-host-monitoring-20.04.0-5.el7.centos.noarch
centreon-base-config-centreon-engine-20.04.0-7.el7.centos.noarch
centreon-connector-ssh-20.04.0-2.el7.centos.x86_64
centreon-gorgone-20.04.2-1.el7.centos.noarch
centreon-common-20.04.0-7.el7.centos.noarch
centreon-engine-20.04.1-1.el7.centos.x86_64
centreon-plugin-Hardware-Ups-Standard-Rfc1628-Snmp-20200410-101650.el7.centos.noarch
centreon-broker-20.04.2-1.el7.centos.x86_64
centreon-widget-servicegroup-monitoring-20.04.0-5.el7.centos.noarch
centreon-widget-grid-map-20.04.0-5.el7.centos.noarch
centreon-widget-live-top10-cpu-usage-20.04.0-5.el7.centos.noarch
centreon-plugin-Applications-Monitoring-Centreon-Poller-20200410-101650.el7.centos.noarch
centreon-plugin-Applications-Monitoring-Centreon-Map4-Jmx-20200410-101650.el7.centos.noarch
centreon-connector-20.04.0-2.el7.centos.x86_64
centreon-plugin-Applications-Databases-Mysql-20200410-101650.el7.centos.noarch
centreon-license-manager-common-20.04.1-1.el7.centos.noarch
centreon-engine-daemon-20.04.1-1.el7.centos.x86_64
centreon-plugin-Applications-Protocol-Dns-20200410-101650.el7.centos.noarch
centreon-engine-extcommands-20.04.1-1.el7.centos.x86_64
centreon-database-20.04.0-7.el7.centos.noarch
centreon-trap-20.04.0-7.el7.centos.noarch
centreon-plugin-Operatingsystems-Linux-Snmp-20200410-101650.el7.centos.noarch
centreon-broker-cbd-20.04.2-1.el7.centos.x86_64
centreon-widget-live-top10-memory-usage-20.04.0-5.el7.centos.noarch
centreon-widget-tactical-overview-20.04.0-5.el7.centos.noarch
centreon-widget-global-health-20.04.0-5.el7.centos.noarch
centreon-plugin-Applications-Monitoring-Centreon-Central-20200410-101650.el7.centos.noarch
centreon-poller-centreon-engine-20.04.0-7.el7.centos.noarch
centreon-plugin-Applications-Monitoring-Centreon-Database-20200410-101650.el7.centos.noarch
centreon-pp-manager-20.04.1-1.el7.centos.noarch
centreon-perl-libs-20.04.0-7.el7.centos.noarch
centreon-plugin-Operatingsystems-Windows-Snmp-20200410-101650.el7.centos.noarch
centreon-broker-core-20.04.2-1.el7.centos.x86_64
centreon-widget-engine-status-20.04.1-1.el7.centos.noarch
centreon-widget-graph-monitoring-20.04.0-5.el7.centos.noarch
centreon-plugin-Applications-Protocol-Http-20200410-101650.el7.centos.noarch
centreon-20.04.0-7.el7.centos.noarch
centreon-clib-20.04.0-7.el7.centos.x86_64
centreon-gorgone-centreon-config-20.04.2-1.el7.centos.noarch
centreon-plugin-Network-Cisco-Standard-Snmp-20200410-101650.el7.centos.noarch
centreon-broker-storage-20.04.2-1.el7.centos.x86_64
centreon-widget-httploader-20.04.0-5.el7.centos.noarch
centreon-widget-service-monitoring-20.04.0-5.el7.centos.noarch
centreon-plugin-Applications-Protocol-Ftp-20200410-101650.el7.centos.noarch
centreon-plugin-Applications-Protocol-Ldap-20200410-101650.el7.centos.noarch
centreon-plugin-Hardware-Printers-Generic-Snmp-20200410-101650.el7.centos.noarch
centreon-connector-perl-20.04.0-2.el7.centos.x86_64
centreon-broker-cbmod-20.04.2-1.el7.centos.x86_64
centreon-auto-discovery-server-20.04.1-2.el7.centos.noarch

Operating System CentOS, installed from ISO 20.04 directly.

Browser used CLI

Version: 20.04

Description

Hello, Sorry if it's already been reported, but I didn't find anything. When trying to export and then import the config as a whole from one VM to another, both on 20.04 and installed from the ISO, I get an SQL error. From what I can tell there's a part of the import command that wasn't updated correctly but I'm not sure.

It runs correctly for about 4100 lines (there's the usual duplicates lines) but then the error copied below.

Tried updating the VM B but still the same error.

Steps to Reproduce

I exported a full config, transfered it to the other machine, and tried importing it.

Describe the received result

``PHP Fatal error: Uncaught PDOException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for columncentreon.on_demand_macro_host.is_password` at row 1 in /usr/share/centreon/www/class/centreonDB.class.php:274 Stack trace:

0 /usr/share/centreon/lib/Centreon/Object/Object.php(117): CentreonDB->query('INSERT INTO on_...', Array)

1 /usr/share/centreon/www/class/centreon-clapi/centreonHost.class.php(881): Centreon_Object->insert(Array)

2 /usr/share/centreon/www/class/centreon-clapi/centreonAPI.class.php(806): CentreonClapi\CentreonHost->setmacro('Base;pingwarnin...')

3 /usr/share/centreon/www/class/centreon-clapi/centreonAPI.class.php(769): CentreonClapi\CentreonAPI->launchActionForImport()

4 /usr/share/centreon/bin/centreon(196): CentreonClapi\CentreonAPI->import('EXPORT15MAI')

5 {main}

thrown in /usr/share/centreon/www/class/centreonDB.class.php on line 274```

Describe the expected result

Well, I guess what's expected is to have the import not failing. :D

Logs

I can't find anything in the logs related to that, but I could've missed it. Since it runs in CLI I doubt I'll find anything in the httpd logs.

I hope I'm clear and concise enough. Please ask me anything you think would be useful. :)

reawakn commented 4 years ago

The error occurs when importing 'setmacro' from service and host (Template).

sbourdette commented 4 years ago

Me too

sbourdette commented 4 years ago

in my case this line is the source of the error : HTPL;setmacro;Dlink_Switch;options;;;''

sbourdette commented 4 years ago

Workaround to fix export file:

<export cmd>  | awk 'BEGIN{FS=OFS=";"} {if ($1=="SERVICE" && $2=="setmacro") ($7 = "0") ; print $0 }' 
<export cmd> | awk 'BEGIN{FS=OFS=";"} {if ($1=="HOST" && $2=="setmacro") ($6 = "0") ; print $0 }' \
cgagnaire commented 4 years ago

Hi @Tangeek42, Thanks for opening this issue. It is now in our dev backlog, I'll update the issue when a fix will be available.

Refs MON-5562