Ad Widget

Collapse

Patch: most busy triggers top 100

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrbig
    Junior Member
    • Aug 2006
    • 3

    #1

    Patch: most busy triggers top 100

    If a trigger consists of more than one item, then the number of status changes is falsly multiplied by the number of items in the trigger.
    For example: I have a trigger that monitors 11 virtual hosts on the same site (through 11 items), and reports if any of them is down or slow. If the trigger fires once in a day, the report will show 11, and the trigger will jump to the front.

    Here's a quick & dirty patch to solve this:

    Code:
    --- /tmp/report5.php    2006-10-11 11:09:39.000000000 +0200
    +++ report5.php 2006-10-11 11:10:11.000000000 +0200
    @@ -75,7 +75,7 @@
            {
                    $time_dif=365*24*3600;
            }
    -        $result=DBselect("select h.host, t.triggerid, t.description, t.priority, count(a.alarmid)
    +        $result=DBselect("select h.host, t.triggerid, t.description, t.priority, count(distinct a.alarmid) as alarmcount
            from hosts h, triggers t, functions f, items i, alarms a where 
            h.hostid = i.hostid and
            i.itemid = f.itemid and
    @@ -112,7 +112,7 @@
                            $row["host"],
                            expand_trigger_description($row["triggerid"]),
                            new CCol($priority,$priority_style),
    -                       $row["count(a.alarmid)"],
    +                       $row["alarmcount"],
                            ));
            }
            $table->show();
Working...