Skip to main content

Hi, 

Recently the time to display the Timeline of a host/service is it very long (more than 30secondes). 

Version Centreon : Centreon version 24.04.7

Version DB :  mysql  Ver 15.1 Distrib 10.11.8-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper

Example : 

Others tabs works well (Details/Graph/Notifications).

Any ideas ? 

thx 

 

Hi @long the time to display timeline depends of how many logs do you have in database.

Can you check in “Administration  >  Parameters  >  Options” menu the value for “Retention duration for logs” field?

How many entries do you have in db:

MariaDB scentreon_storage]> SELECT max(log_id) FROM log_archive_host;
+-------------+
| max(log_id) |
+-------------+
| 883 |
+-------------+
1 row in set (0.001 sec)

MariaDB bcentreon_storage]> SELECT max(log_id) FROM log_archive_service;
+-------------+
| max(log_id) |
+-------------+
| 9893 |
+-------------+

 


Thx @Laurent for your answer. 

Retentions durations : 

Entries : 

 


Can you check slow queries on your database and get SQL request to analyze it and maybe add indexes (take care this will consume a lot of disk space).


@Laurent

I activated slow queries, logs : 

MariaDB (none)]> EXPLAIN SELECT SQL_CALC_FOUND_ROWS
    ->                 1 AS REALTIME,
    ->                 log.id,
            ->                 log.type,
    ->                 log.date,
    ->                 log.start_date,
                log.contact_id,
                log.contact_name,
                log.status_code,
                log.statu    ->                 log.end_date,
    ->                 log.content,
    ->                 log.contact_id,
    ->                 log.contact_name,
    ->                 log.status_code,
    ->                 log.status_name,
    ->                 log.status_severity_code,
    ->                 log.tries
    ->             FROM (
    ->         SELECT
    ->             l.log_id AS `id`,
    ->             'event' AS `type`,
    ->             l.ctime AS `date`,
    ->             NULL AS `start_date`,
    ->             NULL AS `end_date`,
    ->             l.output AS `content`,
    ->             NULL AS `contact_id`,
    ->             NULL AS `contact_name`,
    ->             l.status AS `status_code`,
    ->             CASE
    ->                 WHEN l.status = 0 THEN 'OK'
    ->                 WHEN l.status = 1 THEN 'WARNING'
            ->                 WHEN l.status = 2 THEN 'CRITICAL'
    ->                 WHEN l.status = 3 THEN 'UNKNOWN'
    ->                 WHEN l.status = 4 THEN 'PENDING'
    ->             END AS `status_name`,
    ->             CASE
    ->                 WHEN l.status = 0 THEN 5
    ->                 WHEN l.status = 1 THEN 2
    ->                 WHEN l.status = 2 THEN 1
    ->                 WHEN l.status = 3 THEN 3
    ->                 WHEN l.status = 4 THEN 4
    ->             END AS `status_severity_code`,
    ->             l.retry AS `tries`
    ->             FROM `centreon_storage`.`logs` l
    ->             WHERE l.host_id = 1002
    ->             AND (l.service_id = 6267)
    ->             AND l.msg_type IN (0,1,8,9)
    ->             AND l.output NOT LIKE 'INITIAL % STATE:%'
    ->             AND l.instance_name != ''
    ->         UNION ALL SELECT
    ->             l.log_id AS `id`,
ype`,
     ->             'notification' AS `type`,
    ->             l.ctime AS `date`,
    ->             NULL AS `start_date`,
            ->             NULL AS `end_date`,
    ->             l.output AS `content`,
    ->             c.contact_id AS `contact_id`,
    ->             c.contact_alias AS `contact_name`,
    ->             l.status AS `status_code`,
 THEN    ->             CASE
    ->                 WHEN l.status = 0 THEN 'OK'
    ->                 WHEN l.status = 1 THEN 'WARNING'
    ->                 WHEN l.status = 2 THEN 'CRITICAL'
    ->                 WHEN l.status = 3 THEN 'UNKNOWN'
 'PEN    ->                 WHEN l.status = 4 THEN 'PENDING'
    ->             END AS `status_name`,
    ->             CASE
    ->                 WHEN l.status = 0 THEN 5
    ->                 WHEN l.status = 1 THEN 2
    ->                 WHEN l.status = 2 THEN 1
    ->                 WHEN l.status = 3 THEN 3
    ->                 WHEN l.status = 4 THEN 4
`
         ->             END AS `status_severity_code`,
    ->             NULL AS `tries`
    ->             FROM `centreon_storage`.`logs` l
    ->             LEFT JOIN `centreon`.contact AS `c` ON c.contact_name = l.notification_contact
    ->             WHERE l.host_id = 1002
    ->             AND (l.service_id = 6267)
    ->             AND l.msg_type IN (2,3)
    ->         UNION ALL SELECT
    ->             d.downtime_id AS `id`,
    ->             'downtime' AS `type`,
    ->             d.actual_start_time AS `date`,
actual_e    ->             d.actual_start_time AS `start_date`,
    ->             d.actual_end_time AS `end_date`,
    ->             d.comment_data AS `content`,
    ->     d.a            c.contact_id AS `contact_id`,
    ->             d.author AS `contact_name`,
    ->             NULL AS `status_code`,
    ->             NULL AS `status_name`,
    ->             NULL AS `status_severity_code`,
    ->             NULL AS `tries`
    ->             FROM `centreon_storage`.`downtimes` d
    ->             LEFT JOIN `centreon`.contact AS `c` ON c.contact_alias = d.author
    ->             WHERE d.host_id = 1002
    ->             AND (d.service_id = 6267)
    ->             AND d.actual_start_time < 1728563706
    ->         UNION ALL SELECT
    ->             a.acknowledgement_id AS `id`,
    ->             'acknowledgement' AS `type`,
    ->             a.entry_time AS `date`,
    ->                     NULL AS `start_date`,
    ->             NULL AS `end_date`,
    ->             a.comment_data AS `content`,
    ->             c.contact_id AS `contact_id`,
    ->             a.author AS `contact_name`,
    ->             NULL AS `status_code`,
    ->             NULL AS `status_name`,
AS `t    ->             NULL AS `status_severity_code`,
    ->             NULL AS `tries`
   FRO    ->             FROM `centreon_storage`.`acknowledgements` a
    ->             LEFT JOIN `centreon`.contact AS `c` ON c.contact_alias = a.author
    ->             WHERE a.host_id = 1002
    ->             AND (a.service_id = 6267)
    ->         UNION ALL SELECT
    ->             c.comment_id AS `id`,
    ->             'comment' AS `type`,
    ->             c.entry_time AS `date`,
    ->             NULL AS `start_date`,
    ->             NULL AS `end_date`,
    ->             c.data AS `content`,
    ->             ct.contact_id AS `contact_id`,
    ->             c.author AS `contact_name`,
    ->             NULL AS `status_code`,
    ->             NULL AS `status_name`,
    ->             NULL AS `status_severity_code`,
            ->             NULL AS `tries`
    ->             FROM `centreon_storage`.`comments` c
    ->             LEFT JOIN `centreon`.contact AS `ct` ON ct.contact_alias = c.author
    ->             WHERE c.host_id = 1002
    ->             AND (c.service_id = 6267)
    ->             AND source = 1 AND c.deletion_time IS NULL
    ->         ) AS `log`  WHERE (log.type IN ('event','notification','comment','acknowledgement','downtime') AND (log.date > 1728477305 OR log.date < 1728563705)) AND EXISTS (SELECT host_id FROM `centreon_storage`.`centreon_acl` acl WHERE acl.host_id = 1002 AND acl.service_id = 6267 AND acl.group_id IN (2))  ORDER BY log.date DESC LIMIT 0, 30;

After used EXLAIN SQL command :

Can you help me with the indexing tasks?

Do you need more informations ? 

Thx


When I choice “Last day” or “Last 7 days” or “Last 31 days” the all timeline is displaying (that’s why is so long?)

Requests don't seem to work properly but when I select Graph tab all buttons work.

 


Reply