Beispiel #1
0
function make_acktab_by_eventid($eventid)
{
    $table = new CTableInfo();
    $table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
    $acks = get_acknowledges_by_eventid($eventid);
    while ($ack = DBfetch($acks)) {
        $user = get_user_by_userid($ack['userid']);
        $table->AddRow(array(date('d-m-Y h:i:s A', $ack['clock']), $user['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
    }
    return $table;
}
Beispiel #2
0
                continue;
            }
            $table->AddRow(array(new CLink($row["name"], "?config=0&form=update&screenid=" . $row["screenid"], 'action'), $row["hsize"] . " x " . $row["vsize"], new CLink(S_EDIT, "screenedit.php?screenid=" . $row["screenid"])));
            $row_count++;
        }
        $table->Show();
    }
} else {
    if (isset($_REQUEST["form"])) {
        insert_slideshow_form();
    } else {
        $row_count = 0;
        $numrows = new CSpan(null, 'info');
        $numrows->addOption('name', 'numrows');
        $header = get_table_header(array(S_SLIDESHOWS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
        show_table_header($header);
        $table = new CTableInfo(S_NO_SLIDESHOWS_DEFINED);
        $table->SetHeader(array(make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_DELAY, 's.delay'), make_sorting_link(S_COUNT_OF_SLIDES, 'cnt')));
        $db_slides = DBselect('SELECT s.slideshowid, s.name, s.delay, count(*) as cnt ' . ' FROM slideshows s ' . ' left join slides sl on sl.slideshowid=s.slideshowid ' . ' WHERE ' . DBin_node('s.slideshowid') . ' GROUP BY s.slideshowid,s.name,s.delay ' . order_by('s.name,s.delay,cnt', 's.slideshowid'));
        while ($slide_data = DBfetch($db_slides)) {
            if (!slideshow_accessible($slide_data['slideshowid'], PERM_READ_WRITE)) {
                continue;
            }
            $table->AddRow(array(new CLink($slide_data['name'], '?config=1&form=update&slideshowid=' . $slide_data['slideshowid'], 'action'), $slide_data['delay'], $slide_data['cnt']));
            $row_count++;
        }
        $table->Show();
    }
}
zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");');
include_once "include/page_footer.php";
Beispiel #3
0
        insert_slideshow_form();
    } else {
        $form = new CForm();
        $form->setName('frm_shows');
        $numrows = new CSpan(null, 'info');
        $numrows->setAttribute('name', 'numrows');
        $header = get_table_header(array(S_SLIDESHOWS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
        show_table_header($header);
        $table = new CTableInfo(S_NO_SLIDESHOWS_DEFINED);
        $table->SetHeader(array(new CCheckBox('all_shows', NULL, "checkAll('" . $form->getName() . "','all_shows','shows');"), make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_DELAY, 's.delay'), make_sorting_link(S_COUNT_OF_SLIDES, 'cnt')));
        $db_slides = DBselect('SELECT s.slideshowid, s.name, s.delay, count(*) as cnt ' . ' FROM slideshows s ' . ' left join slides sl on sl.slideshowid=s.slideshowid ' . ' WHERE ' . DBin_node('s.slideshowid') . ' GROUP BY s.slideshowid,s.name,s.delay ' . order_by('s.name,s.delay,cnt', 's.slideshowid'));
        while ($slide_data = DBfetch($db_slides)) {
            if (!slideshow_accessible($slide_data['slideshowid'], PERM_READ_WRITE)) {
                continue;
            }
            $table->AddRow(array(new CCheckBox('shows[' . $slide_data['slideshowid'] . ']', NULL, NULL, $slide_data['slideshowid']), new CLink($slide_data['name'], '?config=1&form=update&slideshowid=' . $slide_data['slideshowid'], 'action'), $slide_data['delay'], $slide_data['cnt']));
        }
        //----- GO ------
        $goBox = new CComboBox('go');
        $goBox->addItem('delete', S_DELETE_SELECTED);
        // goButton name is necessary!!!
        $goButton = new CButton('goButton', S_GO . ' (0)');
        $goButton->setAttribute('id', 'goButton');
        zbx_add_post_js('chkbxRange.pageGoName = "shows";');
        $table->setFooter(new CCol(array($goBox, $goButton)));
        $form->addItem($table);
        $form->show();
    }
}
if (isset($table)) {
    zbx_add_post_js('insert_in_element("numrows","' . $table->getNumRows() . '");');
function make_event_details($eventid)
{
    $config = select_config();
    $event = get_tr_event_by_eventid($eventid);
    $table = new CTableInfo();
    $table->AddRow(array(S_EVENT, expand_trigger_description($event['triggerid'])));
    $table->AddRow(array(S_TIME, zbx_date2str(S_EVENTS_EVENT_DETAILS_DATE_FORMAT, $event['clock'])));
    $duration = zbx_date2age($event['clock']);
    if ($next_event = get_next_event($event)) {
        $duration = zbx_date2age($event['clock'], $next_event['clock']);
    }
    if ($event['value'] == TRIGGER_VALUE_FALSE) {
        $value = new CCol(S_OK_BIG, 'off');
    } elseif ($event['value'] == TRIGGER_VALUE_TRUE) {
        $value = new CCol(S_PROBLEM_BIG, 'on');
    } else {
        $value = new CCol(S_UNKNOWN_BIG, 'unknown');
    }
    $table->addRow(array(S_STATUS, $value));
    $table->addRow(array(S_DURATION, $duration));
    if ($config['event_ack_enable']) {
        global $page;
        $backurl = urlencode(urlencode($page['file'] . '?eventid=' . $eventid . '&triggerid=' . $event['triggerid']));
        if ($event['acknowledged'] == 1) {
            $rows = 0;
            $db_acks = get_acknowledges_by_eventid($event["eventid"]);
            while ($a = DBfetch($db_acks)) {
                $rows++;
            }
            $ack = array(new CLink(S_YES, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $backurl, 'off'), ' (' . $rows . ')');
        } else {
            $ack = array(new CLink(S_NO, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $backurl, 'on'));
        }
        $table->addRow(array(S_ACKNOWLEDGED, $ack));
    }
    return $table;
}
Beispiel #5
0
if (isset($_REQUEST["form"])) {
    insert_map_form();
} else {
    $form = new CForm();
    $form->setName('frm_maps');
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_MAPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_MAPS_DEFINED);
    $table->SetHeader(array(new CCheckBox('all_maps', NULL, "checkAll('" . $form->getName() . "','all_maps','maps');"), make_sorting_link(S_NAME, 'sm.name'), make_sorting_link(S_WIDTH, 'sm.width'), make_sorting_link(S_HEIGHT, 'sm.height'), S_MAP));
    $result = DBselect('SELECT sm.sysmapid,sm.name,sm.width,sm.height ' . ' FROM sysmaps sm' . ' WHERE ' . DBin_node('sm.sysmapid') . order_by('sm.name,sm.width,sm.height', 'sm.sysmapid'));
    while ($row = DBfetch($result)) {
        if (!sysmap_accessible($row["sysmapid"], PERM_READ_WRITE)) {
            continue;
        }
        $table->AddRow(array(new CCheckBox('maps[' . $row['sysmapid'] . ']', NULL, NULL, $row['sysmapid']), new CLink($row["name"], "sysmaps.php?form=update" . "&sysmapid=" . $row["sysmapid"] . "#form", 'action'), $row["width"], $row["height"], new CLink(S_EDIT, "sysmap.php?sysmapid=" . $row["sysmapid"])));
    }
    //----- GO ------
    $goBox = new CComboBox('go');
    $goBox->addItem('delete', S_DELETE_SELECTED);
    // goButton name is necessary!!!
    $goButton = new CButton('goButton', S_GO . ' (0)');
    $goButton->setAttribute('id', 'goButton');
    zbx_add_post_js('chkbxRange.pageGoName = "maps";');
    $table->setFooter(new CCol(array($goBox, $goButton)));
    $form->addItem($table);
    $form->show();
    zbx_add_post_js('insert_in_element("numrows","' . $table->getNumRows() . '");');
}
include_once "include/page_footer.php";
Beispiel #6
0
    if (!isset($tab_rows[$appid])) {
        continue;
    }
    $app_rows = $tab_rows[$appid];
    if (uint_in_array($db_app['applicationid'], $_REQUEST['applications']) || isset($show_all_apps)) {
        $url = '?close=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('fullscreen') . url_param('select');
        $link = new CLink(new CImg('images/general/opened.gif'), $url);
        //			$link = new CLink(new CImg('images/general/opened.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');");
    } else {
        $url = '?open=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('fullscreen') . url_param('select');
        $link = new CLink(new CImg('images/general/closed.gif'), $url);
        //			$link = new CLink(new CImg('images/general/closed.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');");
    }
    $col = new CCol(array($link, SPACE, bold($db_app['name']), SPACE . '(' . $db_app['item_cnt'] . SPACE . S_ITEMS . ')'));
    $col->SetColSpan(5);
    $table->AddRow(array(get_node_name_by_elid($db_app['applicationid']), $_REQUEST['hostid'] > 0 ? NULL : $db_app['host'], $col));
    foreach ($app_rows as $row) {
        $table->AddRow($row);
    }
}
// OTHER ITEMS (which doesn't linked to application)
$db_hosts = array();
$db_hostids = array();
$sql = 'SELECT DISTINCT h.host,h.hostid ' . ' FROM hosts h' . $sql_from . ', items i ' . ' LEFT JOIN items_applications ia ON ia.itemid=i.itemid' . ' WHERE ia.itemid is NULL ' . $sql_where . ' AND h.hostid=i.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' ORDER BY h.host';
$db_host_res = DBselect($sql);
while ($db_host = DBfetch($db_host_res)) {
    $db_host['item_cnt'] = 0;
    $db_hosts[$db_host['hostid']] = $db_host;
    $db_hostids[$db_host['hostid']] = $db_host['hostid'];
}
$tab_rows = array();
Beispiel #7
0
    /* form */
    insert_drule_form();
} else {
    show_table_header(S_DISCOVERY_BIG);
    /* table */
    $form = new CForm();
    $form->SetName('frmdrules');
    $tblDiscovery = new CTableInfo(S_NO_DISCOVERY_RULES_DEFINED);
    $tblDiscovery->SetHeader(array(array(new CCheckBox('all_drules', null, "CheckAll('" . $form->GetName() . "','all_drules');"), make_sorting_link(S_NAME, 'd.name')), make_sorting_link(S_IP_RANGE, 'd.iprange'), make_sorting_link(S_DELAY, 'd.delay'), S_CHECKS, S_STATUS));
    $db_rules = DBselect('SELECT d.* ' . ' FROM drules d' . ' WHERE ' . DBin_node('druleid') . order_by('d.name,d.iprange,d.delay', 'd.druleid'));
    while ($rule_data = DBfetch($db_rules)) {
        $cheks = array();
        $db_checks = DBselect("select * from dchecks where druleid=" . $rule_data["druleid"] . " order by type,druleid");
        while ($check_data = DBfetch($db_checks)) {
            $cheks[] = discovery_check_type2str($check_data['type']);
        }
        $status = new CCol(new CLink(discovery_status2str($rule_data["status"]), '?g_druleid%5B%5D=' . $rule_data['druleid'] . ($rule_data["status"] == DRULE_STATUS_ACTIVE ? '&group_disable=1' : '&group_enable=1'), discovery_status2style($rule_data["status"])));
        $description = array();
        if ($rule_data["proxy_hostid"]) {
            $proxy = get_host_by_hostid($rule_data["proxy_hostid"]);
            array_push($description, $proxy["host"], ":");
        }
        array_push($description, new CLink($rule_data['name'], "?form=update&druleid=" . $rule_data['druleid'], 'action'));
        $drule = new CCol(array(new CCheckBox('g_druleid[' . $rule_data["druleid"] . ']', null, null, $rule_data["druleid"]), SPACE, $description));
        $tblDiscovery->AddRow(array($drule, $rule_data['iprange'], $rule_data['delay'], implode(',', $cheks), $status));
    }
    $tblDiscovery->SetFooter(new CCol(array(new CButtonQMessage('group_enable', S_ENABLE_SELECTED, S_ENABLE_SELECTED_RULES_Q), SPACE, new CButtonQMessage('group_disable', S_DISABLE_SELECTED, S_DISABLE_SELECTED_RULES_Q), SPACE, new CButtonQMessage('group_delete', S_DELETE_SELECTED, S_DELETE_SELECTED_RULES_Q))));
    $form->AddItem($tblDiscovery);
    $form->Show();
}
include_once "include/page_footer.php";
Beispiel #8
0
            $status['msg'] = S_FAIL . ' - ' . S_ERROR . ': ' . $httptest_data['error'];
            $status['style'] = 'disabled';
        }
    }
}
$table->AddRow(array(new CCol(S_TOTAL_BIG, 'bold'), new CCol(SPACE, 'bold'), new CCol(format_lastvalue($total_data[HTTPSTEP_ITEM_TYPE_TIME]), 'bold'), new CCol(SPACE, 'bold'), new CCol(new CSpan($status['msg'], $status['style']), 'bold')));
$table->Show();
echo SBR;
if (isset($_REQUEST['period']) && $_REQUEST['period'] != ZBX_MIN_PERIOD) {
    update_profile('web.httptest.period', $_REQUEST['period'], PROFILE_TYPE_INT, $_REQUEST['httptestid']);
}
$_REQUEST['period'] = get_profile('web.httptest.period', ZBX_PERIOD_DEFAULT, PROFILE_TYPE_INT, $_REQUEST['httptestid']);
show_table_header(array(S_HISTORY . ' "', bold($httptest_data['name']), '"'));
$form = new CTableInfo();
$form->AddOption('id', 'graph');
$form->AddRow(array(bold(S_SPEED), new CCol(get_dynamic_chart('graph_1', 'chart3.php?' . url_param('period') . url_param('from') . url_param($httptest_data['name'], false, 'name') . url_param(150, false, 'height') . url_param(get_request('stime', 0), false, 'stime') . url_param($items[HTTPSTEP_ITEM_TYPE_IN], false, 'items') . url_param(GRAPH_TYPE_STACKED, false, 'graphtype'), '-128'), 'center')));
$form->AddRow(array(bold(S_RESPONSE_TIME), new CCol(get_dynamic_chart('graph_2', 'chart3.php?' . url_param('period') . url_param('from') . url_param($httptest_data['name'], false, 'name') . url_param(150, false, 'height') . url_param(get_request('stime', 0), false, 'stime') . url_param($items[HTTPSTEP_ITEM_TYPE_TIME], false, 'items') . url_param(GRAPH_TYPE_STACKED, false, 'graphtype'), '-128'), 'center')));
$form->Show();
$period = get_request('period', 3600);
//SDI(get_min_itemclock_by_itemid($items[HTTPSTEP_ITEM_TYPE_IN][0]['itemid']));
$mstime = min(get_min_itemclock_by_itemid($items[HTTPSTEP_ITEM_TYPE_IN][0]['itemid']), get_min_itemclock_by_itemid($items[HTTPSTEP_ITEM_TYPE_TIME][0]['itemid']));
$stime = $mstime ? $mstime : 0;
$bstime = time() - $period;
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,' . $period . ',' . $stime . ',0,' . $bstime . ');
				showgraphmenu("graph");
				graph_zoom_init("graph_1",' . $bstime . ',' . $period . ',ZBX_G_WIDTH, 150, false);
				graph_zoom_init("graph_2",' . $bstime . ',' . $period . ',ZBX_G_WIDTH, 150, false);';
