Esempio n. 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';
Esempio n. 2
0
//------------------------------------- <HISTORY> ---------------------------------------
if (isset($page['hist_arg']) && $USER_DETAILS['alias'] != ZBX_GUEST_USER && $page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) {
    add_user_history($page);
}
//------------------------------------- </HISTORY> --------------------------------------
show_messages();
$post_script = '';
if ($page['type'] == PAGE_TYPE_HTML) {
    $post_script .= 'function zbxCallPostScripts(){' . "\n";
    if (isset($ZBX_PAGE_POST_JS)) {
        foreach ($ZBX_PAGE_POST_JS as $num => $script) {
            $post_script .= $script . "\n";
        }
    }
    $post_script .= '}' . "\n";
    //		$post_script.= 'try{ chkbxRange.init(); } catch(e){ throw("Checkbox extension failed!");}';
    $post_script .= 'chkbxRange.init();';
    insert_js($post_script);
    if (!defined('ZBX_PAGE_NO_MENU') && !defined('ZBX_PAGE_NO_FOOTER')) {
        $table = new CTable(NULL, "page_footer");
        $table->setCellSpacing(0);
        $table->setCellPadding(1);
        $table->AddRow(array(new CCol(new CLink(S_ZABBIX . SPACE . ZABBIX_VERSION . SPACE . S_COPYRIGHT_BY . SPACE . S_SIA_ZABBIX, 'http://www.zabbix.com', 'highlight', null, true), 'page_footer_l'), new CCol(array(new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), new CSpan($USER_DETAILS['userid'] == 0 ? S_NOT_CONNECTED : S_CONNECTED_AS . SPACE . "'" . $USER_DETAILS['alias'] . "'" . (ZBX_DISTRIBUTED ? SPACE . S_FROM_SMALL . SPACE . "'" . $USER_DETAILS['node']['name'] . "'" : ''), 'footer_sign')), "page_footer_r")));
        $table->Show();
    }
    COpt::profiling_stop("script");
    print '<!--' . "\n" . 'SELECTS: ' . $DB['SELECT_COUNT'] . "\n" . 'EXECUTE: ' . $DB['EXECUTE_COUNT'] . "\n" . 'TOTAL: ' . ($DB['EXECUTE_COUNT'] + $DB['SELECT_COUNT']) . "\n" . '-->';
    echo "</body>\n";
    echo "</html>\n";
}
exit;
Esempio n. 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;
}
Esempio n. 4
0
                }
                if (!isset($_REQUEST["plaintext"])) {
                    $table->ShowRow($new_row);
                } else {
                    echo date("Y-m-d H:i:s", $row["clock"]);
                    echo "\t" . $row["clock"] . "\t" . htmlspecialchars($row["value"]) . "\n";
                }
            }
            if (!isset($_REQUEST["plaintext"])) {
                $table->ShowEnd();
                // to solve memory leak we call 'Show' method by steps
                echo SBR;
            } else {
                echo "</pre>";
            }
            COpt::profiling_stop("history");
        }
    }
}
if (!isset($_REQUEST["plaintext"])) {
    if (str_in_array($_REQUEST["action"], array("showvalues", "showgraph"))) {
        $stime = get_min_itemclock_by_itemid($_REQUEST["itemid"]);
        $stime = is_null($stime) ? 0 : $stime;
        $bstime = time() - $effectiveperiod;
        if (isset($_REQUEST['stime'])) {
            $bstime = $_REQUEST['stime'];
            $bstime = mktime(substr($bstime, 8, 2), substr($bstime, 10, 2), 0, substr($bstime, 4, 2), substr($bstime, 6, 2), substr($bstime, 0, 4));
        }
        $script = 'scrollinit(0,' . $effectiveperiod . ',' . $stime . ',0,' . $bstime . ');
						showgraphmenu("graph");';
        if (isset($dom_graph_id)) {
Esempio n. 5
0
                }
                if (!isset($_REQUEST['plaintext'])) {
                    $table->ShowRow($new_row);
                } else {
                    echo date('Y-m-d H:i:s', $row['clock']);
                    echo "\t" . $row['clock'] . "\t" . htmlspecialchars($row['value']) . "\n";
                }
            }
            if (!isset($_REQUEST['plaintext'])) {
                $table->ShowEnd();
                // to solve memory leak we call 'Show' method by steps
                echo SBR;
            } else {
                echo '</pre></span>';
            }
            COpt::profiling_stop('history');
        }
    }
}
if (!isset($_REQUEST['plaintext'])) {
    if (str_in_array($_REQUEST['action'], array('showvalues', 'showgraph'))) {
        $stime = get_min_itemclock_by_itemid($_REQUEST['itemid']);
        $stime = is_null($stime) ? 0 : $stime;
        $bstime = time() - $effectiveperiod;
        if (isset($_REQUEST['stime'])) {
            $bstime = $_REQUEST['stime'];
            $bstime = mktime(substr($bstime, 8, 2), substr($bstime, 10, 2), 0, substr($bstime, 4, 2), substr($bstime, 6, 2), substr($bstime, 0, 4));
        }
        $script = 'scrollinit(0,' . $effectiveperiod . ',' . $stime . ',0,' . $bstime . '); showgraphmenu("graph");';
        if (isset($dom_graph_id)) {
            $script .= 'graph_zoom_init("' . $dom_graph_id . '",' . $bstime . ',' . $effectiveperiod . ',ZBX_G_WIDTH, 200, true);';
Esempio n. 6
0
// last page
if (!defined('ZBX_PAGE_NO_MENU') && $page['file'] != 'profile.php') {
    CProfile::update('web.paging.lastpage', $page['file'], PROFILE_TYPE_STR);
}
CProfile::flush();
// END Transactions if havn't been -----------------
if (isset($DB) && isset($DB['TRANSACTIONS']) && $DB['TRANSACTIONS'] != 0) {
    error(S_TRANSACTION_HAVE_NOT_BEEN_CLOSED_ABORTING);
    DBend(false);
}
//--------------------------------------------------
show_messages();
$post_script = '';
if (uint_in_array($page['type'], array(PAGE_TYPE_HTML_BLOCK, PAGE_TYPE_HTML))) {
    if (!is_null($USER_DETAILS) && isset($USER_DETAILS['debug_mode']) && $USER_DETAILS['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) {
        COpt::profiling_stop('script');
        COpt::show();
    }
}
if ($page['type'] == PAGE_TYPE_HTML) {
    $post_script .= 'var page_refresh = null;' . "\n";
    if (isset($JS_TRANSLATE)) {
        $post_script .= 'var newLocale = ' . zbx_jsvalue($JS_TRANSLATE) . "\n";
        $post_script .= 'var locale = (typeof(locale) == "undefined" ? {} : locale);' . "\n";
        $post_script .= 'for(key in newLocale){locale[key] = newLocale[key];}' . "\n";
    }
    $post_script .= 'function zbxCallPostScripts(){' . "\n";
    if (isset($ZBX_PAGE_POST_JS)) {
        foreach ($ZBX_PAGE_POST_JS as $num => $script) {
            $post_script .= $script . "\n";
        }