summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-02-22 15:28:41 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-02-22 15:28:41 +0000
commit9848b90bd9eddf0324ffdc0d8f089c6c24683fe8 (patch)
tree755bae71a9ecbc5d3f3c9085c0583a345c0c00d8 /frontends/php/include
parent2a35ecbf642a185e3b53f66f783272e03fe99e93 (diff)
- [DEV-118] added dashboard screen to monitoring (Artem)
- [ZBX-206] merged rev.5367:5370 of 1.4/ (Artem) [fixed case sensitive hosts sorting] - [DEV-119] changes how users online are counted (Artem) - implemented patch [added y axis calculation type: "Calculated [Min=0]"] (Artem) - changes in schema.sql (Artem) - fixed JS lib, url class (Artem) - some other small fixes (Artem) git-svn-id: svn://svn.zabbix.com/trunk@5387 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/blocks.inc.php719
-rw-r--r--frontends/php/include/classes/chart.inc.php7
-rw-r--r--frontends/php/include/classes/graph.inc.php1
-rw-r--r--frontends/php/include/config.inc.php142
-rw-r--r--frontends/php/include/defines.inc.php9
-rw-r--r--frontends/php/include/forms.inc.php4
-rw-r--r--frontends/php/include/graphs.inc.php8
-rw-r--r--frontends/php/include/html.inc.php42
-rw-r--r--frontends/php/include/items.inc.php4
-rw-r--r--frontends/php/include/locales/en_gb.inc.php13
-rw-r--r--frontends/php/include/page_header.php24
-rw-r--r--frontends/php/include/services.inc.php4
-rw-r--r--frontends/php/include/setup.inc.php4
-rw-r--r--frontends/php/include/triggers.inc.php36
14 files changed, 932 insertions, 85 deletions
diff --git a/frontends/php/include/blocks.inc.php b/frontends/php/include/blocks.inc.php
new file mode 100644
index 00000000..6272cc3b
--- /dev/null
+++ b/frontends/php/include/blocks.inc.php
@@ -0,0 +1,719 @@
+<?php
+/*
+** ZABBIX
+** Copyright (C) 2000-2008 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
+require_once "include/screens.inc.php";
+
+// Author: Aly
+function make_system_summary($available_hosts=false){
+ global $USER_DETAILS;
+
+ if(!$available_hosts){
+ $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, null, null, get_current_nodeid());
+ }
+
+ $table = new CTableInfo();
+ $table->SetHeader(array(
+ is_show_subnodes() ? S_NODE : null,
+ S_HOST_GROUPS,
+ S_DISASTER,
+ S_HIGH,
+ S_AVERAGE,
+ S_WARNING,
+ S_INFORMATION,
+ S_NOT_CLASSIFIED
+ ));
+
+ $gr_result=DBselect('SELECT DISTINCT g.groupid,g.name '.
+ ' FROM groups g, hosts_groups hg, hosts h, items i, functions f, triggers t '.
+ ' WHERE h.hostid in ('.$available_hosts.') '.
+ ' AND hg.groupid=g.groupid '.
+ ' AND h.status='.HOST_STATUS_MONITORED.
+ ' AND h.hostid=i.hostid '.
+ ' AND hg.hostid=h.hostid '.
+ ' AND i.status='.ITEM_STATUS_ACTIVE.
+ ' AND i.itemid=f.itemid '.
+ ' AND t.triggerid=f.triggerid '.
+ ' AND t.status='.TRIGGER_STATUS_ENABLED.
+ ' ORDER BY g.name');
+
+ while($group = DBFetch($gr_result)){
+ $group_row = new CRow();
+ if(is_show_subnodes())
+ $group_row->AddItem(get_node_name_by_elid($group['groupid']));
+
+ $group_row->AddItem($group['name']);
+
+ $tab_priority[TRIGGER_SEVERITY_DISASTER] = 0;
+ $tab_priority[TRIGGER_SEVERITY_HIGH] = 0;
+ $tab_priority[TRIGGER_SEVERITY_AVERAGE] = 0;
+ $tab_priority[TRIGGER_SEVERITY_WARNING] = 0;
+ $tab_priority[TRIGGER_SEVERITY_INFORMATION] = 0;
+ $tab_priority[TRIGGER_SEVERITY_NOT_CLASSIFIED] = 0;
+
+ $sql='SELECT count(DISTINCT t.triggerid) as tr_cnt,t.priority '.
+ ' FROM hosts h,items i,hosts_groups hg, functions f, triggers t '.
+ ' WHERE h.status='.HOST_STATUS_MONITORED.
+ ' AND h.hostid=i.hostid '.
+ ' AND hg.groupid='.$group['groupid'].
+ ' AND hg.hostid=h.hostid'.
+ ' AND i.status='.ITEM_STATUS_ACTIVE.
+ ' AND i.itemid=f.itemid '.
+ ' AND t.triggerid=f.triggerid '.
+ ' AND t.value='.TRIGGER_VALUE_TRUE.
+ ' AND t.status='.TRIGGER_STATUS_ENABLED.
+ ' AND h.hostid in ('.$available_hosts.') '.
+ ' GROUP BY t.priority';
+
+ $tr_result = DBSelect($sql);
+ while($group_stat = DBFetch($tr_result)){
+ $tab_priority[$group_stat['priority']] = $group_stat['tr_cnt'];
+ }
+
+ foreach($tab_priority as $key => $value){
+ $group_row->AddItem(new CCol($value,get_severity_style($key,$value)));
+ }
+ $table->AddRow($group_row);
+ }
+return $table;
+}
+
+// Author: Aly
+function make_status_of_zbx(){
+ $table = new CTableInfo();
+
+ $table->SetHeader(array(
+ S_PARAMETER,
+ S_VALUE,
+ S_DETAILS
+ ));
+
+ $status=get_status();
+
+ $table->AddRow(array(S_ZABBIX_SERVER_IS_RUNNING,new CSpan($status['zabbix_server'], ($status['zabbix_server'] == S_YES ? 'off' : 'on')),' - '));
+// $table->AddRow(array(S_VALUES_STORED,$status['history_count']));$table->AddRow(array(S_TRENDS_STORED,$status['trends_count']));
+ $table->AddRow(array(S_NUMBER_OF_HOSTS,$status['hosts_count'],
+ array(
+ new CSpan($status['hosts_count_monitored'],'off'),' / ',
+ new CSpan($status['hosts_count_not_monitored'],'on'),' / ',
+ new CSpan($status['hosts_count_template'],'unknown'),' / ',
+ $status['hosts_count_deleted']
+ )
+ ));
+ $table->AddRow(array(S_NUMBER_OF_ITEMS,$status['items_count'],
+ array(
+ new CSpan($status['items_count_monitored'],'off'),' / ',
+ new CSpan($status['items_count_disabled'],'on'),' / ',
+ new CSpan($status['items_count_not_supported'],'unknown'),
+ SPACE.SPACE.'['.$status['items_count_trapper'].']'
+ )
+ ));
+ $table->AddRow(array(S_NUMBER_OF_TRIGGERS,$status['triggers_count'],
+ array(
+ $status['triggers_count_enabled'],' / ',
+ $status['triggers_count_disabled'].SPACE.SPACE.'[',
+ new CSpan($status['triggers_count_on'],'on'),' / ',
+ new CSpan($status['triggers_count_unknown'],'unknown'),' / ',
+ new CSpan($status['triggers_count_off'],'off'),']'
+ )
+ ));
+ $table->AddRow(array(S_NUMBER_OF_EVENTS,$status['events_count'],' - '));
+ $table->AddRow(array(S_NUMBER_OF_ALERTS,$status['alerts_count'],' - '));
+
+//Log Out 10min
+ $sql = 'SELECT DISTINCT u.userid, s.lastaccess, u.autologout '.
+ ' FROM users u '.
+ ' LEFT JOIN sessions s ON s.userid=u.userid';
+
+ $db_users = DBSelect($sql);
+ $usr_cnt = 0;
+ $online_cnt = 0;
+ while($user=DBFetch($db_users)){
+ $online_time = (($user['autologout'] == 0) || (ZBX_USER_ONLINE_TIME<$user['autologout']))?ZBX_USER_ONLINE_TIME:$user['autologout'];
+ if(!is_null($user['lastaccess']) && (($user['lastaccess']+$online_time)>=time())) $online_cnt++;
+ $usr_cnt++;
+ }
+
+ $table->AddRow(array(S_NUMBER_OF_USERS,$usr_cnt,new CSpan($online_cnt,'green')));
+
+return $table;
+}
+
+// Author: Aly
+function make_favorite_graphs($available_hosts=false){
+ global $USER_DETAILS;
+
+ if(!$available_hosts){
+ $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, null, null, get_current_nodeid());
+ }
+
+ $table = new CTableInfo();
+
+ $graphids = get_profile('web.favorite.graphids',array());
+ $graph_rsrc = get_profile('web.favorite.graph_rsrc',array());
+
+ foreach($graphids as $key => $resourceid){
+ if('simple_graph' == $graph_rsrc[$key]){
+ if(!$item = get_item_by_itemid($resourceid)) continue;
+
+ $host = get_host_by_itemid($resourceid);
+ $item["description"] = item_description($item["description"],$item["key_"]);
+
+ $capt = new CSpan(new CLink($host['host'].':'.$item['description'],'history.php?action=showgraph&itemid='.$resourceid));
+ $capt->AddOption('style','line-height: 14px; vertical-align: middle;');
+
+ $icon = new CLink(new CImg('images/general/chart.png','chart',18,18,'borderless'),'history.php?action=showgraph&itemid='.$resourceid.'&fullscreen=1');
+ $icon->SetTarget('blank');
+ }
+ else{
+ if(!$graph = get_graph_by_graphid($resourceid)) continue;
+
+ $result = get_hosts_by_graphid($resourceid);
+ $ghost = DBFetch($result);
+
+ $capt = new CSpan(new CLink($ghost['host'].':'.$graph['name'],'charts.php?graphid='.$resourceid));
+ $capt->AddOption('style','line-height: 14px; vertical-align: middle;');
+
+ $icon = new CLink(new CImg('images/general/chart.png','chart',18,18,'borderless'),'charts.php?graphid='.$resourceid.'&fullscreen=1');
+ $icon->SetTarget('blank');
+ }
+
+ $table->AddRow(new CCol(array(
+ $icon,
+ SPACE,
+ $capt)
+ ));
+ }
+
+return $table;
+}
+
+// Author: Aly
+function make_favorite_screens(){
+ $table = new CTableInfo();
+
+ $screenids = get_profile('web.favorite.screenids',array());
+ $screen_rsrc = get_profile('web.favorite.screen_rsrc',array());
+
+ foreach($screenids as $key => $resourceid){
+ if('slides' == $screen_rsrc[$key]){
+ if(!$slide = get_slideshow_by_slideshowid($resourceid)) continue;
+
+ $capt = new CSpan(new CLink($slide['name'],'screens.php?config=1&elementid='.$resourceid));
+ $capt->AddOption('style','line-height: 14px; vertical-align: middle;');
+
+ $icon = new CLink(new CImg('images/general/chart.png','screen',18,18,'borderless'),'screens.php?config=1&elementid='.$resourceid.'&fullscreen=1');
+ $icon->SetTarget('blank');
+ }
+ else{
+ if(!$screen = get_screen_by_screenid($resourceid)) continue;
+
+ $capt = new CSpan(new CLink($screen['name'],'screens.php?resourceid='.$resourceid));
+ $capt->AddOption('style','line-height: 14px; vertical-align: middle;');
+
+ $icon = new CLink(new CImg('images/general/chart.png','screen',18,18,'borderless'),'screens.php?resourceid='.$resourceid.'&fullscreen=1');
+ $icon->SetTarget('blank');
+ }
+
+ $table->AddRow(new CCol(array(
+ $icon,
+ SPACE,
+ $capt)
+ ));
+ }
+
+return $table;
+}
+
+// Author: Aly
+function make_favorite_maps(){
+ $table = new CTableInfo();
+
+ $sysmapids = get_profile('web.favorite.sysmapids',array());
+ foreach($sysmapids as $key => $sysmapid){
+ if(!$sysmap = get_sysmap_by_sysmapid($sysmapid)) continue;
+
+ $capt = new CSpan(new CLink($sysmap['name'],'maps.php?sysmapid='.$sysmapid));
+ $capt->AddOption('style','line-height: 14px; vertical-align: middle;');
+
+ $icon = new CLink(new CImg('images/general/chart.png','map',18,18,'borderless'),'maps.php?sysmapid='.$sysmapid.'&fullscreen=1');
+ $icon->SetTarget('blank');
+
+ $table->AddRow(new CCol(array(
+ $icon,
+ SPACE,
+ $capt)
+ ));
+ }
+
+return $table;
+}
+
+// author Aly
+function make_latest_issues($available_hosts=false){
+ global $USER_DETAILS;
+
+ if(!$available_hosts){
+ $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, null, null, get_current_nodeid());
+ }
+ $scripts_by_hosts = get_accessible_scripts_by_hosts(explode(',',$available_hosts));
+ $config=select_config();
+
+ $table = new CTableInfo();
+ $table->SetHeader(array(
+ is_show_subnodes() ? S_NODE : null,
+ S_HOST,
+ S_ISSUE,
+ S_LAST_CHANGE,
+ S_AGE,
+ ($config['event_ack_enable'])? S_ACK : NULL,
+ ));
+
+ $sql = 'SELECT DISTINCT t.triggerid,t.status,t.description, t.priority, t.lastchange,t.value,h.host,h.hostid '.
+ ' FROM triggers t,hosts h,items i,functions f, hosts_groups hg '.
+ ' WHERE f.itemid=i.itemid AND h.hostid=i.hostid '.
+ ' AND hg.hostid=h.hostid '.
+ ' AND t.triggerid=f.triggerid AND t.status='.TRIGGER_STATUS_ENABLED.
+ ' AND i.status='.ITEM_STATUS_ACTIVE.' AND '.DBin_node('t.triggerid').
+ ' AND h.hostid in ('.$available_hosts.') '.
+ ' AND h.status='.HOST_STATUS_MONITORED.
+ ' AND t.value='.TRIGGER_VALUE_TRUE.
+ 'ORDER BY t.lastchange DESC';
+ $result = DBselect($sql);
+
+ while($row=DBfetch($result)){
+// Check for dependencies
+ if(trigger_dependent($row["triggerid"])) continue;
+
+ $host = null;
+
+ $menus = '';
+
+ $host_nodeid = id2nodeid($row['hostid']);
+ foreach($scripts_by_hosts[$row['hostid']] as $id => $script){
+ $script_nodeid = id2nodeid($script['scriptid']);
+ if( (bccomp($host_nodeid ,$script_nodeid ) == 0))
+ $menus.= "['".$script['name']."',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=".$row['hostid']."&scriptid=".$script['scriptid']."','".S_TOOLS."',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
+ }
+
+ $menus = trim($menus,',');
+ if(!empty($menus)) $menus="show_popup_menu(event,[[".zbx_jsvalue(S_TOOLS).",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],".$menus."],180);";
+
+ $host = new CSpan($row['host']);
+ $host->AddOption('onclick','javascript: '.$menus);
+ $host->AddOption('onmouseover',"javascript: this.style.cursor = 'pointer';");
+
+ $event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type '.
+ ' FROM events e, triggers t '.
+ ' WHERE e.object=0 AND e.objectid='.$row['triggerid'].
+ ' AND t.triggerid=e.objectid '.
+ ' AND e.value='.TRIGGER_VALUE_TRUE.
+ ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';
+
+ $res_events = DBSelect($event_sql,1);
+
+ while($row_event=DBfetch($res_events)){
+ if($config['event_ack_enable']){
+ if($row_event['acknowledged'] == 1){
+ $ack=new CLink(S_YES,'acknow.php?eventid='.$row_event['eventid'],'action');
+ }
+ else{
+ $ack= new CLink(S_NO,'acknow.php?eventid='.$row_event['eventid'],'on');
+ }
+ }
+
+ $description = expand_trigger_description_by_data(
+ array_merge($row, array("clock"=>$row_event["clock"])),
+ ZBX_FLAG_EVENT);
+
+ $table->AddRow(array(
+ get_node_name_by_elid($row['triggerid']),
+ $host,
+ new CCol($description,get_severity_style($row["priority"])),
+ new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS,$row_event['clock']),"tr_events.php?triggerid=".$row["triggerid"],"action"),
+ zbx_date2age($row_event['clock']),
+ ($config['event_ack_enable'])?(new CCol($ack,"center")):NULL,
+ ));
+ }
+ unset($row,$description, $actions);
+ }
+return $table;
+}
+
+// author Aly
+function make_webmon_overview($available_hosts=false){
+ global $USER_DETAILS;
+
+ if(!$available_hosts){
+ $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, null, null, get_current_nodeid());
+ }
+
+
+ $table = new CTableInfo();
+ $table->SetHeader(array(
+ is_show_subnodes() ? S_NODE : null,
+ S_HOST_GROUP,
+ S_OK,
+ S_FAILED,
+ S_IN_PROGRESS,
+ S_UNKNOWN
+ ));
+
+ $sql = 'SELECT DISTINCT g.groupid, g.name '.
+ ' FROM httptest ht, applications a, hosts h, groups g, hosts_groups hg '.
+ ' WHERE hg.hostid in ('.$available_hosts.') '.
+ ' AND hg.hostid=a.hostid '.
+ ' AND g.groupid=hg.groupid '.
+ ' AND a.applicationid=ht.applicationid '.
+ ' AND ht.status='.HTTPTEST_STATUS_ACTIVE.
+ ' ORDER BY g.name';
+ $host_groups = DBSelect($sql);
+
+ while($group = DBFetch($host_groups)){
+
+ $apps['ok'] = 0;
+ $apps['failed'] = 0;
+ $apps[HTTPTEST_STATE_BUSY] = 0;
+ $apps[HTTPTEST_STATE_UNKNOWN] = 0;
+
+ $sql = 'SELECT DISTINCT ht.httptestid, ht.curstate, ht.lastfailedstep '.
+ ' FROM httptest ht, applications a, hosts_groups hg, groups g '.
+ ' WHERE g.groupid='.$group['groupid'].
+ ' AND hg.groupid=g.groupid '.
+ ' AND a.hostid=hg.hostid '.
+ ' AND ht.applicationid=a.applicationid '.
+ ' AND ht.status='.HTTPTEST_STATUS_ACTIVE;
+
+ $db_httptests = DBselect($sql);
+
+ while($httptest_data = DBfetch($db_httptests)){
+
+ if( HTTPTEST_STATE_BUSY == $httptest_data['curstate'] ){
+ $apps[HTTPTEST_STATE_BUSY]++;
+ }
+ else if( HTTPTEST_STATE_IDLE == $httptest_data['curstate'] ){
+ if($httptest_data['lastfailedstep'] > 0){
+ $apps['failed']++;
+ }
+ else{
+ $apps['ok']++;
+ }
+ }
+ else{
+ $apps[HTTPTEST_STATE_UNKNOWN]++;
+ }
+ }
+
+ $table->AddRow(array(
+ is_show_subnodes() ? get_node_name_by_elid($group['groupid']) : null,
+ $group['name'],
+ new CSpan($apps['ok'],'off'),
+ new CSpan($apps['failed'],$apps['failed']?'on':'off'),
+ new CSpan($apps[HTTPTEST_STATE_BUSY],$apps[HTTPTEST_STATE_BUSY]?'orange':'off'),
+ new CSpan($apps[HTTPTEST_STATE_UNKNOWN],'unknown')
+ ));
+ }
+return $table;
+}
+
+function make_latest_data($available_hosts=false){
+ global $USER_DETAILS;
+
+ if(!$available_hosts){
+ $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, null, null, get_current_nodeid());
+ }
+
+ while($db_app = DBfetch($db_applications)){
+ $db_items = DBselect('SELECT DISTINCT i.* '.
+ ' FROM items i,items_applications ia'.
+ ' WHERE ia.applicationid='.$db_app['applicationid'].
+ ' AND i.itemid=ia.itemid'.
+ ' AND i.status='.ITEM_STATUS_ACTIVE.
+ order_by('i.description,i.itemid,i.lastclock'));
+
+ $app_rows = array();
+ $item_cnt = 0;
+ while($db_item = DBfetch($db_items)){
+ $description = item_description($db_item["description"],$db_item["key_"]);
+
+ if( '' != $_REQUEST["select"] && !zbx_stristr($description, $_REQUEST["select"]) ) continue;
+
+ ++$item_cnt;
+ if(!uint_in_array($db_app["applicationid"],$_REQUEST["applications"]) && !isset($show_all_apps)) continue;
+
+ if(isset($db_item["lastclock"]))
+ $lastclock=date(S_DATE_FORMAT_YMDHMS,$db_item["lastclock"]);
+ else
+ $lastclock = new CCol('-', 'center');
+
+ $lastvalue=format_lastvalue($db_item);
+
+ if( isset($db_item["lastvalue"]) && isset($db_item["prevvalue"]) &&
+ ($db_item["value_type"] == 0) && ($db_item["lastvalue"]-$db_item["prevvalue"] != 0) )
+ {
+ if($db_item["lastvalue"]-$db_item["prevvalue"]<0){
+ $change=convert_units($db_item["lastvalue"]-$db_item["prevvalue"],$db_item["units"]);
+ }
+ else{
+ $change="+".convert_units($db_item["lastvalue"]-$db_item["prevvalue"],$db_item["units"]);
+ }
+ $change=nbsp($change);
+ }
+ else{
+ $change=new CCol("-","center");
+ }
+ if(($db_item["value_type"]==ITEM_VALUE_TYPE_FLOAT) ||($db_item["value_type"]==ITEM_VALUE_TYPE_UINT64)){
+ $actions=new CLink(S_GRAPH,"history.php?action=showgraph&itemid=".$db_item["itemid"],"action");
+ }
+ else{
+ $actions=new CLink(S_HISTORY,"history.php?action=showvalues&period=3600&itemid=".$db_item["itemid"],"action");
+ }
+ array_push($app_rows, new CRow(array(
+ is_show_subnodes() ? SPACE : null,
+ $_REQUEST["hostid"] > 0 ? NULL : SPACE,
+ str_repeat(SPACE,6).$description,
+ $lastclock,
+ new CCol($lastvalue, $lastvalue=='-' ? 'center' : null),
+ $change,
+ $actions
+ )));
+ }
+
+ if($item_cnt > 0){
+ if(uint_in_array($db_app["applicationid"],$_REQUEST["applications"]) || isset($show_all_apps)){
+ $link = new CLink(new CImg("images/general/opened.gif"),
+ "?close=1&applicationid=".$db_app["applicationid"].
+ url_param("groupid").url_param("hostid").url_param("applications").
+ url_param("select"));
+ }
+ else{
+ $link = new CLink(new CImg("images/general/closed.gif"),
+ "?open=1&applicationid=".$db_app["applicationid"].
+ url_param("groupid").url_param("hostid").url_param("applications").
+ url_param("select"));
+ }
+
+ $col = new CCol(array($link,SPACE,bold($db_app["name"]),
+ SPACE."(".$item_cnt.SPACE.S_ITEMS.")"));
+ $col->SetColSpan(5);
+
+ $table->ShowRow(array(
+ get_node_name_by_elid($db_app['hostid']),
+ $_REQUEST["hostid"] > 0 ? NULL : $db_app["host"],
+ $col
+ ));
+
+ $any_app_exist = true;
+
+ foreach($app_rows as $row) $table->ShowRow($row);
+ }
+ }
+}
+
+function make_graph_menu(&$menu,&$submenu){
+
+ $menu['menu_graphs'][] = array(
+ S_FAVORITE.SPACE.S_GRAPHS,
+ null,
+ null,
+ array('outer'=> array('pum_oheader'), 'inner'=>array('pum_iheader'))
+ );
+ $menu['menu_graphs'][] = array(
+ S_ADD.SPACE.S_GRAPH,
+ 'javascript: '.
+ "PopUp('popup.php?srctbl=graphs&".
+ 'reference=dashboard&'.
+ 'dstfrm=fav_form&'.
+ 'dstfld1=favobj&'.
+ 'dstfld2=favid&'.
+ 'srcfld1=description&'.
+ "srcfld2=graphid',800,450);".
+ "void(0);",
+ null,
+ array('outer' => 'pum_o_submenu', 'inner'=>array('pum_i_submenu'))
+ );
+ $menu['menu_graphs'][] = array(
+ S_ADD.SPACE.S_SIMPLE_GRAPH,
+ 'javascript: '.
+ "PopUp('popup.php?srctbl=simple_graph&".
+ 'reference=dashboard&'.
+ 'dstfrm=fav_form&'.
+ 'dstfld1=favobj&'.
+ 'dstfld2=favid&'.
+ 'srcfld1=description&'.
+ "srcfld2=itemid',800,450);".
+ "void(0);",
+ null,
+ array('outer' => 'pum_o_submenu', 'inner'=>array('pum_i_submenu'))
+ );
+ $menu['menu_graphs'][] = array(
+ S_REMOVE,
+ null,
+ null,
+ array('outer' => 'pum_o_submenu', 'inner'=>array('pum_i_submenu'))
+ );
+ $submenu['menu_graphs'] = make_graph_submenu();
+}
+
+function make_graph_submenu(){
+ $graphids = array();
+
+ $fav_graphids = get_profile('web.favorite.graphids',array());
+ $graph_rsrc = get_profile('web.favorite.graph_rsrc',array());
+
+ foreach($fav_graphids as $key => $resourceid){
+ if('simple_graph' == $graph_rsrc[$key]){
+ if(!$item = get_item_by_itemid($resourceid)) continue;
+
+ $host = get_host_by_itemid($resourceid);
+ $item["description"] = item_description($item["description"],$item["key_"]);
+
+ $graphids[] = array(
+ 'name' => $host['host'].':'.$item['description'],
+ 'favobj'=> 'simple_graph',
+ 'favid' => $resourceid,
+ 'action'=> 'remove'
+ );
+ }
+ else{
+ if(!$graph = get_graph_by_graphid($resourceid)) continue;
+
+ $result = get_hosts_by_graphid($resourceid);
+ $ghost = DBFetch($result);
+
+ $graphids[] = array(
+ 'name' => $ghost['host'].':'.$graph['name'],
+ 'favobj'=> 'graphs',
+ 'favid' => $resourceid,
+ 'action'=> 'remove'
+ );
+ }
+ }
+
+return $graphids;
+}
+
+function make_sysmap_menu(&$menu,&$submenu){
+
+ $menu['menu_sysmaps'][] = array(S_FAVORITE.SPACE.S_MAPS, null, null, array('outer'=> array('pum_oheader'), 'inner'=>array('pum_iheader')));
+ $menu['menu_sysmaps'][] = array(
+ S_ADD.SPACE.S_MAP,
+ 'javascript: '.
+ "PopUp('popup.php?srctbl=sysmaps&".
+ 'reference=dashboard&'.
+ 'dstfrm=fav_form&'.
+ 'dstfld1=favobj&'.
+ 'dstfld2=favid&'.
+ 'srcfld1=name&'.
+ "srcfld2=sysmapid',800,450);".
+ "void(0);",
+ null,
+ array('outer' => 'pum_o_submenu', 'inner'=>array('pum_i_submenu')
+ ));
+ $menu['menu_sysmaps'][] = array(S_REMOVE, null, null, array('outer' => 'pum_o_submenu', 'inner'=>array('pum_i_submenu')));
+ $submenu['menu_sysmaps'] = make_sysmap_submenu();
+}
+
+function make_sysmap_submenu(){
+ $sysmapids = array();
+ $fav_sysmaps = get_profile('web.favorite.sysmapids',array());
+
+ foreach($fav_sysmaps as $key => $sysmapid){
+ if(!$sysmap = get_sysmap_by_sysmapid($sysmapid)) continue;
+
+ $sysmapids[] = array(
+ 'name' => $sysmap['name'],
+ 'favobj'=> 'sysmaps',
+ 'favid' => $sysmapid,
+ 'action'=> 'remove'
+ );
+ }
+
+return $sysmapids;
+}
+
+function make_screen_menu(&$menu,&$submenu){
+
+ $menu['menu_screens'][] = array(S_FAVORITE.SPACE.S_SCREENS, null, null, array('outer'=> array('pum_oheader'), 'inner'=>array('pum_iheader')));
+ $menu['menu_screens'][] = array(
+ S_ADD.SPACE.S_SCREEN,
+ 'javascript: '.
+ "PopUp('popup.php?srctbl=screens&".
+ 'reference=dashboard&'.
+ 'dstfrm=fav_form&'.
+ 'dstfld1=favobj&'.
+ 'dstfld2=favid&'.
+ 'srcfld1=name&'.
+ "srcfld2=screenid',800,450);".
+ "void(0);",
+ null,
+ array('outer' => 'pum_o_submenu', 'inner'=>array('pum_i_submenu')
+ ));
+ $menu['menu_screens'][] = array(
+ S_ADD.SPACE.S_SLIDESHOW,
+ 'javascript: '.
+ "PopUp('popup.php?srctbl=slides&".
+ 'reference=dashboard&'.
+ 'dstfrm=fav_form&'.
+ 'dstfld1=favobj&'.
+ 'dstfld2=favid&'.
+ 'srcfld1=name&'.
+ "srcfld2=slideshowid',800,450);".
+ "void(0);",
+ null,
+ array('outer' => 'pum_o_submenu', 'inner'=>array('pum_i_submenu')
+ ));
+ $menu['menu_screens'][] = array(S_REMOVE, null, null, array('outer' => 'pum_o_submenu', 'inner'=>array('pum_i_submenu')));
+ $submenu['menu_screens'] = make_screen_submenu();
+}
+
+function make_screen_submenu(){
+ $screenids = array();
+
+ $fav_screens = get_profile('web.favorite.screenids',array());
+ $screen_rsrc = get_profile('web.favorite.screen_rsrc',array());
+
+ foreach($fav_screens as $key => $resourceid){
+ if('slides' == $screen_rsrc[$key]){
+ if(!$slide = get_slideshow_by_slideshowid($resourceid)) continue;
+
+ $screenids[] = array(
+ 'name' => $slide['name'],
+ 'favobj'=> 'slides',
+ 'favid' => $resourceid,
+ 'action'=> 'remove'
+ );
+
+ }
+ else{
+ if(!$screen = get_screen_by_screenid($resourceid)) continue;
+
+ $screenids[] = array(
+ 'name' => $screen['name'],
+ 'favobj'=> 'screens',
+ 'favid' => $resourceid,
+ 'action'=> 'remove'
+ );
+ }
+ }
+
+return $screenids;
+}
+?> \ No newline at end of file
diff --git a/frontends/php/include/classes/chart.inc.php b/frontends/php/include/classes/chart.inc.php
index 8fb74055..4a6668fa 100644
--- a/frontends/php/include/classes/chart.inc.php
+++ b/frontends/php/include/classes/chart.inc.php
@@ -504,8 +504,9 @@ class Chart extends Graph{
function calculateMinY($side){
if($this->yaxistype==GRAPH_YAXIS_TYPE_FIXED){
return $this->yaxismin;
- }
- else{
+ } else if ($this->yaxistype==GRAPH_YAXIS_TYPE_CALCULATED_0_MIN) {
+ return 0;
+ } else{
unset($minY);
for($i=0;$i<$this->num;$i++){
@@ -1102,4 +1103,4 @@ class Chart extends Graph{
ImageOut($this->im);
}
}
-?> \ No newline at end of file
+?>
diff --git a/frontends/php/include/classes/graph.inc.php b/frontends/php/include/classes/graph.inc.php
index c6b6f2d0..0cc74dc2 100644
--- a/frontends/php/include/classes/graph.inc.php
+++ b/frontends/php/include/classes/graph.inc.php
@@ -24,6 +24,7 @@ require_once "include/hosts.inc.php";
define("GRAPH_YAXIS_TYPE_CALCULATED",0);
define("GRAPH_YAXIS_TYPE_FIXED",1);
+define("GRAPH_YAXIS_TYPE_CALCULATED_0_MIN",2);
define("GRAPH_YAXIS_SIDE_LEFT",0);
define("GRAPH_YAXIS_SIDE_RIGHT",1);
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 325a9e0a..8b196474 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -324,6 +324,23 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
include_once "include/page_footer.php";
}
+ function detect_page_type($default=PAGE_TYPE_HTML){
+ if(isset($_REQUEST['output'])){
+ switch($_REQUEST['output']){
+ case 'ajax':
+ return PAGE_TYPE_JS;
+ break;
+ case 'json':
+ return PAGE_TYPE_JS;
+ break;
+ case 'html':
+ return PAGE_TYPE_HTML_BLOCK;
+ break;
+ }
+ }
+ return $default;
+ }
+
function zbx_strlen(&$str){
if(!$strlen = strlen($str)) return $strlen;
@@ -1087,9 +1104,14 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
}
$table = new CTable(NULL,"header");
+// $table->AddOption('border',1);
$table->SetCellSpacing(0);
$table->SetCellPadding(1);
- $table->AddRow(array(new CCol($col1,"header_l"), new CCol($col2,"header_r")));
+
+ $td_r = new CCol($col2,"header_r");
+ $td_r->AddOption('align','right');
+
+ $table->AddRow(array(new CCol($col1,"header_l"), $td_r));
return $table;
}
@@ -1371,69 +1393,68 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
function get_profile($idx,$default_value=null,$type=PROFILE_TYPE_UNKNOWN){
global $USER_DETAILS;
- $result = $default_value;
- if($USER_DETAILS["alias"]!=ZBX_GUEST_USER)
- {
- $db_profiles = DBselect("select * from profiles where userid=".$USER_DETAILS["userid"]." and idx=".zbx_dbstr($idx));
- $profile=DBfetch($db_profiles);
+ $result = array();
+// $result = $default_value;
- if($profile)
- {
- if($type==PROFILE_TYPE_UNKNOWN)
- $type = $profile["valuetype"];
+ if($USER_DETAILS["alias"]!=ZBX_GUEST_USER){
+ $db_profiles = DBselect('SELECT * FROM profiles WHERE userid='.$USER_DETAILS["userid"].' AND idx='.zbx_dbstr($idx));
+
+ while($profile=DBfetch($db_profiles)){
+ if($type==PROFILE_TYPE_UNKNOWN) $type = $profile["valuetype"];
- $result = $profile["value"];
+ switch($type){
+ case PROFILE_TYPE_INT:
+ $result[] = intval($profile["value"]);
+ break;
+ case PROFILE_TYPE_STR:
+ default:
+ $result[] = strval($profile["value"]);
+ }
}
}
- switch($type)
- {
- case PROFILE_TYPE_ARRAY: $result = explode(";", $result); break;
- case PROFILE_TYPE_INT: $result = intval($result); break;
- case PROFILE_TYPE_STR: $result = strval($result); break;
- }
- if(is_array($result))
- {
- $result = array_filter($result, "not_empty");
- }
- return $result;
+ $result = array_filter($result, "not_empty");
+
+ if(isset($result[0]) && (PROFILE_TYPE_ARRAY != $type)) $result = $result[0];
+ if(empty($result)) $result = $default_value;
+
+ return $result;
}
//----------- ADD/EDIT USERPROFILE -------------
- function update_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN)
- {
-
+ function update_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN){
global $USER_DETAILS;
- if($USER_DETAILS["alias"]==ZBX_GUEST_USER)
- {
- return;
+ if($USER_DETAILS["alias"]==ZBX_GUEST_USER){
+ return false;
}
-
+
if($type==PROFILE_TYPE_UNKNOWN && is_array($value)) $type = PROFILE_TYPE_ARRAY;
if($type==PROFILE_TYPE_ARRAY && !is_array($value)) $value = array($value);
- switch($type)
- {
- case PROFILE_TYPE_ARRAY: $value = implode(";", $value); break;
- default: $value = strval($value);
- }
-
- $row = DBfetch(DBselect("select value from profiles where userid=".$USER_DETAILS["userid"]." and idx=".zbx_dbstr($idx)));
+ $sql='DELETE FROM profiles WHERE userid='.$USER_DETAILS["userid"].' and idx='.zbx_dbstr($idx);
+ DBExecute($sql);
- if(!$row)
- {
- $profileid = get_dbid('profiles', 'profileid');
- $sql="insert into profiles (profileid,userid,idx,value,valuetype)".
- " values (".$profileid.",".$USER_DETAILS["userid"].",".zbx_dbstr($idx).",".zbx_dbstr($value).",".$type.")";
- DBexecute($sql);
+ insert_profile($idx,$value,$type);
+
+ return true;
+ }
+
+ function insert_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN){
+ global $USER_DETAILS;
+
+ if(is_array($value)){
+ foreach($value as $key => $val){
+ insert_profile($idx,$val,$type); // recursion!!!
+ }
}
- else
- {
- $sql="update profiles set value=".zbx_dbstr($value).",valuetype=".$type.
- " where userid=".$USER_DETAILS["userid"]." and idx=".zbx_dbstr($idx);
+ else{
+ $profileid = get_dbid('profiles', 'profileid');
+ $sql='INSERT INTO profiles (profileid,userid,idx,value,valuetype)'.
+ ' VALUES ('.$profileid.','.$USER_DETAILS["userid"].','.zbx_dbstr($idx).','.zbx_dbstr($value).','.$type.')';
DBexecute($sql);
}
+
}
/***********************************/
@@ -1464,7 +1485,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
}
$url = '';
- foreach($page['hist_arg'] as $arg){
+ foreach($page['hist_arg'] as $key => $arg){
if(isset($_REQUEST[$arg]) && !empty($_REQUEST[$arg])){
$url.=((empty($url))?('?'):('&')).$arg.'='.$_REQUEST[$arg];
}
@@ -1777,6 +1798,33 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
{
return ($timestamp==0)?S_NEVER:date($format,$timestamp);
}
+
+ /* function:
+ * zbx_date2age
+ *
+ * description:
+ * Calculate and convert timestamp to string representation.
+ *
+ * author: Aly
+ */
+ function zbx_date2age($start_date,$end_date=0){
+
+ $start_date=date('U',$start_date);
+ if($end_date)
+ $end_date=date('U',$end_date);
+ else
+ $end_date = time();
+
+ $time = abs($end_date-$start_date);
+
+//SDI($start_date.' - '.$end_date.' = '.$time);
+
+ $days = (int) ($time / 86400);
+ $hours = (int) (($time - $days*86400) / 3600);
+ $minutes = (int) ((($time - $days*86400) - ($hours*3600)) / 60);
+ $str = (($days)?$days.'d ':'').(($hours)?$hours.'h ':'').$minutes.'m';
+ return $str;
+ }
function encode_log($data)
{
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index de3710b0..e2969831 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -41,9 +41,11 @@
define('XML_TAG_SCREEN_ELEMENT', 'screen_element');
define('XML_TAG_SCREEN_ELEMENTS', 'screen_elements');
- define('PAGE_TYPE_HTML', 0);
- define('PAGE_TYPE_IMAGE', 1);
- define('PAGE_TYPE_XML', 2);
+ define('PAGE_TYPE_HTML', 0);
+ define('PAGE_TYPE_IMAGE', 1);
+ define('PAGE_TYPE_XML', 2);
+ define('PAGE_TYPE_JS', 3); //javascript
+ define('PAGE_TYPE_HTML_BLOCK', 4); //simple block of html (as text)
define('T_ZBX_STR', 0);
define('T_ZBX_INT', 1);
@@ -488,6 +490,7 @@ if((ini_get('mbstring.func_overload') > 5)){
define('ZBX_HISTORY_COUNT',5);
+ define('ZBX_USER_ONLINE_TIME',600); // 10min
define('ZBX_GUEST_USER','guest');
define('ZBX_DEFAULT_CSS','default.css');
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index 64f2ee99..ba346f19 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -2545,7 +2545,9 @@
$cmbYType = new CComboBox("yaxistype",$yaxistype,"graphs.submit(this)");
$cmbYType->AddItem(GRAPH_YAXIS_TYPE_CALCULATED,S_CALCULATED);
+ $cmbYType->AddItem(GRAPH_YAXIS_TYPE_CALCULATED_0_MIN,S_CALCULATED_0_MIN);
$cmbYType->AddItem(GRAPH_YAXIS_TYPE_FIXED,S_FIXED);
+
$frmGraph->AddRow(S_YAXIS_TYPE,$cmbYType);
if($yaxistype == GRAPH_YAXIS_TYPE_FIXED){
@@ -5154,7 +5156,7 @@ include_once 'include/discovery.inc.php';
$message = "";
}
$frmResult->AddRow(S_RESULT,new CTextArea("message",$message,100,25,'yes'));
- $frmResult->AddItemToBottomRow(new CButton('close',S_CLOSE,'close_window();'));
+ $frmResult->AddItemToBottomRow(new CButton('close',S_CLOSE,'window.close();'));
$frmResult->Show();
}
diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php
index c348b59c..a666b5e4 100644
--- a/frontends/php/include/graphs.inc.php
+++ b/frontends/php/include/graphs.inc.php
@@ -127,13 +127,13 @@
}
- function &get_graphs_by_hostid($hostid)
+ function get_graphs_by_hostid($hostid)
{
return DBselect("SELECT distinct g.* FROM graphs g, graphs_items gi, items i".
" WHERE g.graphid=gi.graphid and gi.itemid=i.itemid and i.hostid=$hostid");
}
- function &get_realhosts_by_graphid($graphid)
+ function get_realhosts_by_graphid($graphid)
{
$graph = get_graph_by_graphid($graphid);
if($graph["templateid"] != 0)
@@ -142,13 +142,13 @@
return get_hosts_by_graphid($graphid);
}
- function &get_hosts_by_graphid($graphid)
+ function get_hosts_by_graphid($graphid)
{
return DBselect("SELECT distinct h.* FROM graphs_items gi, items i, hosts h".
" WHERE h.hostid=i.hostid and gi.itemid=i.itemid and gi.graphid=$graphid");
}
- function &get_graphitems_by_graphid($graphid)
+ function get_graphitems_by_graphid($graphid)
{
return DBselect("SELECT * FROM graphs_items WHERE graphid=$graphid".
" order by itemid,drawtype,sortorder,color,yaxisside");
diff --git a/frontends/php/include/html.inc.php b/frontends/php/include/html.inc.php
index 719ce7de..6946ecd4 100644
--- a/frontends/php/include/html.inc.php
+++ b/frontends/php/include/html.inc.php
@@ -106,4 +106,44 @@
function BR(){
return new CTag('br','no');
}
-?>
+
+ function create_hat($caption,$items,$addicons=null,$id=null,$state=1){
+
+ if(is_null($id)){
+ list($usec, $sec) = explode(' ',microtime());
+ $id = 'hat_'.((int)($sec % 10)).((int)($usec * 1000));
+ }
+
+ $td_l = new CCol(SPACE);
+ $td_l->AddOption('width','100%');
+
+ $icons_row = array($td_l);
+ if(!is_null($addicons)){
+ if(!is_array($addicons)) $addicons = array($addicons);
+ foreach($addicons as $value) $icons_row[] = $value;
+ }
+
+ $icon = new CDiv(SPACE,($state)?'arrowup':'arrowdown');
+ $icon->AddAction('onclick',new CScript("javascript: change_hat_state(this,'".$id."');"));
+
+ $icons_row[] = $icon;
+
+ $icon_tab = new CTable();
+ $icon_tab->AddOption('width','100%');
+
+ $icon_tab->AddRow($icons_row);
+
+ $table = new CTable();
+ $table->AddOption('width','100%');
+ $table->SetCellPadding(0);
+ $table->SetCellSpacing(0);
+ $table->AddRow(get_table_header($caption,$icon_tab));
+
+ $div = new CDiv($items);
+ $div->AddOption('id',$id);
+ if(!$state) $div->AddOption('style','display: none;');
+
+ $table->AddRow($div);
+ return $table;
+ }
+?> \ No newline at end of file
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php
index e859f8c7..dc0c5394 100644
--- a/frontends/php/include/items.inc.php
+++ b/frontends/php/include/items.inc.php
@@ -913,7 +913,7 @@ COpt::profiling_start('prepare data');
while($row = DBfetch($result))
{
$row['host'] = get_node_name_by_elid($row['hostid']).$row['host'];
- $hosts[$row['host']] = $row['host'];
+ $hosts[strtolower($row['host'])] = $row['host'];
$items[item_description($row["description"],$row["key_"])][$row['host']] = array(
'itemid' => $row['itemid'],
'value_type' => $row['value_type'],
@@ -931,7 +931,7 @@ COpt::profiling_start('prepare data');
return $table;
}
- sort($hosts);
+ ksort($hosts);
COpt::profiling_stop('prepare data');
COpt::profiling_start('prepare table');
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 4191c860..b8614521 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -93,6 +93,7 @@
'S_IN_CHECK'=> 'In check',
'S_IDLE_TILL'=> 'Idle till',
'S_FAILED_ON'=> 'Failed on',
+ 'S_FAILED'=> 'Failed',
// httpmon.php
'S_STATUS_OF_WEB_MONITORING'=> 'Status of Web monitoring',
@@ -555,6 +556,7 @@
'S_YAXIS_MIN_VALUE'=> 'Y axis MIN value',
'S_YAXIS_MAX_VALUE'=> 'Y axis MAX value',
'S_CALCULATED'=> 'Calculated',
+ 'S_CALCULATED_0_MIN'=> 'Calculated [Min=0]',
'S_FIXED'=> 'Fixed',
'S_CREATE_GRAPH'=> 'Create Graph',
'S_SHOW_WORKING_TIME'=> 'Show working time',
@@ -925,6 +927,17 @@
'S_MENU_AUDIT'=> 'AUDIT',
'S_SWITCH_NODE'=> 'Switch node',
+// dashbord.php
+ 'S_DASHBOARD'=> 'Dashboard',
+ 'S_DASHBOARD_BIG'=> 'PERSONAL DASHBOARD',
+ 'S_SWITCH_VIEW'=> 'Switch view',
+ 'S_AGE'=> 'Age',
+ 'S_ISSUE'=> 'Issue',
+ 'S_ISSUES'=> 'Issues',
+ 'S_SYSTEM_STATUS'=> 'System status',
+ 'S_LATEST_ISSUES'=> 'Latest issues',
+ 'S_FAVORITE'=> 'Favorite',
+
// overview.php
'S_SELECT_GROUP_DOT_DOT_DOT'=> 'Select group ...',
'S_OVERVIEW'=> 'Overview',
diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php
index d5805886..628a5447 100644
--- a/frontends/php/include/page_header.php
+++ b/frontends/php/include/page_header.php
@@ -52,6 +52,14 @@ COpt::profiling_start("page");
header('Content-Disposition: attachment; filename="'.$page['file'].'"');
define('ZBX_PAGE_NO_MENU', 1);
break;
+ case PAGE_TYPE_JS:
+ header('Content-Type: application/javascript; charset=UTF-8');
+ define('ZBX_PAGE_NO_MENU', 1);
+ break;
+ case PAGE_TYPE_HTML_BLOCK:
+ header('Content-Type: text/plain; charset=UTF-8');
+ define('ZBX_PAGE_NO_MENU', 1);
+ break;
case PAGE_TYPE_HTML:
default:
if(!isset($page['encoding']))
@@ -63,18 +71,17 @@ COpt::profiling_start("page");
if(!isset($page['title'])) $page['title'] = 'ZABBIX';
- if(defined('ZBX_DISTRIBUTED'))
- {
+ if(defined('ZBX_DISTRIBUTED')){
if($curr_node_data = DBfetch(DBselect('select * from nodes where nodeid='.get_current_nodeid(false))))
$page['title'] .= ' ('.$curr_node_data['name'].')';
}
- if(defined('ZBX_PAGE_DO_REFRESH') && $USER_DETAILS["refresh"])
- {
+
+ if(defined('ZBX_PAGE_DO_REFRESH') && $USER_DETAILS["refresh"]){
$page['title'] .= ' [refreshed every '.$USER_DETAILS['refresh'].' sec]';
- /* header('Refresh: '.$USER_DETAILS["refresh"]); */ /* is not part of the official HTTP specification */
}
- break; /* case PAGE_TYPE_HTML */
- } /* switch($page["type"]) */
+ break;
+ }
+ /* switch($page["type"]) */
/* NOTE - menu array format:
first level:
@@ -87,14 +94,15 @@ COpt::profiling_start("page");
'url' = real url for this page
'label' = submenu title, if missed menu skipped, but remmembed as last visited page.
'sub_pages' = collection of pages for displaying but dont remember as last visited.
-
*/
+
$ZBX_MENU = array(
"view"=>array(
"label" => S_MONITORING,
"node_perm" => PERM_READ_LIST,
"default_page_id" => 0,
"pages"=>array(
+ array("url"=>"dashboard.php" ,"label"=>S_DASHBOARD ),
array("url"=>"overview.php" ,"label"=>S_OVERVIEW ),
array("url"=>"httpmon.php" ,"label"=>S_WEB ,
"sub_pages"=>array("httpdetails.php")
diff --git a/frontends/php/include/services.inc.php b/frontends/php/include/services.inc.php
index 6ae9e821..44f67ffb 100644
--- a/frontends/php/include/services.inc.php
+++ b/frontends/php/include/services.inc.php
@@ -139,7 +139,7 @@
* retrive true status
*
* Author:
- * Artem Suharev
+ * Aly
*
* Comments:
*
@@ -208,7 +208,7 @@
* removes any links between trigger and service if service is not leaf (treenode)
*
* Author:
- * Artem Suharev
+ * Aly
*
* Comments:
*
diff --git a/frontends/php/include/setup.inc.php b/frontends/php/include/setup.inc.php
index b697622b..c43ef973 100644
--- a/frontends/php/include/setup.inc.php
+++ b/frontends/php/include/setup.inc.php
@@ -328,9 +328,9 @@
$final_result = array(
new CSpan(S_FAIL,'fail'),
- BR, BR,
+ BR(), BR(),
'Please correct all issuse and press "Retry" button',
- BR, BR,
+ BR(), BR(),
new CButton('retry', S_RETRY)
);
}
diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php
index 1be995d4..9bec6e0e 100644
--- a/frontends/php/include/triggers.inc.php
+++ b/frontends/php/include/triggers.inc.php
@@ -181,20 +181,31 @@
* convert severity constant in to the CSS style name
*
* Author:
- * Eugene Grigorjev (eugene.grigorjev@zabbix.com)
+ * Aly
*
* Comments:
*
*/
- function get_severity_style($severity)
- {
- if($severity == TRIGGER_SEVERITY_INFORMATION) return 'information';
- elseif($severity == TRIGGER_SEVERITY_WARNING) return 'warning';
- elseif($severity == TRIGGER_SEVERITY_AVERAGE) return 'average';
- elseif($severity == TRIGGER_SEVERITY_HIGH) return 'high';
- elseif($severity == TRIGGER_SEVERITY_DISASTER) return 'disaster';
-
- return '';
+ function get_severity_style($severity,$type=true){
+ switch($severity){
+ case TRIGGER_SEVERITY_DISASTER:
+ $style='disaster';
+ break;
+ case TRIGGER_SEVERITY_HIGH:
+ $style='high';
+ break;
+ case TRIGGER_SEVERITY_AVERAGE:
+ $style='average';
+ break;
+ case TRIGGER_SEVERITY_WARNING:
+ $style='warning';
+ break;
+ case TRIGGER_SEVERITY_INFORMATION:
+ default:
+ $style='information';
+ }
+ if(!$type) $style='normal';//$style.='_empty';
+ return $style;
}
/*
@@ -1780,7 +1791,7 @@
$row['host'] = get_node_name_by_elid($row['hostid']).$row['host'];
$row['description'] = expand_trigger_description_constants($row['description'], $row);
- $hosts[$row['host']] = $row['host'];
+ $hosts[strtolower($row['host'])] = $row['host'];
$triggers[$row['description']][$row['host']] = array(
'hostid' => $row['hostid'],
'triggerid' => $row['triggerid'],
@@ -1792,7 +1803,8 @@
{
return $table;
}
- sort($hosts);
+ ksort($hosts);
+
if($view_style == STYLE_TOP){
$header=array(new CCol(S_TRIGGERS,'center'));
foreach($hosts as $hostname)