diff options
author | martinsj <martinsj@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-02 06:33:33 +0000 |
---|---|---|
committer | martinsj <martinsj@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-02 06:33:33 +0000 |
commit | 666e0dbf5f8cf58a42855dbd33ea9eb83328d211 (patch) | |
tree | c461ae4bef0d1734610fa27d9557ad996dab726e | |
parent | d5dea01e509ef5f5aaa1bece2845c4aeb4d716ef (diff) | |
download | zabbix-666e0dbf5f8cf58a42855dbd33ea9eb83328d211.tar.gz zabbix-666e0dbf5f8cf58a42855dbd33ea9eb83328d211.tar.xz zabbix-666e0dbf5f8cf58a42855dbd33ea9eb83328d211.zip |
- added report "Most Busy Triggers Top 100" (Martins)
git-svn-id: svn://svn.zabbix.com/trunk@2791 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | frontends/php/include/config.inc.php | 5 | ||||
-rw-r--r-- | frontends/php/include/db.inc.php | 4 | ||||
-rw-r--r-- | frontends/php/include/locales/en_gb.inc.php | 15 | ||||
-rw-r--r-- | frontends/php/report5.php | 121 |
5 files changed, 138 insertions, 8 deletions
@@ -1,5 +1,6 @@ Changes for 1.1beta10: + - added report "Most Busy Triggers Top 100" (Martins) - improved graphs, added 'Working time' displaying (Eugene) - added 'Working time' configuration (Eugene) - added support of history of actions and events for screens (Martins) diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index 182e20ad..d4b1d540 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -1205,11 +1205,12 @@ COpt::profiling_start("page"); ), "reports"=>array( "label"=>S_REPORTS, - "pages"=>array("report1.php","report2.php","report4.php"), + "pages"=>array("report1.php","report2.php","report4.php","report5.php"), "level2"=>array( array("label"=>S_STATUS_OF_ZABBIX,"url"=>"report1.php"), array("label"=>S_AVAILABILITY_REPORT,"url"=>"report2.php"), - array("label"=>S_NOTIFICATIONS,"url"=>"report4.php") + array("label"=>S_NOTIFICATIONS,"url"=>"report4.php"), + array("label"=>S_TRIGGERS_TOP_100,"url"=>"report5.php"), ) ), "configuration"=>array( diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index f300906b..d1c1cf42 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -28,8 +28,8 @@ // $DB_DATABASE ="zabbix"; // $DB_DATABASE ="osmiy"; // $DB_DATABASE ="zabbix"; - $DB_DATABASE ="osmiy"; -// $DB_DATABASE ="demo"; +// $DB_DATABASE ="osmiy"; + $DB_DATABASE ="demo"; // $DB_DATABASE ="martinsj"; $DB_USER ="root"; $DB_PASSWORD =""; diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php index 0e12bc89..5803eb90 100644 --- a/frontends/php/include/locales/en_gb.inc.php +++ b/frontends/php/include/locales/en_gb.inc.php @@ -668,10 +668,17 @@ "S_YEARLY"=> "Yearly", // report4.php - "S_NOTIFICATIONS"=> "Notifications", - "S_NOTIFICATIONS_BIG"=> "NOTIFICATIONS", - "S_IT_NOTIFICATIONS"=> "Notification report", - + "S_NOTIFICATIONS"=> "Notifications", + "S_NOTIFICATIONS_BIG"=> "NOTIFICATIONS", + "S_IT_NOTIFICATIONS"=> "Notification report", + +// report5.php + "S_TRIGGERS_TOP_100"=> "Most busy triggers top 100", + "S_TRIGGERS_TOP_100_BIG"=> "MOST BUSY TRIGGERS TOP 100", + "S_NUMBER_OF_STATUS_CHANGES"=> "Number of status changes", + "S_WEEK"=> "Week", + "S_LAST"=> "Last", + // screenconf.php "S_SCREENS"=> "Screens", "S_SCREEN"=> "Screen", diff --git a/frontends/php/report5.php b/frontends/php/report5.php new file mode 100644 index 00000000..7615d7ec --- /dev/null +++ b/frontends/php/report5.php @@ -0,0 +1,121 @@ +<?php +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ +?> +<?php + include "include/config.inc.php"; + $page["title"] = "S_TRIGGERS_TOP_100"; + $page["file"] = "report5.php"; + show_header($page["title"],0,0); +?> + +<?php +// if(!check_right("Host","R",0)) +// { +// show_table_header("<font color=\"AA0000\">No permissions !</font>"); +// show_page_footer(); +// exit; +// } +?> + +<?php + if(!isset($_REQUEST["period"])) + { + $_REQUEST["period"]="day"; + } + + $h1=S_TRIGGERS_TOP_100_BIG; + + $year=date("Y"); + + $h2=SPACE.S_LAST.SPACE; + $h2=$h2."<select class=\"biginput\" name=\"period\" onChange=\"submit()\">"; + $h2=$h2.form_select("period","day",S_DAY); + $h2=$h2.form_select("period","week",S_WEEK); + $h2=$h2.form_select("period","month",S_MONTH); + $h2=$h2.form_select("period","year",S_YEAR); + $h2=$h2."</select>"; + + show_header2($h1, $h2, "<form name=\"selection\" method=\"get\" action=\"report5.php\">", "</form>"); +?> + +<?php + $table = new CTableInfo(); + $table->setHeader(array(S_HOST,S_TRIGGER,S_SEVERITY,S_NUMBER_OF_STATUS_CHANGES)); + $time_now=time(); + if($_REQUEST["period"]=="day") + { + $time_dif=24*3600; + } + elseif($_REQUEST["period"]=="week") + { + $time_dif=7*24*3600; + } + elseif($_REQUEST["period"]=="month") + { + $time_dif=30*24*3600; + } + elseif($_REQUEST["period"]=="year") + { + $time_dif=365*24*3600; + } + $result=DBselect("select h.host, t.triggerid, t.description, t.priority, count(a.alarmid) + from hosts h, triggers t, functions f, items i, alarms a where + h.hostid = i.hostid and + i.itemid = f.itemid and + t.triggerid=f.triggerid and + t.triggerid=a.triggerid and + a.clock>$time_now-$time_dif + group by 1,2,3,4 + order by 5 desc,1,3 + limit 100"); + while($row=DBfetch($result)) + { + $priority_style=NULL; + if($row["priority"]==0) $priority=S_NOT_CLASSIFIED; + elseif($row["priority"]==1) $priority=S_INFORMATION; + elseif($row["priority"]==2) $priority=S_WARNING; + elseif($row["priority"]==3) + { + $priority=S_AVERAGE; + $priority_style="average"; + } + elseif($row["priority"]==4) + { + $priority=S_HIGH; + $priority_style="high"; + } + elseif($row["priority"]==5) + { + $priority=S_DISASTER; + $priority_style="disaster"; + } + else $priority=$row["priority"]; + $severity=new CSpan($priority,$priority_style); + $table->addRow(array( + $row["host"], + expand_trigger_description($row["triggerid"]), + new CCol($priority,$priority_style), + $row["count(a.alarmid)"], + )); + } + $table->show(); + + show_page_footer(); +?> |