Open Tangeek42 opened 4 years ago
The error occurs when importing 'setmacro' from service and host (Template).
Me too
in my case this line is the source of the error : HTPL;setmacro;Dlink_Switch;options;;;''
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 }' \
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
BUG REPORT INFORMATION
Prerequisites
Versions
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 column
centreon.
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. :)