Beispiel #9
0
        !empty($childs_str) ? $childs_str .= ',' : '';
        $query = 'SELECT DISTINCT s.* ' . ' FROM services s ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' AND s.serviceid NOT IN (' . $childs_str . $service['serviceid'] . ') ' . ' ORDER BY s.sortorder,s.name';
    } else {
        $query = 'SELECT DISTINCT s.* ' . ' FROM services s ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' ORDER BY s.sortorder,s.name';
    }
    $db_services = DBselect($query);
    while ($db_service_data = DBfetch($db_services)) {
        $prefix = null;
        $trigger = "-";
        $description = $db_service_data["name"];
        if (isset($db_service_data["triggerid"])) {
            $trigger = expand_trigger_description($db_service_data["triggerid"]);
        }
        $description = new CLink($description, '#', 'action');
        $description->SetAction('window.opener.add_child_service(' . zbx_jsvalue($db_service_data["name"]) . ',' . zbx_jsvalue($db_service_data["serviceid"]) . ',' . zbx_jsvalue($trigger) . ',' . zbx_jsvalue($db_service_data["triggerid"]) . '); self.close(); return false;');
        $table->AddRow(array(array($prefix, $description), algorithm2str($db_service_data["algorithm"]), $trigger));
    }
    $cb = new CButton('cancel', S_CANCEL);
    $cb->SetType('button');
    $cb->SetAction('javascript: self.close();');
    $td = new CCol($cb);
    $td->setAttribute('style', 'text-align:right;');
    $table->SetFooter($td);
    $form->AddItem($table);
    $form->Show();
}
//--------------------------------------------	</CHILD SERVICES LIST>  --------------------------------------------
//--------------------------------------------	<FORM>  --------------------------------------------
if (isset($_REQUEST['sform'])) {
    $frmService = new CFormTable(S_SERVICE, 'services_form.php', 'POST', null, 'sform');
    $frmService->SetHelp("web.services.service.php");
Beispiel #10
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;
}
Beispiel #11
0
 } elseif ($_REQUEST['config'] == 6) {
     echo SBR;
     if (isset($_REQUEST['form'])) {
         insert_value_mapping_form();
     } else {
         show_table_header(S_VALUE_MAPPING_BIG);
         $table = new CTableInfo();
         $table->SetHeader(array(S_NAME, S_VALUE_MAP));
         $db_valuemaps = DBselect('SELECT * FROM valuemaps WHERE ' . DBin_node('valuemapid'));
         while ($db_valuemap = DBfetch($db_valuemaps)) {
             $mappings_row = array();
             $db_maps = DBselect('SELECT * FROM mappings' . ' WHERE valuemapid=' . $db_valuemap['valuemapid']);
             while ($db_map = DBfetch($db_maps)) {
                 array_push($mappings_row, $db_map['value'], SPACE . RARR . SPACE, $db_map['newvalue'], BR());
             }
             $table->AddRow(array(new CLink($db_valuemap['name'], 'config.php?form=update&' . 'valuemapid=' . $db_valuemap['valuemapid'] . url_param('config'), 'action'), empty($mappings_row) ? SPACE : $mappings_row));
         }
         $table->Show();
     }
 } else {
     if ($_REQUEST['config'] == 10) {
         if (isset($_REQUEST["form"])) {
             $frmRegExp = new CForm('config.php', 'post');
             $frmRegExp->setName(S_REGULAR_EXPRESSION);
             $frmRegExp->addVar('form', get_request('form', 1));
             $from_rfr = get_request('form_refresh', 0);
             $frmRegExp->addVar('form_refresh', $from_rfr + 1);
             $frmRegExp->addVar('config', get_request('config', 10));
             if (isset($_REQUEST['regexpid'])) {
                 $frmRegExp->addVar('regexpid', $_REQUEST['regexpid']);
             }
Beispiel #12
0
    $cmbTimeZone = new CComboBox('timezone', $timezone);
    for ($i = -12; $i <= 13; $i++) {
        $cmbTimeZone->addItem($i, 'GMT' . sprintf('%+03d:00', $i));
    }
    $frmNode->addRow(S_TIME_ZONE, $cmbTimeZone);
    $frmNode->addRow(S_IP, new CTextBox('ip', $ip, 15));
    $frmNode->addRow(S_PORT, new CNumericBox('port', $port, 5));
    $frmNode->addRow(S_DO_NOT_KEEP_HISTORY_OLDER_THAN, new CNumericBox('slave_history', $slave_history, 6));
    $frmNode->addRow(S_DO_NOT_KEEP_TRENDS_OLDER_THAN, new CNumericBox('slave_trends', $slave_trends, 6));
    $frmNode->addItemToBottomRow(new CButton('save', S_SAVE));
    if (isset($_REQUEST['nodeid']) && $node_type != ZBX_NODE_LOCAL) {
        $frmNode->addItemToBottomRow(SPACE);
        $frmNode->addItemToBottomRow(new CButtonDelete('Delete selected node?', url_param('form') . url_param('nodeid')));
    }
    $frmNode->addItemToBottomRow(SPACE);
    $frmNode->addItemToBottomRow(new CButtonCancel(url_param('config')));
    $frmNode->Show();
} else {
    show_table_header(S_NODES_BIG);
    $table = new CTableInfo(S_NO_NODES_DEFINED);
    $table->SetHeader(array(make_sorting_link(S_ID, 'n.nodeid'), make_sorting_link(S_NAME, 'n.name'), make_sorting_link(S_TYPE, 'n.nodetype'), make_sorting_link(S_TIME_ZONE, 'n.timezone'), make_sorting_link(S_IP . ':' . S_PORT, 'n.ip')));
    $sql = 'SELECT n.* ' . ' FROM nodes n' . ' WHERE ' . DBcondition('n.nodeid', $available_nodes) . order_by('n.nodeid,n.name,n.nodetype,n.timezone,n.ip', 'n.masterid');
    $db_nodes = DBselect($sql);
    while ($row = DBfetch($db_nodes)) {
        $node_type = detect_node_type($row);
        $node_type_name = node_type2str($node_type);
        $table->AddRow(array($row['nodeid'], array(get_node_path($row['masterid']), new CLink($row['nodetype'] ? new CSpan($row['name'], 'bold') : $row['name'], '?&form=update&nodeid=' . $row['nodeid'], 'action')), $node_type == ZBX_NODE_LOCAL ? new CSpan($node_type_name, 'bold') : $node_type_name, new CSpan('GMT' . sprintf('%+03d:00', $row['timezone']), $row['nodetype'] ? 'bold' : null), new CSpan($row['ip'] . ':' . $row['port'], $row['nodetype'] ? 'bold' : null)));
    }
    $table->Show();
}
include_once 'include/page_footer.php';
Beispiel #13
0
     $db_dservices = DBselect('SELECT type,port,key_,status,lastup,lastdown FROM dservices ' . ' WHERE dhostid=' . $dhost['dhostid'] . ' order by status,type,port');
     while ($dservice = DBfetch($db_dservices)) {
         $class = 'active';
         $time = 'lastup';
         if (DSVC_STATUS_DISABLED == $dservice['status']) {
             $class = 'inactive';
             $time = 'lastdown';
         }
         $service_name = discovery_check_type2str($dservice['type']) . discovery_port2str($dservice['type'], $dservice['port']) . (empty($dservice['key_']) ? '' : ':' . $dservice['key_']);
         $discovery_info[$dhost['ip']]['services'][$service_name] = array('class' => $class, 'time' => $dservice[$time]);
     }
 }
 if ($druleid == 0 && !empty($discovery_info)) {
     $col = new CCol(array(bold($drule['name']), SPACE . "(" . count($discovery_info) . SPACE . S_ITEMS . ")"));
     $col->SetColSpan(count($services) + 2);
     $table->AddRow(array(get_node_name_by_elid($drule['druleid']), $col));
 }
 foreach ($discovery_info as $ip => $h_data) {
     $table_row = array(get_node_name_by_elid($h_data['druleid']), new CSpan($ip, $h_data['class']), new CSpan($h_data['time'] == 0 ? '' : convert_units(time() - $h_data['time'], 'uptime'), $h_data['class']));
     foreach ($services as $name => $foo) {
         $class = null;
         $time = SPACE;
         $hint = new CDiv(SPACE, $class);
         $hintTable = new CTableInfo();
         $hintTable->addOption('border', 0);
         if (isset($h_data['services'][$name])) {
             $class = $h_data['services'][$name]['class'];
             $time = $h_data['services'][$name]['time'];
             if ($class == 'active') {
                 $hintTable->setHeader(S_UP_TIME);
             } else {
Beispiel #14
0
function get_history_of_triggers_events($start, $num, $groupid = 0, $hostid = 0)
{
    global $USER_DETAILS;
    $config = select_config();
    $show_unknown = get_profile('web.events.filter.show_unknown', 0);
    $sql_from = $sql_cond = '';
    $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_LIST);
    $available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_DATA_ARRAY, get_current_nodeid());
    if ($hostid > 0) {
        $sql_cond = ' AND h.hostid=' . $hostid;
    } else {
        if ($groupid > 0) {
            $sql_from = ', hosts_groups hg ';
            $sql_cond = ' AND h.hostid=hg.hostid AND hg.groupid=' . $groupid;
        } else {
            $sql_from = '';
            $sql_cond = ' AND ' . DBcondition('h.hostid', $available_hosts);
        }
    }
    //---
    $triggers = array();
    $trigger_list = array();
    $sql = 'SELECT DISTINCT t.triggerid,t.priority,t.description,t.expression,h.host,t.type ' . ' FROM triggers t, functions f, items i, hosts h ' . $sql_from . ' WHERE ' . DBcondition('t.triggerid', $available_triggers) . ' AND t.triggerid=f.triggerid ' . ' AND f.itemid=i.itemid ' . ' AND i.hostid=h.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . $sql_cond;
    $rez = DBselect($sql);
    while ($rowz = DBfetch($rez)) {
        $triggers[$rowz['triggerid']] = $rowz;
        array_push($trigger_list, $rowz['triggerid']);
    }
    $sql_cond = $show_unknown == 0 ? ' AND e.value<>' . TRIGGER_VALUE_UNKNOWN . ' ' : '';
    $table = new CTableInfo(S_NO_EVENTS_FOUND);
    $table->SetHeader(array(S_TIME, is_show_all_nodes() ? S_NODE : null, $hostid == 0 ? S_HOST : null, S_DESCRIPTION, S_VALUE, S_SEVERITY));
    if (!empty($triggers)) {
        $sql = 'SELECT e.eventid, e.objectid as triggerid, e.clock, e.value, e.acknowledged ' . ' FROM events e ' . ' WHERE e.object=' . EVENT_OBJECT_TRIGGER . ' AND ' . DBcondition('e.objectid', $trigger_list) . $sql_cond . ' ORDER BY e.eventid DESC';
        $result = DBselect($sql, 10 * ($start + $num));
    }
    $col = 0;
    $skip = $start;
    while (!empty($triggers) && $col < $num && ($row = DBfetch($result))) {
        if ($skip > 0) {
            if ($show_unknown == 0 && $row['value'] == TRIGGER_VALUE_UNKNOWN) {
                continue;
            }
            $skip--;
            continue;
        }
        $value = new CCol(trigger_value2str($row['value']), get_trigger_value_style($row['value']));
        $row = array_merge($triggers[$row['triggerid']], $row);
        if (0 == $show_unknown && !event_initial_time($row, $show_unknown)) {
            continue;
        }
        $table->AddRow(array(date("Y.M.d H:i:s", $row["clock"]), get_node_name_by_elid($row['triggerid']), $hostid == 0 ? $row['host'] : null, new CLink(expand_trigger_description_by_data($row, ZBX_FLAG_EVENT), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row['eventid'], 'action'), $value, new CCol(get_severity_description($row["priority"]), get_severity_style($row["priority"]))));
        $col++;
    }
    return $table;
}
Beispiel #15
0
function get_history_of_discovery_events($start, $end)
{
    $sql_cond = ' AND e.clock>' . $start;
    $sql_cond .= ' AND e.clock<' . $end;
    $sql = 'SELECT DISTINCT e.source,e.object,e.objectid,e.clock,e.value ' . ' FROM events e' . ' WHERE e.source=' . EVENT_SOURCE_DISCOVERY . $sql_cond . order_by('e.clock');
    $db_events = DBselect($sql);
    $table = new CTableInfo(S_NO_EVENTS_FOUND);
    $table->SetHeader(array(S_TIME, S_IP, S_DESCRIPTION, S_STATUS));
    $col = 0;
    while ($event_data = DBfetch($db_events)) {
        $value = new CCol(trigger_value2str($event_data['value']), get_trigger_value_style($event_data['value']));
        switch ($event_data['object']) {
            case EVENT_OBJECT_DHOST:
                $object_data = DBfetch(DBselect('SELECT ip FROM dhosts WHERE dhostid=' . $event_data['objectid']));
                $description = SPACE;
                break;
            case EVENT_OBJECT_DSERVICE:
                $object_data = DBfetch(DBselect('SELECT h.ip,s.type,s.port ' . ' FROM dhosts h,dservices s ' . ' WHERE h.dhostid=s.dhostid ' . ' AND s.dserviceid=' . $event_data['objectid']));
                $description = S_SERVICE . ': ' . discovery_check_type2str($object_data['type']) . '; ' . S_PORT . ': ' . $object_data['port'];
                break;
            default:
                continue;
        }
        if (!$object_data) {
            continue;
        }
        $table->AddRow(array(date('Y.M.d H:i:s', $event_data['clock']), $object_data['ip'], $description, $value));
        $col++;
    }
    return $table;
}
Beispiel #16
0
                $trigger_cnt = array(new CCheckBox('triggers[' . $host['hostid'] . ']', isset($triggers[$host['hostid']]) || !isset($update), NULL, true), $host['triggers_cnt']);
            } else {
                $trigger_cnt = '-';
            }
            /* calculate graphs */
            if (isset($host['graphs_cnt']) && $host['graphs_cnt'] > 0) {
                $graph_cnt = array(new CCheckBox('graphs[' . $host['hostid'] . ']', isset($graphs[$host['hostid']]) || !isset($update), NULL, true), $host['graphs_cnt']);
            } else {
                $graph_cnt = '-';
            }
            /* $screens = 0; */
            if ($host["status"] == HOST_STATUS_TEMPLATE) {
                $ip = $dns = $port = '-';
            } else {
                $ip = empty($host["ip"]) ? '-' : $host["ip"];
                $dns = empty($host["dns"]) ? '-' : $host["dns"];
                if ($host["useip"] == 1) {
                    $ip = bold($ip);
                } else {
                    $dns = bold($dns);
                }
                $port = empty($host["port"]) ? '-' : $host["port"];
            }
            $table->AddRow(array($host_name, $dns, $ip, $port, $status, $template_cnt, $item_cnt, $trigger_cnt, $graph_cnt));
        }
        $table->SetFooter(new CCol(array(new CButton('preview', S_PREVIEW), new CButton('export', S_EXPORT))));
        $form->AddItem($table);
        $form->Show();
    }
}
include_once "include/page_footer.php";
Beispiel #17
0
            if ($next_event = get_next_event($row, $show_unknown)) {
                $duration = zbx_date2age($row['clock'], $next_event['clock']);
            }
            // Actions
            $actions = get_event_actions_status($row['eventid']);
            //--------
            if ($config['event_ack_enable']) {
                if ($row['acknowledged'] == 1) {
                    $ack = new CLink(S_YES, 'acknow.php?eventid=' . $row['eventid'], 'action');
                } else {
                    $ack = new CLink(S_NO, 'acknow.php?eventid=' . $row['eventid'], 'on');
                }
            }
            $tr_desc = new CSpan(expand_trigger_description_by_data($row, ZBX_FLAG_EVENT), 'pointer');
            $tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " new Array({'triggerid': '" . $row['triggerid'] . "', 'lastchange': '" . $row['clock'] . "'})," . zbx_jsvalue($row['items']) . ");");
            $table->AddRow(array(new CLink(date('Y.M.d H:i:s', $row['clock']), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row['eventid'], 'action'), is_show_subnodes() ? get_node_name_by_elid($row['triggerid']) : null, $_REQUEST['hostid'] == 0 ? $row['host'] : null, $tr_desc, $value, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row['value'])), $duration, $config['event_ack_enable'] ? $ack : NULL, $actions));
            $col++;
        }
    }
}
/************************* FILTER **************************/
/***********************************************************/
// Navigation
$nav_time = get_request('nav_time', time());
$navForm = new CForm('events.php');
if (isset($_REQUEST['groupid'])) {
    $navForm->AddVar('groupid', $_REQUEST['groupid']);
}
if (isset($_REQUEST['hostid'])) {
    $navForm->AddVar('hostid', $_REQUEST['hostid']);
}
Beispiel #18
0
function get_screen_plaintext($itemid, $elements, $style = 0)
{
    if ($itemid == 0) {
        $table = new CTableInfo(S_ITEM_DOES_NOT_EXIST);
        $table->setHeader(array(S_TIMESTAMP, S_ITEM));
        return $table;
    }
    global $DB;
    $item = get_item_by_itemid($itemid);
    switch ($item['value_type']) {
        case ITEM_VALUE_TYPE_FLOAT:
            $history_table = 'history';
            $order_field = 'clock';
            break;
        case ITEM_VALUE_TYPE_UINT64:
            $history_table = 'history_uint';
            $order_field = 'clock';
            break;
        case ITEM_VALUE_TYPE_TEXT:
            $history_table = 'history_text';
            $order_field = 'id';
            break;
        case ITEM_VALUE_TYPE_LOG:
            $history_table = 'history_log';
            $order_field = 'id';
            break;
        default:
            $history_table = 'history_str';
            $order_field = 'clock';
            break;
    }
    $sql = 'SELECT h.clock,h.value,i.valuemapid ' . ' FROM ' . $history_table . ' h, items i ' . ' WHERE h.itemid=i.itemid ' . ' AND i.itemid=' . $itemid . ' ORDER BY h.' . $order_field . ' DESC';
    $result = DBselect($sql, $elements);
    $host = get_host_by_itemid($itemid);
    $table = new CTableInfo();
    $table->setHeader(array(S_TIMESTAMP, $host['host'] . ': ' . item_description($item)));
    while ($row = DBfetch($result)) {
        switch ($item['value_type']) {
            case ITEM_VALUE_TYPE_TEXT:
                if ($DB['TYPE'] == 'ORACLE') {
                    if (isset($row['value'])) {
                        $row['value'] = $row['value']->load();
                    } else {
                        $row['value'] = '';
                    }
                }
                /* do not use break */
            /* do not use break */
            case ITEM_VALUE_TYPE_STR:
                if ($style) {
                    $value = new CScript($row['value']);
                } else {
                    $value = nbsp(htmlspecialchars($row['value']));
                    $value = zbx_nl2br($value);
                }
                break;
            case ITEM_VALUE_TYPE_LOG:
                if ($style) {
                    $value = new CScript($row['value']);
                } else {
                    $value = nbsp(htmlspecialchars($row['value']));
                    $value = zbx_nl2br($value);
                }
                break;
            default:
                $value = $row['value'];
                break;
        }
        if ($row['valuemapid'] > 0) {
            $value = replace_value_by_map($value, $row['valuemapid']);
        }
        $table->AddRow(array(date(S_DATE_FORMAT_YMDHMS, $row['clock']), $value));
    }
    return $table;
}
Beispiel #19
0
            $wd = date("w", $time);
            $wd = $wd == 0 ? 6 : $wd - 1;
            return $time + ($w * 7 - $wd) * 24 * 3600;
        }
        function format_time($t)
        {
            return date("d M Y H:i", $t);
        }
        function format_time2($t)
        {
            return format_time($t);
        }
        break;
}
$table->SetHeader($header);
for ($t = $from; $t <= $to; $t++) {
    if (($start = get_time($t)) > time()) {
        break;
    }
    if (($end = get_time($t + 1)) > time()) {
        $end = time();
    }
    $stat = calculate_service_availability($service["serviceid"], $start, $end);
    $ok = new CSpan(sprintf("%dd %dh %dm", $stat["ok_time"] / (24 * 3600), $stat["ok_time"] % (24 * 3600) / 3600, $stat["ok_time"] % 3600 / 60), "off");
    $problems = new CSpan(sprintf("%dd %dh %dm", $stat["problem_time"] / (24 * 3600), $stat["problem_time"] % (24 * 3600) / 3600, $stat["problem_time"] % 3600 / 60), "on");
    $downtime = sprintf("%dd %dh %dm", $stat["downtime_time"] / (24 * 3600), $stat["downtime_time"] % (24 * 3600) / 3600, $stat["downtime_time"] % 3600 / 60);
    $percentage = new CSpan(sprintf("%2.2f%%", $stat["ok"]), "off");
    $table->AddRow(array(format_time($start), format_time2($end), $ok, $problems, $downtime, $percentage, $service["showsla"] == 1 ? new CSpan($service["goodsla"], $stat["ok"] >= $service["goodsla"] ? "off" : "on") : "-"));
}
$table->Show();
include_once "include/page_footer.php";
Beispiel #20
0
            $arr = array();
            $table->SetHeader(array(S_NEXT_CHECK, S_DELAYED_BY, is_show_all_nodes() ? S_NODE : null, S_HOST, S_DESCRIPTION));
            while ($row = DBfetch($result)) {
                $res = calculate_item_nextcheck($row['itemid'], $row['type'], $row['delay'], $row['delay_flex'], $row['lastclock']);
                if (0 != $row['proxy_hostid']) {
                    $res['nextcheck'] = $row['lastclock'] + $res['delay'];
                }
                $diff = $now - $res['nextcheck'];
                if ($diff <= 5) {
                    continue;
                }
                array_push($arr, array($res['nextcheck'], $row['hostid'], $row['host'], item_description($row)));
            }
            $rows = 0;
            sort($arr);
            foreach ($arr as $r) {
                $rows++;
                if ($rows > 500) {
                    $truncated = 1;
                    break;
                }
                $table->AddRow(array(date(S_DATE_FORMAT_YMDHMS, $r[0]), zbx_date2age($r[0]), get_node_name_by_elid($r[1]), $r[2], $r[3]));
            }
        }
    }
}
$table->Show();
if ($_REQUEST["config"] != 0) {
    show_table_header(S_TOTAL . ": " . $table->GetNumRows() . ($truncated ? ' (' . S_TRUNCATED . ')' : ''));
}
include_once "include/page_footer.php";
Beispiel #21
0
    if (($start = get_time($t)) > time()) {
        break;
    }
    if (($end = get_time($t + 1)) > time()) {
        $end = time();
    }
    $table_row = array(format_time($start), format_time2($end));
    foreach ($users as $userid => $alias) {
        $all = 0;
        $cnt_by_type = array();
        foreach ($media_types as $mediatypeid => $description) {
            $cnt_data = DBfetch(DBselect("select count(*) as cnt from alerts a " . " where a.userid=" . $userid . " and a.mediatypeid=" . $mediatypeid . " and clock>{$start} and clock<{$end} "));
            if (!$cnt_data) {
                $cnt_data = 0;
            } else {
                $cnt_data = $cnt_data['cnt'];
            }
            array_push($cnt_by_type, $cnt_data);
            $all += $cnt_data;
        }
        array_push($table_row, array($all, $media_type == 0 ? SPACE . "(" . implode('/', $cnt_by_type) . ")" : ""));
    }
    $table->AddRow($table_row);
}
$table->show();
if ($media_type == 0) {
    $table = new CTableInfo();
    $table->AddRow(new CSpan(SPACE . SPACE . SPACE . SPACE . SPACE . SPACE . "all" . SPACE . "(" . implode('/', $media_types) . ")", "off"));
    $table->Show();
}
include_once "include/page_footer.php";
Beispiel #22
0
    echo $dstfrm;
    ?>
