Export to CSV returns internal error page or the page moved completely
Hello,
after upgrading RHEL8.7 from Centreon 3.4 to latest 22.10, Im unable to export CSV performance data from graphs. Once I click on the button (see picture below). I get redirected to a page; which indicates the page your tried to access has being iternal error occurered or the web page has moved to the new web page completely - same thing happens if I export CSV directly from performances page. Oddly exporting timeline and graph pictures works fine.
Page 1 / 1
Hi @kazunori shirafuji, do you have latest version of Centreon web 22.10.11?
Which error do you have in /var/log/php-fpm/centreon-error.log?
HI, Laurent
Thank you for your quick reply, I am very appreciated to your response.
So, we have obtainned the log using the specific command, below to extract the result of error log that is stored in the specific path which you metioned.
/29-Aug-2023 17:48:04 Asia/Tokyo] CRITICAL: SQLSTATEL42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Interval FROM `centreon_storage`.data_bin WHERE ctime >= 1693288082 AND ctim...' at line 1 {"context":"tobject] (PDOException(code: 42000): SQLSTATEQ42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Interval FROM `centreon_storage`.data_bin WHERE ctime >= 1693288082 AND ctim...' at line 1 at /usr/share/centreon/src/Core/Infrastructure/RealTime/Repository/DataBin/DbReadPerformanceDataRepository.php:63)"}
By seeing the result of the error log, it seems to be the mismatch in corresponding to Centeron service with MariaDB server internally for outputting the CSV, especially, When the system to look for MariaDB to correspond for out putting the CSV. because of the error log, menntioned above.
So We need kindly to have your acknowledgement.
Hi @kazunori shirafuji can you give me the SQL request in error from /var/log/centreon/sql-error.log when you try to export graph?
HI, Laurent
Thank you for your quick reply as well. I also attached the evidence as the screen capture when I tried to export the CSV file from Centeron, at the same time, tried to extract the error logs from those Paths which you mentioned before.
Then, The first error log stored in /var/log/php-fpm/centreon-error.log was able to obtained the log when I tried to export the graph.
But the second error log stored in /var/log/centreon/sql-error.log was not seen any error logs when I tried to export the graph.
So, Is that possible to have your next action to solve this issue.
Best Regards,
Can you try to edit /usr/share/centreon/centreon/src/Core/Infrastructure/RealTime/Repository/DataBin/DbReadPerformanceDataRepository.php file and on line 88 change:
$subQueryPattern = 'AVG(CASE WHEN id_metric = %d THEN `value` end) AS "%s"';
by:
$subQueryPattern = 'AVG(CASE WHEN id_metric = %d THEN `value` end) AS `%s`';
HI, Laurent
Thank you for your quick reply as well.
I have found out the similar file as using your suggestion for searching the file of which is below filepath as indicated. Also, I have attached the Screen capture as the piece of tip point out the target that is red colored encircle in it. In the file, itself I also foud out the entity that is contained the object as the target:%s' to '%s' which is needed to edit as you suggested.
Entity $subQueryPattern = 'AVG(CASE WHEN id_metric = %d THEN `value` end) AS %s';
So, After edit this contain then I guess that reloading the PHP service itself. Is that process to reload the PHP service is needed?
Best Regards,
Hi,
No php-fpm reload need to be performed, just modify the file.
Hi,
Thank you very much for the quick response as usual.
We have obtained the expected result recieving as the capture displays. Therefore, this problem has fixed, I am so appreciated on this matter until it is fixed.