leoncx / testmigrate

0 stars 0 forks source link

Problem with Unhandled Service problems (last 100) table #225

Open leoncx opened 9 years ago

leoncx commented 9 years ago

Author Name: Robert Szymiec (Robert Szymiec) Original Redmine Issue: 6407, https://forge.centreon.com/issues/6407 Original Date: 2015-05-25


To generate problem table we have sql query:

$rq1 = " SELECT DISTINCT h.name, s.host_id, s.service_id, s.description, s.notes, s.notes_url, s.action_url, s.state, s.last_check as last_check, s.output, s.last_state_change as last_state_change, h.address, h.icon_image, i.name as instance_name" . " FROM hosts h, instances i, services s" . " WHERE h.host_id = s.host_id " . " AND h.instance_id = i.instance_id " . " AND s.state != 0" . " AND s.state != 4" . " AND s.acknowledged = 0" . " AND s.scheduled_downtime_depth = 0" . " AND s.enabled = 1". " AND s.state_type = 1". " AND h.enabled = 1" . " AND h.name NOT LIKE 'Module%' " . " ORDER BY FIELD(s.last_state_change,2,1,3), s.last_state_change DESC, h.name LIMIT " . $svcLimit;

Schematics result of sql could be like below

UNHANDLED 1 UNHANDLED 2 DOWN .. DOWN -> this is the limit from sql Further down we have not displayed problems: UNHANDLED3 … DOWN UNHANDLED4

And so after :

            for ($i = 0; $i < $pbCount && $is_unhandled; $i++){
                    if (isset($hostPb[$i]) && ($hostPb[$i] == $ndo["host_id"]))
                            $is_unhandled = 0;
            }

We have in xml output only: UNHANDLED 1 UNHANDLED 2

Because we don’t fetch further unhandled problems from database but there is plenty of place to populate with them.

Did I find a bug ?

Of course :) i have patch for that and that is 2 lines added to sql:

            AND h.state = 0
            AND h.state_type = 1

Then we don’t need piece of filter code above.

leoncx commented 9 years ago

Original Redmine Comment Author Name: Robert Szymiec (Robert Szymiec) Original Date: 2015-05-25T12:17:37Z


Sorry posted in different project. I think it should be centreon