'];
<!--
<?php 
    foreach ($new_group as $id => $name) {
        echo 'add_var_to_opener_obj(form,"new_group[' . $id . ']","' . $name . '")' . "\r";
    }
    ?>
if(form)
{
	form.submit();
	close_window();
}
-->
</script>
<?php 
}
$form = new CForm();
$form->AddVar('dstfrm', $dstfrm);
$form->SetName('groups');
$table = new CTableInfo(S_NO_GROUPS_DEFINED);
$table->SetHeader(array(array(new CCheckBox("all_groups", NULL, "CheckAll('" . $form->GetName() . "','all_groups');"), S_NAME)));
$result = DBselect('select * from usrgrp where ' . DBin_node('usrgrpid') . ' order by name');
while ($row = DBfetch($result)) {
    $table->AddRow(array(array(new CCheckBox('new_group[' . $row['usrgrpid'] . ']', isset($new_group[$row['usrgrpid']]), NULL, $row['name']), $row['name'])));
}
$table->SetFooter(new CButton('select', S_SELECT));
$form->AddItem($table);
$form->Show();
include_once "include/page_footer.php";
Beispiel #23
0
function make_trigger_details($triggerid, &$trigger_data)
{
    $table = new CTableInfo();
    if (is_show_subnodes()) {
        $table->AddRow(array(S_NODE, get_node_name_by_elid($triggerid)));
    }
    $table->AddRow(array(S_HOST, $trigger_data['host']));
    $table->AddRow(array(S_TRIGGER, $trigger_data['exp_desc']));
    $table->AddRow(array(S_SEVERITY, new CCol(get_severity_description($trigger_data["priority"]), get_severity_style($trigger_data["priority"]))));
    $table->AddRow(array(S_EXPRESSION, $trigger_data['exp_expr']));
    $table->AddRow(array(S_EVENT_GENERATION, S_NORMAL . (TRIGGER_MULT_EVENT_ENABLED == $trigger_data['type'] ? SPACE . '+' . SPACE . S_MULTIPLE_TRUE_EVENTS : '')));
    $table->AddRow(array(S_DISABLED, TRIGGER_STATUS_ENABLED == $trigger_data['status'] ? new CCol(S_NO, 'off') : new CCol(S_YES, 'on')));
    return $table;
}
Beispiel #24
0
        insert_host_profile_ext_form();
    } else {
        insert_host_profile_form();
    }
} else {
    $table = new CTableInfo();
    if ($prof_type) {
        $table->setHeader(array(is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, make_sorting_link(S_HOST, 'h.host'), $_REQUEST['groupid'] > 0 ? null : make_sorting_link(S_GROUP, 'g.name'), make_sorting_link(S_DEVICE_OS_SHORT, 'hpe.device_os_short'), make_sorting_link(S_DEVICE_HW_ARCH, 'hpe.device_hw_arch'), make_sorting_link(S_DEVICE_TYPE, 'hpe.device_type'), make_sorting_link(S_DEVICE_STATUS, 'hpe.device_status')));
        $sql_where = '';
        if ($_REQUEST['groupid'] > 0) {
            $sql_where = ' AND hg.groupid=' . $_REQUEST['groupid'];
        }
        $sql = 'SELECT DISTINCT g.name, h.hostid,h.host,hpe.device_os_short,hpe.device_hw_arch,hpe.device_type,hpe.device_status' . ' FROM hosts h,hosts_profiles_ext hpe,hosts_groups hg,groups g ' . ' WHERE h.hostid=hpe.hostid ' . ' AND h.hostid=hg.hostid ' . ' AND g.groupid=hg.groupid ' . ' AND ' . DBcondition('h.hostid', $PAGE_HOSTS['hostids']) . $sql_where . order_by('h.host,h.hostid,g.name,hpe.device_os_short,hpe.device_hw_arch,hpe.device_type,hpe.device_status');
        $result = DBselect($sql);
        while ($row = DBfetch($result)) {
            $table->AddRow(array(get_node_name_by_elid($row['hostid']), new CLink($row["host"], "?hostid=" . $row["hostid"] . url_param("groupid") . '&prof_type=' . $prof_type, "action"), $_REQUEST["groupid"] > 0 ? null : $row["name"], $row["device_os_short"], $row["device_hw_arch"], $row["device_type"], $row["device_status"]));
        }
    } else {
        $table->setHeader(array(is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, make_sorting_link(S_HOST, 'h.host'), make_sorting_link(S_NAME, 'p.name'), make_sorting_link(S_OS, 'p.os'), make_sorting_link(S_SERIALNO, 'p.serialno'), make_sorting_link(S_TAG, 'p.tag'), make_sorting_link(S_MACADDRESS, 'p.macaddress')));
        $sql_from = '';
        $sql_where = '';
        if ($_REQUEST['groupid'] > 0) {
            $sql_from = ', hosts_groups hg ';
            $sql_where = ' and h.hostid=hg.hostid AND hg.groupid=' . $_REQUEST['groupid'];
        }
        $sql = 'SELECT h.hostid,h.host,p.name,p.os,p.serialno,p.tag,p.macaddress' . ' FROM hosts h,hosts_profiles p ' . $sql_from . ' WHERE h.hostid=p.hostid' . ' and ' . DBcondition('h.hostid', $PAGE_HOSTS['hostids']) . $sql_where . order_by('h.host,h.hostid,p.name,p.os,p.serialno,p.tag,p.macaddress');
        $result = DBselect($sql);
        while ($row = DBfetch($result)) {
            $table->AddRow(array(get_node_name_by_elid($row['hostid']), new CLink($row["host"], '?hostid=' . $row['hostid'] . url_param('groupid') . '&prof_type=' . $prof_type, "action"), $row["name"], $row["os"], $row["serialno"], $row["tag"], $row["macaddress"]));
        }
    }
Beispiel #25
0
                                $sec_600[$row['proxy_hostid']]++;
                            } else {
                                $sec_rest[$row['proxy_hostid']]++;
                            }
                        }
                    }
                }
            }
        }
        $table->setHeader(array(S_PROXY, S_5_SECONDS, S_10_SECONDS, S_30_SECONDS, S_1_MINUTE, S_5_MINUTES, S_MORE_THAN_10_MINUTES));
        $db_proxies = DBselect('select hostid,host from hosts where status=' . HOST_STATUS_PROXY . ' order by host');
        while (null != ($db_proxy = DBfetch($db_proxies))) {
            $elements = array($db_proxy['host'], new CCol($sec_10[$db_proxy['hostid']], $sec_10[$db_proxy['hostid']] ? "unknown_trigger" : "normal"), new CCol($sec_30[$db_proxy['hostid']], $sec_30[$db_proxy['hostid']] ? "information" : "normal"), new CCol($sec_60[$db_proxy['hostid']], $sec_60[$db_proxy['hostid']] ? "warning" : "normal"), new CCol($sec_300[$db_proxy['hostid']], $sec_300[$db_proxy['hostid']] ? "average" : "normal"), new CCol($sec_600[$db_proxy['hostid']], $sec_600[$db_proxy['hostid']] ? "high" : "normal"), new CCol($sec_rest[$db_proxy['hostid']], $sec_rest[$db_proxy['hostid']] ? "disaster" : "normal"));
            $table->addRow($elements);
        }
        $elements = array(new CCol(S_SERVER, 'bold'), new CCol($sec_10[0], $sec_10[0] ? 'unknown_trigger' : 'normal'), new CCol($sec_30[0], $sec_30[0] ? 'information' : 'normal'), new CCol($sec_60[0], $sec_60[0] ? 'warning' : 'normal'), new CCol($sec_300[0], $sec_300[0] ? 'average' : 'normal'), new CCol($sec_600[0], $sec_600[0] ? 'high' : 'normal'), new CCol($sec_rest[0], $sec_rest[0] ? 'disaster' : 'normal'));
        $table->addRow($elements);
    } else {
        if ($_REQUEST["show"] == 2) {
            $table->SetHeader(array(S_NEXT_CHECK, is_show_subnodes() ? S_NODE : null, S_HOST, S_DESCRIPTION));
            while ($row = DBfetch($result)) {
                $table->AddRow(array(date("m.d.Y H:i:s", $row["nextcheck"]), get_node_name_by_elid($row['hostid']), $row['host'], item_description($row)));
            }
        }
    }
}
$table->Show();
if ($_REQUEST["show"] != 0) {
    show_table_header(S_TOTAL . ": " . $table->GetNumRows());
}
include_once "include/page_footer.php";
Beispiel #26
0
    }
}
$form = new CForm();
$form->SetMethod('get');
$form->AddItem(new CButton("form", S_CREATE_MAP));
show_table_header(S_CONFIGURATION_OF_NETWORK_MAPS, $form);
echo SBR;
if (isset($_REQUEST["form"])) {
    insert_map_form();
} else {
    $row_count = 0;
    $numrows = new CSpan(null, 'info');
    $numrows->addOption('name', 'numrows');
    $header = get_table_header(array(S_MAPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_MAPS_DEFINED);
    $table->SetHeader(array(make_sorting_link(S_NAME, 'sm.name'), make_sorting_link(S_WIDTH, 'sm.width'), make_sorting_link(S_HEIGHT, 'sm.height'), S_MAP));
    $result = DBselect('SELECT sm.sysmapid,sm.name,sm.width,sm.height ' . ' FROM sysmaps sm' . ' WHERE ' . DBin_node('sm.sysmapid') . order_by('sm.name,sm.width,sm.height', 'sm.sysmapid'));
    while ($row = DBfetch($result)) {
        if (!sysmap_accessible($row["sysmapid"], PERM_READ_WRITE)) {
            continue;
        }
        $table->AddRow(array(new CLink($row["name"], "sysmaps.php?form=update" . "&sysmapid=" . $row["sysmapid"] . "#form", 'action'), $row["width"], $row["height"], new CLink(S_EDIT, "sysmap.php?sysmapid=" . $row["sysmapid"])));
        $row_count++;
    }
    $table->Show();
}
if (isset($row_count)) {
    zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");');
}
include_once "include/page_footer.php";