예제 #1
0
// Header
$url = 'overview.php?fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1');
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->setAttribute('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
$fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
$over_wdgt->addHeader(S_OVERVIEW_BIG, array($fs_icon, $help));
// 2nd heder
$form_l = new CForm();
$form_l->setMethod('get');
$form_l->addVar('groupid', $_REQUEST['groupid']);
$cmbStyle = new CComboBox('view_style', $_REQUEST['view_style'], 'submit()');
$cmbStyle->addItem(STYLE_TOP, S_TOP);
$cmbStyle->addItem(STYLE_LEFT, S_LEFT);
$form_l->additem(array(S_HOSTS_LOCATION . SPACE, $cmbStyle));
$over_wdgt->addHeader($form_l, $form);
//	show_table_header(S_OVERVIEW_BIG,$form);
//-------------
if ($_REQUEST['type'] == SHOW_DATA) {
    COpt::profiling_start('get_items_data_overview');
    $table = get_items_data_overview($PAGE_HOSTS['hostids'], $_REQUEST['view_style']);
    COpt::profiling_stop('get_items_data_overview');
} else {
    if ($_REQUEST['type'] == SHOW_TRIGGERS) {
        COpt::profiling_start('get_triggers_overview');
        $table = get_triggers_overview($PAGE_HOSTS['hostids'], $_REQUEST['view_style']);
        COpt::profiling_stop('get_triggers_overview');
    }
}
$over_wdgt->addItem($table);
$over_wdgt->show();
include_once 'include/page_footer.php';
예제 #2
0
파일: copt.lib.php 프로젝트: rennhak/zabbix
                }
                foreach ($result as $level => $files_list) {
                    if (defined('USE_MENU_DETAILS')) {
                        echo OBR . '(menu check) [' . $level . OBR;
                        foreach ($files_list as $file => $menu_list) {
                            echo '(menu check)' . SPACE . SPACE . SPACE . SPACE . $file . ' {' . implode(',', $menu_list) . '}' . OBR;
                        }
                    } else {
                        echo OBR . '(menu check) [' . $level . '] = ' . count($files_list) . OBR;
                    }
                }
            }
        }
    }
    COpt::set_memory_limit('32M');
    COpt::profiling_start('script');
} else {
    $static = null;
    if (version_compare(phpversion(), '5.0', '>=')) {
        $static = 'static';
    }
    eval('
	class COpt
	{
		' . $static . ' function profiling_start($type=NULL) {}
		' . $static . ' function profiling_stop($type=NULL) {}
		' . $static . ' function savesqlrequest($sql) {}
		' . $static . ' function showmemoryusage($descr=null) {}
		' . $static . ' function compare_files_with_menu($menu=null) {}
		' . $static . ' function counter_up($type=NULL) {}
	}');
예제 #3
0
function get_items_data_overview($hostids, $view_style = null)
{
    if (is_null($view_style)) {
        $view_style = get_profile('web.overview.view.style', STYLE_TOP);
    }
    $table = new CTableInfo(S_NO_ITEMS_DEFINED);
    COpt::profiling_start('prepare data');
    $result = DBselect('SELECT DISTINCT h.hostid, h.host,i.itemid, i.key_, i.value_type, i.lastvalue, i.units, ' . ' i.description, t.priority, i.valuemapid, t.value as tr_value, t.triggerid ' . ' FROM hosts h, items i ' . ' LEFT JOIN functions f on f.itemid=i.itemid ' . ' LEFT JOIN triggers t on t.triggerid=f.triggerid ' . ' WHERE ' . DBcondition('h.hostid', $hostids) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' ORDER BY i.description,i.itemid');
    unset($items);
    unset($hosts);
    // get rid of warnings about $triggers undefined
    $items = array();
    while ($row = DBfetch($result)) {
        $descr = item_description($row);
        $row['host'] = get_node_name_by_elid($row['hostid']) . $row['host'];
        $hosts[strtolower($row['host'])] = $row['host'];
        // A little tricky check for attempt to overwrite active trigger (value=1) with
        // inactive or active trigger with lower priority.
        if (!isset($items[$descr][$row['host']]) || ($items[$descr][$row['host']]['tr_value'] == TRIGGER_VALUE_FALSE && $row['tr_value'] == TRIGGER_VALUE_TRUE || ($items[$descr][$row['host']]['tr_value'] == TRIGGER_VALUE_FALSE || $row['tr_value'] == TRIGGER_VALUE_TRUE) && $row['priority'] > $items[$descr][$row['host']]['severity'])) {
            $items[$descr][$row['host']] = array('itemid' => $row['itemid'], 'value_type' => $row['value_type'], 'lastvalue' => $row['lastvalue'], 'units' => $row['units'], 'description' => $row['description'], 'valuemapid' => $row['valuemapid'], 'severity' => $row['priority'], 'tr_value' => $row['tr_value'], 'triggerid' => $row['triggerid']);
        }
    }
    if (!isset($hosts)) {
        return $table;
    }
    ksort($hosts);
    COpt::profiling_stop('prepare data');
    COpt::profiling_start('prepare table');
    if ($view_style == STYLE_TOP) {
        $header = array(new CCol(S_ITEMS, 'center'));
        foreach ($hosts as $hostname) {
            $header = array_merge($header, array(new CImg('vtext.php?text=' . $hostname)));
        }
        $table->SetHeader($header, 'vertical_header');
        $curr_rime = time();
        foreach ($items as $descr => $ithosts) {
            $table_row = array(nbsp($descr));
            foreach ($hosts as $hostname) {
                $table_row = get_item_data_overview_cells($table_row, $ithosts, $hostname);
            }
            $table->AddRow($table_row);
        }
    } else {
        $header = array(new CCol(S_HOSTS, 'center'));
        foreach ($items as $descr => $ithosts) {
            $header = array_merge($header, array(new CImg('vtext.php?text=' . $descr)));
        }
        $table->SetHeader($header, 'vertical_header');
        $curr_rime = time();
        foreach ($hosts as $hostname) {
            $table_row = array(nbsp($hostname));
            foreach ($items as $descr => $ithosts) {
                $table_row = get_item_data_overview_cells($table_row, $ithosts, $hostname);
            }
            $table->AddRow($table_row);
        }
    }
    COpt::profiling_stop('prepare table');
    return $table;
}
예제 #4
0
파일: history.php 프로젝트: rennhak/zabbix
         $h_table = "history_text";
         break;
     default:
         $h_table = "history_str";
 }
 $result = DBselect('SELECT h.clock,h.value,i.valuemapid ' . ' FROM ' . $h_table . ' h, items i ' . ' WHERE h.itemid=i.itemid ' . ' AND i.itemid=' . $_REQUEST['itemid'] . $cond_clock . ' ORDER BY clock desc', $limit);
 if (!isset($_REQUEST["plaintext"])) {
     $table = new CTableInfo();
     $table->SetHeader(array(S_TIMESTAMP, S_VALUE));
     $table->AddOption('id', 'graph');
     $table->ShowStart();
     // to solve memory leak we call 'Show' method by steps
 } else {
     echo "<pre>\n";
 }
 COpt::profiling_start("history");
 while ($row = DBfetch($result)) {
     if ($DB['TYPE'] == "ORACLE" && $item_type == ITEM_VALUE_TYPE_TEXT) {
         if (isset($row["value"])) {
             $row["value"] = $row["value"]->load();
         } else {
             $row["value"] = "";
         }
     }
     if ($row["valuemapid"] > 0) {
         $value = replace_value_by_map($row["value"], $row["valuemapid"]);
     } else {
         $value = $row["value"];
     }
     $new_row = array(date("Y.M.d H:i:s", $row["clock"]));
     if (str_in_array($item_type, array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64))) {
예제 #5
0
파일: history.php 프로젝트: phedders/zabbix
         break;
     default:
         $h_table = 'history_str';
 }
 $sql = 'SELECT h.clock,h.value,i.valuemapid ' . ' FROM ' . $h_table . ' h, items i ' . ' WHERE h.itemid=i.itemid ' . ' AND i.itemid=' . $_REQUEST['itemid'] . $cond_clock . ' ORDER BY clock desc';
 $result = DBselect($sql, $limit);
 if (!isset($_REQUEST['plaintext'])) {
     $table = new CTableInfo();
     $table->setHeader(array(S_TIMESTAMP, S_VALUE));
     $table->setAttribute('id', 'graph');
     $table->ShowStart();
     // to solve memory leak we call 'Show' method by steps
 } else {
     echo '<span class="textcolorstyles"><pre>' . "\n";
 }
 COpt::profiling_start('history');
 while ($row = DBfetch($result)) {
     if ($DB['TYPE'] == 'ORACLE' && $item_type == ITEM_VALUE_TYPE_TEXT) {
         if (isset($row['value'])) {
             $row['value'] = $row['value']->load();
         } else {
             $row['value'] = '';
         }
     }
     if ($row['valuemapid'] > 0) {
         $value = replace_value_by_map($row['value'], $row['valuemapid']);
     } else {
         $value = $row['value'];
     }
     $new_row = array(date('Y.M.d H:i:s', $row['clock']));
     if (str_in_array($item_type, array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64))) {
예제 #6
0
** 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.
**/
require_once 'include/config.inc.php';
require_once 'include/perm.inc.php';
global $USER_DETAILS;
global $ZBX_LOCALNODEID, $ZBX_LOCMASTERID;
global $ZBX_CURMASTERID;
global $page;
COpt::profiling_start("page");
unset($denyed_page_requested);
if (!isset($page['type'])) {
    $page['type'] = PAGE_TYPE_HTML;
}
if (!isset($page['file'])) {
    $page['file'] = basename($_SERVER['PHP_SELF']);
}
if ($_REQUEST['fullscreen'] = get_request('fullscreen', 0)) {
    define('ZBX_PAGE_NO_MENU', 1);
}
include_once 'include/locales/en_gb.inc.php';
process_locales();
set_zbx_locales();
/* Init CURRENT NODE ID */
init_nodes();