Esempio n. 1
0
    if (isset($page['scripts']) && is_array($page['scripts'])) {
        foreach ($page['scripts'] as $id => $script) {
            print '    <script type="text/javascript" src="js/' . $script . '"></script>' . "\n";
        }
    }
    ?>
</head>
<body onload="zbxCallPostScripts();">
<?php 
}
define('PAGE_HEADER_LOADED', 1);
if (isset($_REQUEST['print'])) {
    define('ZBX_PAGE_NO_MENU', 1);
    $req = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'print') - 1);
    $link = new CLink(bold('&laquo;' . S_BACK_BIG), $req, 'small_font');
    $link->addOption('style', 'padding-left: 10px;');
    $printview = new CDiv($link, 'printless');
    $printview->addOption('style', 'border: 1px #333 dotted;');
    $printview->Show();
}
if (!defined('ZBX_PAGE_NO_MENU')) {
    COpt::compare_files_with_menu($ZBX_MENU);
    $help = new CLink(S_HELP, 'http://www.zabbix.com/documentation.php', 'small_font', null, true);
    $help->setTarget('_blank');
    $support = new CLink(S_GET_SUPPORT, 'http://www.zabbix.com/support.php', 'small_font', null, true);
    $support->setTarget('_blank');
    $printview = new CLink(S_PRINT, $_SERVER['REQUEST_URI'] . (empty($_GET) ? '?' : '&') . 'print=1', 'small_font');
    $page_header_r_col = array($help, '|', $support, '|', $printview);
    if ($USER_DETAILS['alias'] != ZBX_GUEST_USER) {
        $page_header_r_col[] = array('|', new CLink(S_PROFILE, 'profile.php', 'small_font'), '|', new CLink(S_LOGOUT, 'index.php?reconnect=1', 'small_font'));
    } else {
Esempio n. 2
0
function insert_mass_update_item_form($elements_array_name)
{
    global $USER_DETAILS;
    $frmItem = new CFormTable(S_ITEM, null, 'post');
    $frmItem->SetHelp('web.items.item.php');
    $frmItem->SetTitle(S_MASS_UPDATE);
    $frmItem->addVar('form_mass_update', 1);
    $frmItem->addVar('group_itemid', get_request('group_itemid', array()));
    $frmItem->addVar('config', get_request('config', 0));
    if ($_REQUEST['groupid'] > 0) {
        $frmItem->addVar('groupid', $_REQUEST['groupid']);
    }
    $frmItem->addVar('hostid', $_REQUEST['hostid']);
    $description = get_request('description', '');
    $key = get_request('key', '');
    $host = get_request('host', null);
    $delay = get_request('delay', 30);
    $history = get_request('history', 90);
    $status = get_request('status', 0);
    $type = get_request('type', 0);
    $snmp_community = get_request('snmp_community', 'public');
    $snmp_oid = get_request('snmp_oid', 'interfaces.ifTable.ifEntry.ifInOctets.1');
    $snmp_port = get_request('snmp_port', 161);
    $value_type = get_request('value_type', ITEM_VALUE_TYPE_UINT64);
    $data_type = get_request('data_type', ITEM_DATA_TYPE_DECIMAL);
    $trapper_hosts = get_request('trapper_hosts', '');
    $units = get_request('units', '');
    $valuemapid = get_request('valuemapid', 0);
    $delta = get_request('delta', 0);
    $trends = get_request('trends', 365);
    $applications = get_request('applications', array());
    $delay_flex = get_request('delay_flex', array());
    $snmpv3_securityname = get_request('snmpv3_securityname', '');
    $snmpv3_securitylevel = get_request('snmpv3_securitylevel', 0);
    $snmpv3_authpassphrase = get_request('snmpv3_authpassphrase', '');
    $snmpv3_privpassphrase = get_request('snmpv3_privpassphrase', '');
    $formula = get_request('formula', '1');
    $logtimefmt = get_request('logtimefmt', '');
    $add_groupid = get_request('add_groupid', get_request('groupid', 0));
    $delay_flex_el = array();
    $i = 0;
    foreach ($delay_flex as $val) {
        if (!isset($val['delay']) && !isset($val['period'])) {
            continue;
        }
        array_push($delay_flex_el, array(new CCheckBox('rem_delay_flex[]', 'no', null, $i), $val['delay'], ' sec at ', $val['period']), BR());
        $frmItem->addVar("delay_flex[" . $i . "][delay]", $val['delay']);
        $frmItem->addVar("delay_flex[" . $i . "][period]", $val['period']);
        $i++;
        if ($i >= 7) {
            break;
        }
        /* limit count of  intervals
         * 7 intervals by 30 symbols = 210 characters
         * db storage field is 256
         */
    }
    if (count($delay_flex_el) == 0) {
        array_push($delay_flex_el, "No flexible intervals");
    } else {
        array_push($delay_flex_el, new CButton('del_delay_flex', 'delete selected'));
    }
    if (count($applications) == 0) {
        array_push($applications, 0);
    }
    $cmbType = new CComboBox('type', $type);
    foreach (array(ITEM_TYPE_ZABBIX, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV1, ITEM_TYPE_SNMPV2C, ITEM_TYPE_SNMPV3, ITEM_TYPE_TRAPPER, ITEM_TYPE_INTERNAL, ITEM_TYPE_AGGREGATE, ITEM_TYPE_AGGREGATE, ITEM_TYPE_EXTERNAL, ITEM_TYPE_DB_MONITOR) as $it) {
        $cmbType->addItem($it, item_type2str($it));
    }
    $frmItem->addRow(array(new CVisibilityBox('type_visible', get_request('type_visible'), 'type', S_ORIGINAL), S_TYPE), $cmbType);
    $frmItem->addRow(array(new CVisibilityBox('community_visible', get_request('community_visible'), 'snmp_community', S_ORIGINAL), S_SNMP_COMMUNITY), new CTextBox('snmp_community', $snmp_community, 16));
    $frmItem->addRow(array(new CVisibilityBox('securityname_visible', get_request('securityname_visible'), 'snmpv3_securityname', S_ORIGINAL), S_SNMPV3_SECURITY_NAME), new CTextBox('snmpv3_securityname', $snmpv3_securityname, 64));
    $cmbSecLevel = new CComboBox('snmpv3_securitylevel', $snmpv3_securitylevel);
    $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV, "NoAuthPriv");
    $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV, "AuthNoPriv");
    $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV, "AuthPriv");
    $frmItem->addRow(array(new CVisibilityBox('securitylevel_visible', get_request('securitylevel_visible'), 'snmpv3_securitylevel', S_ORIGINAL), S_SNMPV3_SECURITY_LEVEL), $cmbSecLevel);
    $frmItem->addRow(array(new CVisibilityBox('authpassphrase_visible', get_request('authpassphrase_visible'), 'snmpv3_authpassphrase', S_ORIGINAL), S_SNMPV3_AUTH_PASSPHRASE), new CTextBox('snmpv3_authpassphrase', $snmpv3_authpassphrase, 64));
    $frmItem->addRow(array(new CVisibilityBox('privpassphras_visible', get_request('privpassphras_visible'), 'snmpv3_privpassphrase', S_ORIGINAL), S_SNMPV3_PRIV_PASSPHRASE), new CTextBox('snmpv3_privpassphrase', $snmpv3_privpassphrase, 64));
    $frmItem->addRow(array(new CVisibilityBox('port_visible', get_request('port_visible'), 'snmp_port', S_ORIGINAL), S_SNMP_PORT), new CNumericBox('snmp_port', $snmp_port, 5));
    $cmbValType = new CComboBox('value_type', $value_type);
    $cmbValType->AddItem(ITEM_VALUE_TYPE_UINT64, S_NUMERIC_UNSIGNED);
    $cmbValType->AddItem(ITEM_VALUE_TYPE_FLOAT, S_NUMERIC_FLOAT);
    $cmbValType->AddItem(ITEM_VALUE_TYPE_STR, S_CHARACTER);
    $cmbValType->AddItem(ITEM_VALUE_TYPE_LOG, S_LOG);
    $cmbValType->AddItem(ITEM_VALUE_TYPE_TEXT, S_TEXT);
    $frmItem->AddRow(array(new CVisibilityBox('value_type_visible', get_request('value_type_visible'), 'value_type', S_ORIGINAL), S_TYPE_OF_INFORMATION), $cmbValType);
    $cmbDataType = new CComboBox('data_type', $data_type);
    $cmbDataType->addItem(ITEM_DATA_TYPE_DECIMAL, item_data_type2str(ITEM_DATA_TYPE_DECIMAL));
    $cmbDataType->addItem(ITEM_DATA_TYPE_OCTAL, item_data_type2str(ITEM_DATA_TYPE_OCTAL));
    $cmbDataType->addItem(ITEM_DATA_TYPE_HEXADECIMAL, item_data_type2str(ITEM_DATA_TYPE_HEXADECIMAL));
    $frmItem->addRow(array(new CVisibilityBox('data_type_visible', get_request('data_type_visible'), 'data_type', S_ORIGINAL), S_DATA_TYPE), $cmbDataType);
    $frmItem->addRow(array(new CVisibilityBox('units_visible', get_request('units_visible'), 'units', S_ORIGINAL), S_UNITS), new CTextBox('units', $units, 40));
    $frmItem->addRow(array(new CVisibilityBox('formula_visible', get_request('formula_visible'), 'formula', S_ORIGINAL), S_CUSTOM_MULTIPLIER . ' (0 - ' . S_DISABLED . ')'), new CTextBox('formula', $formula, 40));
    $frmItem->addRow(array(new CVisibilityBox('delay_visible', get_request('delay_visible'), 'delay', S_ORIGINAL), S_UPDATE_INTERVAL_IN_SEC), new CNumericBox('delay', $delay, 5));
    $delay_flex_el = new CSpan($delay_flex_el);
    $delay_flex_el->addOption('id', 'delay_flex_list');
    $frmItem->addRow(array(new CVisibilityBox('delay_flex_visible', get_request('delay_flex_visible'), array('delay_flex_list', 'new_delay_flex_el'), S_ORIGINAL), S_FLEXIBLE_INTERVALS), $delay_flex_el);
    $new_delay_flex_el = new CSpan(array(S_DELAY, SPACE, new CNumericBox("new_delay_flex[delay]", "50", 5), S_PERIOD, SPACE, new CTextBox("new_delay_flex[period]", "1-7,00:00-23:59", 27), BR(), new CButton("add_delay_flex", S_ADD)));
    $new_delay_flex_el->addOption('id', 'new_delay_flex_el');
    $frmItem->addRow(S_NEW_FLEXIBLE_INTERVAL, $new_delay_flex_el, 'new');
    $frmItem->addRow(array(new CVisibilityBox('history_visible', get_request('history_visible'), 'history', S_ORIGINAL), S_KEEP_HISTORY_IN_DAYS), new CNumericBox('history', $history, 8));
    $frmItem->addRow(array(new CVisibilityBox('trends_visible', get_request('trends_visible'), 'trends', S_ORIGINAL), S_KEEP_TRENDS_IN_DAYS), new CNumericBox('trends', $trends, 8));
    $cmbStatus = new CComboBox('status', $status);
    foreach (array(ITEM_STATUS_ACTIVE, ITEM_STATUS_DISABLED, ITEM_STATUS_NOTSUPPORTED) as $st) {
        $cmbStatus->addItem($st, item_status2str($st));
    }
    $frmItem->addRow(array(new CVisibilityBox('status_visible', get_request('status_visible'), 'status', S_ORIGINAL), S_STATUS), $cmbStatus);
    $frmItem->addRow(array(new CVisibilityBox('logtimefmt_visible', get_request('logtimefmt_visible'), 'logtimefmt', S_ORIGINAL), S_LOG_TIME_FORMAT), new CTextBox("logtimefmt", $logtimefmt, 16));
    $cmbDelta = new CComboBox('delta', $delta);
    $cmbDelta->addItem(0, S_AS_IS);
    $cmbDelta->addItem(1, S_DELTA_SPEED_PER_SECOND);
    $cmbDelta->addItem(2, S_DELTA_SIMPLE_CHANGE);
    $frmItem->addRow(array(new CVisibilityBox('delta_visible', get_request('delta_visible'), 'delta', S_ORIGINAL), S_STORE_VALUE), $cmbDelta);
    $cmbMap = new CComboBox('valuemapid', $valuemapid);
    $cmbMap->addItem(0, S_AS_IS);
    $db_valuemaps = DBselect('SELECT * FROM valuemaps WHERE ' . DBin_node('valuemapid'));
    while ($db_valuemap = DBfetch($db_valuemaps)) {
        $cmbMap->addItem($db_valuemap["valuemapid"], get_node_name_by_elid($db_valuemap["valuemapid"]) . $db_valuemap["name"]);
    }
    $link = new CLink("throw map", "config.php?config=6", "action");
    $link->addOption("target", "_blank");
    $frmItem->addRow(array(new CVisibilityBox('valuemapid_visible', get_request('valuemapid_visible'), 'valuemapid', S_ORIGINAL), S_SHOW_VALUE, SPACE, $link), $cmbMap);
    $frmItem->addRow(array(new CVisibilityBox('trapper_hosts_visible', get_request('trapper_hosts_visible'), 'trapper_hosts', S_ORIGINAL), S_ALLOWED_HOSTS), new CTextBox('trapper_hosts', $trapper_hosts, 40));
    $cmbApps = new CListBox('applications[]', $applications, 6);
    $cmbApps->addItem(0, "-" . S_NONE . "-");
    $db_applications = DBselect("SELECT DISTINCT applicationid,name FROM applications" . " WHERE hostid=" . $_REQUEST['hostid'] . " order by name");
    while ($db_app = DBfetch($db_applications)) {
        $cmbApps->addItem($db_app["applicationid"], $db_app["name"]);
    }
    $frmItem->addRow(array(new CVisibilityBox('applications_visible', get_request('applications_visible'), 'applications[]', S_ORIGINAL), S_APPLICATIONS), $cmbApps);
    $frmItem->addItemToBottomRow(array(new CButton("update", S_UPDATE), SPACE, new CButtonCancel(url_param('groupid') . url_param("hostid") . url_param("config"))));
    $frmItem->Show();
}
Esempio n. 3
0
 $dep_res = DBselect($sql_dep);
 while ($dep_row = DBfetch($dep_res)) {
     $dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_down']));
     $dependency = true;
 }
 if ($dependency) {
     $img = new Cimg('images/general/up_icon.png', 'DEP_UP');
     $img->addOption('style', 'vertical-align: middle; border: 0px;');
     $img->SetHint($dep_table);
     $description = array($img, SPACE, $description);
 }
 unset($img, $dep_table, $dependency);
 //------------------------
 if (time(NULL) - $row['lastchange'] < TRIGGER_BLINK_PERIOD) {
     $tr_status = new CLink(trigger_value2str($row['value']));
     $tr_status->addOption('name', 'blink');
 } else {
     $tr_status = trigger_value2str($row['value']);
 }
 $value = new CSpan($tr_status, get_trigger_value_style($row['value']));
 if ($_REQUEST['show_actions']) {
     $actions = array(new CLink(S_CHANGE, 'triggers.php?form=update&triggerid=' . $row['triggerid'] . url_param('hostid'), 'action'));
 } else {
     $actions = NULL;
 }
 // JS menu
 $host = null;
 if ($_REQUEST['hostid'] < 1) {
     $menus = '';
     $host_nodeid = id2nodeid($row['hostid']);
     foreach ($scripts_by_hosts[$row['hostid']] as $id => $script) {