diff options
author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-12-10 12:38:26 +0000 |
---|---|---|
committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-12-10 12:38:26 +0000 |
commit | 024d1de15b266f8c7536c79657d5940ae9292689 (patch) | |
tree | f53c93d98df6f1e869f62d0d4a14a40c7a8422d4 /frontends | |
parent | 5ab78c363ee2c08a17f3c89a8003cd05c8af8f13 (diff) | |
download | zabbix-024d1de15b266f8c7536c79657d5940ae9292689.tar.gz zabbix-024d1de15b266f8c7536c79657d5940ae9292689.tar.xz zabbix-024d1de15b266f8c7536c79657d5940ae9292689.zip |
- [ZBX-203] changed output result in "Availability Report" (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5151 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/php/include/reports.inc.php | 14 | ||||
-rw-r--r-- | frontends/php/report2.php | 22 |
2 files changed, 22 insertions, 14 deletions
diff --git a/frontends/php/include/reports.inc.php b/frontends/php/include/reports.inc.php index 418cf451..2a3d1a6f 100644 --- a/frontends/php/include/reports.inc.php +++ b/frontends/php/include/reports.inc.php @@ -93,7 +93,7 @@ function show_report2_header($config,$available_hosts){ } } - + $result=DBselect($sql); while($row=DBfetch($result)){ if(0 == $config){ @@ -112,25 +112,27 @@ function show_report2_header($config,$available_hosts){ $r_form->AddItem(array(SPACE.S_TEMPLATE.SPACE,$cmbTpls)); if($_REQUEST['hostid'] > 0){ $sql = 'SELECT DISTINCT t.triggerid,t.description '. - ' FROM triggers t,hosts h,items i,functions f '. + ' FROM triggers t,hosts h,items i,functions f,hosts_templates ht '. ' WHERE f.itemid=i.itemid '. ' AND h.hostid=i.hostid '. + ' AND h.hostid=ht.hostid '. ' AND t.status='.TRIGGER_STATUS_ENABLED. ' AND t.triggerid=f.triggerid '. - ' AND h.hostid='.$_REQUEST['hostid']. - ' AND h.status='.HOST_STATUS_TEMPLATE. + ' AND ht.templateid='.$_REQUEST['hostid']. + ' AND h.status='.HOST_STATUS_MONITORED. ' AND '.DBin_node('t.triggerid'). ' AND i.status='.ITEM_STATUS_ACTIVE. ' ORDER BY t.description'; } else{ $sql = 'SELECT DISTINCT t.triggerid,t.description '. - ' FROM triggers t,hosts h,items i,functions f '. + ' FROM triggers t,hosts h,items i,functions f,hosts_templates ht '. ' WHERE f.itemid=i.itemid '. ' AND h.hostid=i.hostid '. + ' AND h.hostid=ht.hostid '. ' AND t.status='.TRIGGER_STATUS_ENABLED. ' AND t.triggerid=f.triggerid '. - ' AND h.status='.HOST_STATUS_TEMPLATE. + ' AND h.status='.HOST_STATUS_MONITORED. ' AND h.hostid in ('.$available_hosts.')'. ' AND '.DBin_node('t.triggerid'). ' AND i.status='.ITEM_STATUS_ACTIVE. diff --git a/frontends/php/report2.php b/frontends/php/report2.php index 20ff8778..0ac68ad0 100644 --- a/frontends/php/report2.php +++ b/frontends/php/report2.php @@ -87,10 +87,15 @@ show_report2_header($config,$available_hosts); } else if(isset($_REQUEST['hostid'])){ if(0 == $config){ - $sql_cond = ' AND h.status='.HOST_STATUS_MONITORED; + if($_REQUEST['hostid'] > 0) + $sql_cond = ' AND h.hostid='.$_REQUEST['hostid']; + else + $sql_cond = ''; } else{ - $sql_cond = ' AND h.status='.HOST_STATUS_TEMPLATE; + $sql_cond = ' AND h.hostid=ht.hostid '; + if($_REQUEST['hostid'] > 0) $sql_cond.=' AND ht.templateid='.$_REQUEST['hostid']; + if(isset($_REQUEST['tpl_triggerid']) && ($_REQUEST['tpl_triggerid'] > 0)) $sql_cond.= ' AND t.triggerid='.$_REQUEST['tpl_triggerid']; } @@ -100,25 +105,25 @@ show_report2_header($config,$available_hosts); show_table_header($row['host']); $result = DBselect('SELECT DISTINCT h.hostid,h.host,t.triggerid,t.expression,t.description,t.value '. - ' FROM triggers t,hosts h,items i,functions f '. + ' FROM triggers t,hosts h,items i,functions f, hosts_templates ht '. ' WHERE f.itemid=i.itemid '. ' AND h.hostid=i.hostid '. ' AND t.status='.TRIGGER_STATUS_ENABLED. ' AND t.triggerid=f.triggerid '. - ' AND h.hostid='.$_REQUEST['hostid']. ' AND '.DBin_node('t.triggerid'). ' AND i.status='.ITEM_STATUS_ACTIVE. + ' AND h.status='.HOST_STATUS_MONITORED. $sql_cond. ' ORDER BY h.host, t.description'); } else{ if(isset($_REQUEST['tpl_triggerid']) && ($_REQUEST['tpl_triggerid'] > 0)) show_table_header(expand_trigger_description($_REQUEST['tpl_triggerid'])); - else show_table_header(S_ALL_HOSTS_BIG); + $result = DBselect('SELECT DISTINCT h.hostid,h.host,t.triggerid,t.expression,t.description,t.value '. - ' FROM triggers t,hosts h,items i,functions f '. + ' FROM triggers t,hosts h,items i,functions f, hosts_templates ht '. ' WHERE f.itemid=i.itemid '. ' AND h.hostid=i.hostid '. ' AND t.status='.TRIGGER_STATUS_ENABLED. @@ -126,6 +131,7 @@ show_report2_header($config,$available_hosts); ' AND h.hostid in ('.$available_hosts.')'. ' AND '.DBin_node('t.triggerid'). ' AND i.status='.ITEM_STATUS_ACTIVE. + ' AND h.status='.HOST_STATUS_MONITORED. $sql_cond. ' ORDER BY h.host, t.description'); } @@ -133,7 +139,7 @@ show_report2_header($config,$available_hosts); $accessible_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY); $table = new CTableInfo(); - $table->setHeader(array(is_show_subnodes() ? S_NODE : null,($_REQUEST['hostid'] == 0)?S_HOST:NULL, S_NAME,S_TRUE,S_FALSE,S_UNKNOWN,S_GRAPH)); + $table->setHeader(array(is_show_subnodes() ? S_NODE : null,(($_REQUEST['hostid'] == 0) || (1 == $config))?S_HOST:NULL, S_NAME,S_TRUE,S_FALSE,S_UNKNOWN,S_GRAPH)); while($row=DBfetch($result)){ if(!check_right_on_trigger_by_triggerid(null, $row['triggerid'], $accessible_hosts)) continue; @@ -146,7 +152,7 @@ show_report2_header($config,$available_hosts); $table->addRow(array( get_node_name_by_elid($row['hostid']), - ($_REQUEST['hostid'] == 0)?$row['host']:NULL, + (($_REQUEST['hostid'] == 0) || (1 == $config))?$row['host']:NULL, new CLink( expand_trigger_description_by_data($row), 'events.php?triggerid='.$row['triggerid'],'action'), |