本文整理汇总了PHP中is_show_all_nodes函数的典型用法代码示例。如果您正苦于以下问题:PHP is_show_all_nodes函数的具体用法?PHP is_show_all_nodes怎么用?PHP is_show_all_nodes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_show_all_nodes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$options = array('monitored' => true, 'value' => array(TRIGGER_VALUE_TRUE, TRIGGER_VALUE_FALSE), 'triggerLimit' => $this->screenitem['elements'], 'eventLimit' => $this->screenitem['elements']);
$item = new CTableInfo(_('No events found.'));
$item->setHeader(array(_('Time'), is_show_all_nodes() ? _('Node') : null, _('Host'), _('Description'), _('Value'), _('Severity')));
$events = getLastEvents($options);
foreach ($events as $event) {
$trigger = $event['trigger'];
$host = $event['host'];
$statusSpan = new CSpan(trigger_value2str($event['value']));
// add colors and blinking to span depending on configuration and trigger parameters
addTriggerValueStyle($statusSpan, $event['value'], $event['clock'], $event['acknowledged']);
$item->addRow(array(zbx_date2str(_('d M Y H:i:s'), $event['clock']), get_node_name_by_elid($event['objectid']), $host['name'], new CLink($trigger['description'], 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid']), $statusSpan, getSeverityCell($trigger['priority'])));
}
return $this->getOutput($item);
}
示例2: CLink
$expandLink = new CLink(new CImg('images/general/minus.png'), '?close=1' . url_param('groupid') . url_param('hostid'));
} else {
$expandLink = new CLink(new CImg('images/general/plus.png'), '?open=1' . url_param('groupid') . url_param('hostid'));
}
$httpTable = new CTableInfo(_('No web scenarios defined.'));
$httpTable->setHeader(array(new CCheckBox('all_httptests', null, "checkAll('" . $httpForm->getName() . "', 'all_httptests', 'group_httptestid');"), is_show_all_nodes() ? make_sorting_header(_('Node'), 'h.hostid') : null, $_REQUEST['hostid'] == 0 ? make_sorting_header(_('Host'), 'host') : null, make_sorting_header(array($expandLink, SPACE, _('Name')), 'name'), _('Number of steps'), _('Update interval'), make_sorting_header(_('Status'), 'status')));
$httpTableRows = array();
foreach ($this->data['db_httptests'] as $httptestid => $httptest_data) {
$db_app = $this->data['db_apps'][$httptest_data['applicationid']];
if (!isset($httpTableRows[$db_app['applicationid']])) {
$httpTableRows[$db_app['applicationid']] = array();
}
if (!uint_in_array($db_app['applicationid'], $_REQUEST['applications']) && !isset($this->data['showAllApps'])) {
continue;
}
$httpTableRows[$db_app['applicationid']][] = array(new CCheckBox('group_httptestid[' . $httptest_data['httptestid'] . ']', null, null, $httptest_data['httptestid']), is_show_all_nodes() ? SPACE : null, $_REQUEST['hostid'] > 0 ? null : $db_app['hostname'], new CLink($httptest_data['name'], '?form=update' . '&httptestid=' . $httptest_data['httptestid'] . '&hostid=' . $db_app['hostid'] . url_param('groupid')), $httptest_data['step_count'], $httptest_data['delay'], new CCol(new CLink(httptest_status2str($httptest_data['status']), '?group_httptestid[]=' . $httptest_data['httptestid'] . '&go=' . ($httptest_data['status'] ? 'activate' : 'disable'), httptest_status2style($httptest_data['status']))));
}
foreach ($httpTableRows as $appid => $app_rows) {
$db_app = $this->data['db_apps'][$appid];
if (uint_in_array($db_app['applicationid'], $_REQUEST['applications']) || isset($this->data['showAllApps'])) {
$link = new CLink(new CImg('images/general/minus.png'), '?close=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select'));
} else {
$link = new CLink(new CImg('images/general/plus.png'), '?open=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select'));
}
$column = new CCol(array($link, SPACE, bold($db_app['name']), SPACE . '(' . _n('%1$d scenario', '%1$d scenarios', $db_app['scenarios_cnt']) . ')'));
$column->setColSpan(6);
$httpTable->addRow(array(get_node_name_by_elid($db_app['applicationid']), $column));
foreach ($app_rows as $row) {
$httpTable->addRow($row);
}
}
示例3: make_latest_data
function make_latest_data()
{
global $USER_DETAILS;
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
while ($db_app = DBfetch($db_applications)) {
$db_items = DBselect('SELECT DISTINCT i.* ' . ' FROM items i,items_applications ia' . ' WHERE ia.applicationid=' . $db_app['applicationid'] . ' AND i.itemid=ia.itemid' . ' AND i.status=' . ITEM_STATUS_ACTIVE . order_by('i.description,i.itemid,i.lastclock'));
$app_rows = array();
$item_cnt = 0;
while ($db_item = DBfetch($db_items)) {
$description = item_description($db_item);
if (!zbx_empty($_REQUEST['select']) && !zbx_stristr($description, $_REQUEST['select'])) {
continue;
}
++$item_cnt;
if (!uint_in_array($db_app['applicationid'], $_REQUEST['applications']) && !isset($show_all_apps)) {
continue;
}
if (isset($db_item['lastclock'])) {
$lastclock = date(S_DATE_FORMAT_YMDHMS, $db_item['lastclock']);
} else {
$lastclock = new CCol('-', 'center');
}
$lastvalue = format_lastvalue($db_item);
if (isset($db_item['lastvalue']) && isset($db_item['prevvalue']) && $db_item['value_type'] == 0 && $db_item['lastvalue'] - $db_item['prevvalue'] != 0) {
if ($db_item['lastvalue'] - $db_item['prevvalue'] < 0) {
$change = convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']);
} else {
$change = '+' . convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']);
}
$change = nbsp($change);
} else {
$change = new CCol('-', 'center');
}
if ($db_item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $db_item['value_type'] == ITEM_VALUE_TYPE_UINT64) {
$actions = new CLink(S_GRAPH, 'history.php?action=showgraph&itemid=' . $db_item['itemid'], 'action');
} else {
$actions = new CLink(S_HISTORY, 'history.php?action=showvalues&period=3600&itemid=' . $db_item['itemid'], 'action');
}
array_push($app_rows, new CRow(array(is_show_all_nodes() ? SPACE : null, $_REQUEST['hostid'] > 0 ? NULL : SPACE, str_repeat(SPACE, 6) . $description, $lastclock, new CCol($lastvalue, $lastvalue == '-' ? 'center' : null), $change, $actions)));
}
if ($item_cnt > 0) {
if (uint_in_array($db_app['applicationid'], $_REQUEST['applications']) || isset($show_all_apps)) {
$link = new CLink(new CImg('images/general/opened.gif'), '?close=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select'));
} else {
$link = new CLink(new CImg('images/general/closed.gif'), '?open=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select'));
}
$col = new CCol(array($link, SPACE, bold($db_app['name']), SPACE . '(' . $item_cnt . SPACE . S_ITEMS . ')'));
$col->setColSpan(5);
$table->ShowRow(array(get_node_name_by_elid($db_app['hostid']), $_REQUEST['hostid'] > 0 ? NULL : $db_app['host'], $col));
$any_app_exist = true;
foreach ($app_rows as $row) {
$table->ShowRow($row);
}
}
}
}
示例4: make_trigger_details
function make_trigger_details($trigger)
{
$hosts = reset($trigger['hosts']);
$hostId = $hosts['hostid'];
$hosts = API::Host()->get(array('output' => array('name', 'hostid', 'status'), 'hostids' => $hostId, 'selectScreens' => API_OUTPUT_COUNT, 'preservekeys' => true));
$host = reset($hosts);
$scripts = API::Script()->getScriptsByHosts($hostId);
$hostName = new CSpan($host['name'], 'link_menu');
$hostName->setMenuPopup(getMenuPopupHost($host, $scripts ? reset($scripts) : null));
$table = new CTableInfo();
if (is_show_all_nodes()) {
$table->addRow(array(_('Node'), get_node_name_by_elid($trigger['triggerid'])));
}
$table->addRow(array(_('Host'), $hostName));
$table->addRow(array(_('Trigger'), CMacrosResolverHelper::resolveTriggerName($trigger)));
$table->addRow(array(_('Severity'), getSeverityCell($trigger['priority'])));
$table->addRow(array(_('Expression'), explode_exp($trigger['expression'], true, true)));
$table->addRow(array(_('Event generation'), _('Normal') . (TRIGGER_MULT_EVENT_ENABLED == $trigger['type'] ? SPACE . '+' . SPACE . _('Multiple PROBLEM events') : '')));
$table->addRow(array(_('Disabled'), TRIGGER_STATUS_ENABLED == $trigger['status'] ? new CCol(_('No'), 'off') : new CCol(_('Yes'), 'on')));
return $table;
}
示例5: CLink
$ack = new CLink(S_YES, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $page['file']);
} else {
$ack = new CLink(S_NO, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $page['file'], 'on');
}
}
$description = expand_trigger_description_by_data(zbx_array_merge($trigger, array('clock' => $event['clock'])), ZBX_FLAG_EVENT);
$tr_desc = new CSpan($description, 'pointer');
$tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " new Array({'triggerid': '" . $trigger['triggerid'] . "', 'lastchange': '" . $event['clock'] . "'})," . zbx_jsvalue($items, true) . ");");
// Duration
$tr_event = $event + $trigger;
if ($next_event = get_next_event($tr_event, $events, $_REQUEST['hide_unknown'])) {
$event['duration'] = zbx_date2age($tr_event['clock'], $next_event['clock']);
} else {
$event['duration'] = zbx_date2age($tr_event['clock']);
}
$table->addRow(array(new CLink(zbx_date2str(S_EVENTS_ACTION_TIME_FORMAT, $event['clock']), 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid'], 'action'), is_show_all_nodes() ? get_node_name_by_elid($event['objectid']) : null, $_REQUEST['hostid'] == 0 ? $host['host'] : null, new CSpan($tr_desc, 'link_menu'), new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value'])), new CCol(get_severity_description($trigger['priority']), get_severity_style($trigger['priority'], $event['value'])), $event['duration'], $config['event_ack_enable'] ? $ack : NULL, $actions));
}
}
$table = array($paging, $table, $paging);
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
}
$events_wdgt->addItem($table);
// NAV BAR
$timeline = array('period' => $effectiveperiod, 'starttime' => date('YmdHis', $starttime), 'usertime' => date('YmdHis', $till));
$dom_graph_id = 'scroll_events_id';
$objData = array('id' => 'timeline_1', 'loadSBox' => 0, 'loadImage' => 0, 'loadScroll' => 1, 'dynamic' => 0, 'mainObject' => 1);
zbx_add_post_js('timeControl.addObject("' . $dom_graph_id . '",' . zbx_jsvalue($timeline) . ',' . zbx_jsvalue($objData) . ');');
zbx_add_post_js('timeControl.processObjects();');
$events_wdgt->show();
include_once 'include/page_footer.php';
示例6: convert_units
$change = '+';
}
// for 'unixtime' change should be calculated as uptime
$change .= convert_units(bcsub($db_item['lastvalue'], $db_item['prevvalue'], $digits), $db_item['units'] == 'unixtime' ? 'uptime' : $db_item['units'], 0);
$change = nbsp($change);
} else {
$change = ' - ';
}
// column "action"
if ($db_item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $db_item['value_type'] == ITEM_VALUE_TYPE_UINT64) {
$actions = new CLink(_('Graph'), 'history.php?action=showgraph&itemid=' . $db_item['itemid']);
} else {
$actions = new CLink(_('History'), 'history.php?action=showvalues&itemid=' . $db_item['itemid']);
}
$item_status = $db_item['status'] == ITEM_STATUS_NOTSUPPORTED ? 'unknown' : null;
array_push($app_rows, new CRow(array(SPACE, is_show_all_nodes() ? $db_host['item_cnt'] ? SPACE : get_node_name_by_elid($db_item['itemid']) : null, $_REQUEST['hostid'] ? null : SPACE, new CCol(SPACE . SPACE . $description, $item_status), new CCol($lastclock, $item_status), new CCol($lastvalue, $item_status), new CCol($change, $item_status), new CCol($actions, $item_status))));
}
unset($app_rows);
unset($db_host);
foreach ($db_hosts as $hostid => $db_host) {
$host = $hosts[$db_host['hostid']];
if (!isset($tab_rows[$hostid])) {
continue;
}
$app_rows = $tab_rows[$hostid];
$tmp_apps = $apps;
if (isset($apps[0])) {
unset($tmp_apps[0]);
$tmp_apps = array_values($tmp_apps);
}
if (isset($showAll)) {
示例7: zbx_objectValues
$options['groupids'] = $_REQUEST['groupid'];
}
if ($_REQUEST['hostid'] > 0) {
$options['hostids'] = $_REQUEST['hostid'];
}
} else {
if ($_REQUEST['hostid'] > 0) {
$hosts = CHost::get(array('templateids' => $_REQUEST['hostid']));
$options['hostids'] = zbx_objectValues($hosts, 'hostid');
}
if (isset($_REQUEST['tpl_triggerid']) && $_REQUEST['tpl_triggerid'] > 0) {
$options['filter']['templateid'] = $_REQUEST['tpl_triggerid'];
}
}
$triggers = CTrigger::get($options);
morder_result($triggers, array('host', 'description'));
$table = new CTableInfo();
$table->setHeader(array(is_show_all_nodes() ? S_NODE : null, $_REQUEST['hostid'] == 0 || 1 == $config ? S_HOST : NULL, S_NAME, S_PROBLEMS, S_OK, S_UNKNOWN, S_GRAPH));
foreach ($triggers as $trigger) {
$availability = calculate_availability($trigger['triggerid'], $_REQUEST['filter_timesince'], $_REQUEST['filter_timetill']);
$true = new CSpan(sprintf('%.4f%%', $availability['true']), 'on');
$false = new CSpan(sprintf('%.4f%%', $availability['false']), 'off');
$unknown = new CSpan(sprintf('%.4f%%', $availability['unknown']), 'unknown');
$actions = new CLink(S_SHOW, 'report2.php?filter_groupid=' . $_REQUEST['groupid'] . '&filter_hostid=' . $_REQUEST['hostid'] . '&triggerid=' . $trigger['triggerid']);
$table->addRow(array(get_node_name_by_elid($trigger['hostid']), $_REQUEST['hostid'] == 0 || 1 == $config ? $trigger['host'] : NULL, new CLink($trigger['description'], 'events.php?triggerid=' . $trigger['triggerid']), $true, $false, $unknown, $actions));
}
$rep2_wdgt->addItem($table);
$rep2_wdgt->show();
}
}
include_once 'include/page_footer.php';
示例8: zbx_objectValues
$hosts = API::Host()->get(array('templateids' => $_REQUEST['hostid']));
$options['hostids'] = zbx_objectValues($hosts, 'hostid');
}
if (isset($_REQUEST['tpl_triggerid']) && $_REQUEST['tpl_triggerid'] > 0) {
$options['filter']['templateid'] = $_REQUEST['tpl_triggerid'];
}
if (isset($_REQUEST['hostgroupid']) && $_REQUEST['hostgroupid'] > 0) {
$options['groupids'] = $_REQUEST['hostgroupid'];
}
}
// filter
$filter = get_report2_filter($availabilityReportMode, $PAGE_GROUPS, $PAGE_HOSTS, $options);
$rep2_wdgt->addFlicker($filter['form'], CProfile::get('web.avail_report.filter.state', 0));
$triggers = API::Trigger()->get($filter['options']);
CArrayHelper::sort($triggers, array('host', 'description'));
$table = new CTableInfo(_('No triggers defined.'));
$table->setHeader(array(is_show_all_nodes() ? _('Node') : null, $_REQUEST['hostid'] == 0 || $availabilityReportMode == AVAILABILITY_REPORT_BY_TEMPLATE ? _('Host') : null, _('Name'), _('Problems'), _('Ok'), _('Unknown'), _('Graph')));
foreach ($triggers as $trigger) {
$availability = calculate_availability($trigger['triggerid'], $_REQUEST['filter_timesince'], $_REQUEST['filter_timetill']);
$true = new CSpan(sprintf('%.4f%%', $availability['true']), 'on');
$false = new CSpan(sprintf('%.4f%%', $availability['false']), 'off');
$unknown = new CSpan(sprintf('%.4f%%', $availability['unknown']), 'unknown');
$actions = new CLink(_('Show'), 'report2.php?filter_groupid=' . $_REQUEST['groupid'] . '&filter_hostid=' . $_REQUEST['hostid'] . '&triggerid=' . $trigger['triggerid']);
$table->addRow(array(get_node_name_by_elid($trigger['hostid']), $_REQUEST['hostid'] == 0 || $availabilityReportMode == AVAILABILITY_REPORT_BY_TEMPLATE ? $trigger['hosts'][0]['name'] : null, new CLink($trigger['description'], 'events.php?triggerid=' . $trigger['triggerid']), $true, $false, $unknown, $actions));
}
$rep2_wdgt->addItem(BR());
$rep2_wdgt->addItem($table);
$rep2_wdgt->show();
}
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例9: make_vm_table
function make_vm_table($type, $instances)
{
$form_name = "{$type}_vms";
// Create Form
$form = new CForm();
$form->setName($form_name);
$form->setAttribute('id', $form_name);
$form->addVar('driver', 'vsphere');
$form->setAction('#');
// Create Table Header
$table = new CTableInfo();
switch ($type) {
case 'poweron':
$table->setHeader(array(is_show_all_nodes() ? _('Node') : null, new CCheckBox('all_hosts', null, "checkAllHosts('" . $form_name . "','all_hosts','');"), _('Instance name'), _('Status'), _('CPU threads'), _('Memory(GB)'), _('Interface'), _('SSH Connect')));
break;
case 'poweroff':
case 'suspend':
$table->setHeader(array(is_show_all_nodes() ? _('Node') : null, new CCheckBox('all_hosts', null, "checkAllHosts('" . $form_name . "','all_hosts','');"), _('Instance name'), _('Status'), _('CPU threads'), _('Memory(GB)'), _('Interface')));
break;
case 'other':
$table->setHeader(array(is_show_all_nodes() ? _('Node') : null, _('Instance name'), _('Status'), _('CPU thread'), _('Memory(GB)'), _('Interface'), _('Question')));
break;
default:
return null;
}
// Create Row
foreach ($instances as $instance) {
$table->addRow(make_hint_row($type, $instance));
}
$hostids = array_map(function ($instance) {
return $instance['hostid'];
}, $instances);
$footer = get_table_header(make_operation_box_footer($hostids, $form_name));
$form->addItem(array('', $table, '', $footer));
return $form;
}
示例10: validate_sort_and_sortorder
}
/*
* Page sorting
*/
validate_sort_and_sortorder('lastchange', ZBX_SORT_DOWN);
/*
* Play sound
*/
$mute = CProfile::get('web.tr_status.mute', 0);
if (isset($audio) && !$mute) {
play_sound($audio);
}
/*
* Display
*/
$displayNodes = is_show_all_nodes() && $pageFilter->groupid == 0 && $pageFilter->hostid == 0;
$showTriggers = $_REQUEST['show_triggers'];
$showEvents = $_REQUEST['show_events'];
$showSeverity = $_REQUEST['show_severity'];
$ackStatus = $_REQUEST['ack_status'];
$triggerWidget = new CWidget();
$rightForm = new CForm('get');
$rightForm->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
$rightForm->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true)));
$rightForm->addVar('fullscreen', $_REQUEST['fullscreen']);
$triggerWidget->addPageHeader(_('STATUS OF TRIGGERS') . SPACE . '[' . zbx_date2str(_('d M Y H:i:s')) . ']', get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$triggerWidget->addHeader(_('Triggers'), $rightForm);
$triggerWidget->addHeaderRowNumber();
/*
* Filter
*/
示例11: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$sortfield = 'clock';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Time');
switch ($this->screenitem['sort_triggers']) {
case SCREEN_SORT_TRIGGERS_TIME_ASC:
$sortfield = 'clock';
$sortorder = ZBX_SORT_UP;
$sorttitle = _('Time');
break;
case SCREEN_SORT_TRIGGERS_TIME_DESC:
$sortfield = 'clock';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Time');
break;
case SCREEN_SORT_TRIGGERS_TYPE_ASC:
$sortfield = 'description';
$sortorder = ZBX_SORT_UP;
$sorttitle = _('Type');
break;
case SCREEN_SORT_TRIGGERS_TYPE_DESC:
$sortfield = 'description';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Type');
break;
case SCREEN_SORT_TRIGGERS_STATUS_ASC:
$sortfield = 'status';
$sortorder = ZBX_SORT_UP;
$sorttitle = _('Status');
break;
case SCREEN_SORT_TRIGGERS_STATUS_DESC:
$sortfield = 'status';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Status');
break;
case SCREEN_SORT_TRIGGERS_RETRIES_LEFT_ASC:
$sortfield = 'retries';
$sortorder = ZBX_SORT_UP;
$sorttitle = _('Retries left');
break;
case SCREEN_SORT_TRIGGERS_RETRIES_LEFT_DESC:
$sortfield = 'retries';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Retries left');
break;
case SCREEN_SORT_TRIGGERS_RECIPIENT_ASC:
$sortfield = 'sendto';
$sortorder = ZBX_SORT_UP;
$sorttitle = _('Recipient(s)');
break;
case SCREEN_SORT_TRIGGERS_RECIPIENT_DESC:
$sortfield = 'sendto';
$sortorder = ZBX_SORT_DOWN;
$sorttitle = _('Recipient(s)');
break;
}
$sql = 'SELECT a.alertid,a.clock,mt.description,a.sendto,a.subject,a.message,a.status,a.retries,a.error' . ' FROM events e,alerts a' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid ' . ' WHERE e.eventid=a.eventid' . ' AND alerttype IN (' . ALERT_TYPE_MESSAGE . ')';
// editable + PERMISSION CHECK
if (CWebUser::getType() != USER_TYPE_SUPER_ADMIN) {
$userid = CWebUser::$data['userid'];
$userGroups = getUserGroupsByUserId($userid);
$sql .= ' AND EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE e.objectid=f.triggerid' . ' AND f.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY f.triggerid' . ' HAVING MIN(r.permission)>=' . PERM_READ_ONLY . ')';
}
$sql .= ' AND ' . DBin_node('a.alertid') . ' ' . ' ORDER BY ' . $sortfield . ' ' . $sortorder;
$alerts = DBfetchArray(DBselect($sql, $this->screenitem['elements']));
order_result($alerts, $sortfield, $sortorder);
// indicator of sort field
$sortfieldSpan = new CSpan(array($sorttitle, SPACE));
$sortorderSpan = new CSpan(SPACE, $sortorder == ZBX_SORT_DOWN ? 'icon_sortdown default_cursor' : 'icon_sortup default_cursor');
// create alert table
$actionTable = new CTableInfo(_('No actions found.'));
$actionTable->setHeader(array(is_show_all_nodes() ? _('Nodes') : null, $sortfield == 'clock' ? array($sortfieldSpan, $sortorderSpan) : _('Time'), $sortfield == 'description' ? array($sortfieldSpan, $sortorderSpan) : _('Type'), $sortfield == 'status' ? array($sortfieldSpan, $sortorderSpan) : _('Status'), $sortfield == 'retries' ? array($sortfieldSpan, $sortorderSpan) : _('Retries left'), $sortfield == 'sendto' ? array($sortfieldSpan, $sortorderSpan) : _('Recipient(s)'), _('Message'), _('Error')));
foreach ($alerts as $alert) {
if ($alert['status'] == ALERT_STATUS_SENT) {
$status = new CSpan(_('sent'), 'green');
$retries = new CSpan(SPACE, 'green');
} elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
$status = new CSpan(_('In progress'), 'orange');
$retries = new CSpan(ALERT_MAX_RETRIES - $alert['retries'], 'orange');
} else {
$status = new CSpan(_('not sent'), 'red');
$retries = new CSpan(0, 'red');
}
$message = array(bold(_('Subject') . ': '), br(), $alert['subject'], br(), br(), bold(_('Message') . ': '), br(), $alert['message']);
$error = empty($alert['error']) ? new CSpan(SPACE, 'off') : new CSpan($alert['error'], 'on');
$actionTable->addRow(array(get_node_name_by_elid($alert['alertid']), new CCol(zbx_date2str(HISTORY_OF_ACTIONS_DATE_FORMAT, $alert['clock']), 'top'), new CCol(!empty($alert['description']) ? $alert['description'] : '-', 'top'), new CCol($status, 'top'), new CCol($retries, 'top'), new CCol($alert['sendto'], 'top'), new CCol($message, 'top pre'), new CCol($error, 'wraptext top')));
}
return $this->getOutput($actionTable);
}
示例12: convert_units
if ($db_item['lastvalue'] - $db_item['prevvalue'] < 0) {
$change = convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']);
$change = nbsp($change);
} else {
$change = '+' . convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']);
$change = nbsp($change);
}
} else {
$change = new CCol(' - ');
}
if ($db_item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $db_item['value_type'] == ITEM_VALUE_TYPE_UINT64) {
$actions = new CLink(S_GRAPH, 'history.php?action=showgraph&itemid=' . $db_item['itemid'], 'action');
} else {
$actions = new CLink(S_HISTORY, 'history.php?action=showvalues&period=3600&itemid=' . $db_item['itemid'], 'action');
}
array_push($app_rows, new CRow(array(is_show_all_nodes() ? $db_host['item_cnt'] ? SPACE : get_node_name_by_elid($db_item['itemid']) : null, $_REQUEST['hostid'] ? NULL : ($db_host['item_cnt'] ? SPACE : $db_item['host']), str_repeat(SPACE, 6) . $description, $lastclock, new CCol($lastvalue), $change, $actions)));
}
unset($app_rows);
unset($db_host);
foreach ($db_hosts as $hostid => $db_host) {
if (!isset($tab_rows[$hostid])) {
continue;
}
$app_rows = $tab_rows[$hostid];
if (uint_in_array(0, $_REQUEST['applications']) || isset($show_all_apps)) {
$url = '?close=1&applicationid=0' . url_param('groupid') . url_param('hostid') . url_param('applications') . 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=0' . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select');
$link = new CLink(new CImg('images/general/closed.gif'), $url);
示例13: get_screen
//.........这里部分代码省略.........
array_push($item, new CLink(S_CHANGE, $action));
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_DATA_OVERVIEW) {
$hostids = array();
$res = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . $resourceid);
while ($tmp_host = DBfetch($res)) {
$hostids[$tmp_host['hostid']] = $tmp_host['hostid'];
}
$item = array(get_items_data_overview($hostids, $style));
if ($editmode == 1) {
array_push($item, new CLink(S_CHANGE, $action));
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_URL) {
$item = array(new CIFrame($url, $width, $height, "auto"));
if ($editmode == 1) {
array_push($item, BR(), new CLink(S_CHANGE, $action));
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_ACTIONS) {
$item = array(get_history_of_actions($elements));
if ($editmode == 1) {
array_push($item, new CLink(S_CHANGE, $action));
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_EVENTS) {
$options = array('monitored' => 1, 'value' => array(TRIGGER_VALUE_TRUE, TRIGGER_VALUE_FALSE), 'limit' => $elements);
$hide_unknown = CProfile::get('web.events.filter.hide_unknown', 0);
if ($hide_unknown) {
$options['value'] = array(TRIGGER_VALUE_TRUE, TRIGGER_VALUE_FALSE);
}
$item = new CTableInfo(S_NO_EVENTS_FOUND);
$item->SetHeader(array(S_TIME, is_show_all_nodes() ? S_NODE : null, S_HOST, S_DESCRIPTION, S_VALUE, S_SEVERITY));
$events = getLastEvents($options);
foreach ($events as $enum => $event) {
$trigger = $event['trigger'];
$host = $event['host'];
$value = new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value']));
// $row = zbx_array_merge($triggers[$row['triggerid']],$row);
// if((1 == $hide_unknown) && (!event_initial_time($row,$hide_unknown))) continue;
$item->addRow(array(zbx_date2str(S_EVENTS_TRIGGERS_EVENTS_HISTORY_LIST_DATE_FORMAT, $event['clock']), get_node_name_by_elid($event['objectid']), $host['host'], new CLink($trigger['description'], 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid']), $value, new CCol(get_severity_description($trigger['priority']), get_severity_style($trigger['priority']))));
}
$item = array($item);
if ($editmode == 1) {
array_push($item, new CLink(S_CHANGE, $action));
}
} else {
$item = array(SPACE);
if ($editmode == 1) {
array_push($item, BR(), new CLink(S_CHANGE, $action));
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
示例14: make_awsstat_summary
function make_awsstat_summary($preloading = false)
{
$table = new CTableInfo();
$table->setHeader(array(is_show_all_nodes() ? S_NODE : null, _('Account name'), _('PoweredOn'), _('PoweredOff'), _('Billing/Month')));
$script_itemkey = 'push_message.py[{$HYCLOPS_SERVER},{$HYCLOPS_PORT},ec2,{HOST.HOST}]';
$aws_accounts = get_aws_accounts();
if (empty($aws_accounts)) {
return null;
}
foreach ($aws_accounts as $host) {
if (!$preloading) {
if (is_script_success($host['hostid'], $script_itemkey)) {
$instances = get_instances($host['hostid']);
$instances = filter_instances($instances);
$r = new CRow();
// Account name
$col = new CCol($host['host']);
$r->addItem($col);
// Poweron (running + pending)
$poweron_vms = array_merge($instances["running"], $instances["pending"]);
$poweron_count = new CSpan(count($poweron_vms), 'pointer');
if (!empty($poweron_vms)) {
$poweron_count->setHint(make_ec2_table('ec2_poweron', $poweron_vms));
}
$r->addItem(new CCol($poweron_count));
// Poweroff (stopped + terminated + stopping + shutting-down)
$poweroff_vms = $instances["stopped"];
$poweroff_count = new CSpan(count($poweroff_vms), 'pointer');
if (!empty($poweroff_vms)) {
$poweroff_count->setHint(make_ec2_table('ec2_poweroff', $poweroff_vms));
}
$r->addItem(new CCol($poweroff_count));
// AWS Charges
$item = get_item_by_key('get_aws_charges.py[{$KEY},{$SECRET}]', $host["host"]);
if (array_key_exists('lastvalue', $item)) {
$r->addItem(new CLink($item["lastvalue"], "history.php?action=showgraph&itemid={$item["itemid"]}"));
} else {
$r->addItem(new CCol(_('No data')));
}
$table->addRow($r);
zbx_add_post_js('chkbxRange.pageGoName = "vms";');
} else {
$r = new CRow();
$r->addItem($host['host']);
$r->addItem(new CCol(_('script failed'), "high"));
$r->addItem(array("-"));
$table->addRow($r);
}
} else {
$r = new CRow();
$r->addItem($host['host']);
$r->addItem(new CCol(_('loading...')));
$r->addItem(array("-"));
$table->addRow($r);
}
}
$script = new CJSScript(get_js("jQuery('#hat_awsstat_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')"));
return new CDiv(array($table, $script));
}
示例15: make_discovery_status
function make_discovery_status()
{
$options = array('filter' => array('status' => DHOST_STATUS_ACTIVE), 'selectDHosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND);
$drules = CDRule::get($options);
order_result($drules, 'name');
foreach ($drules as $drnum => $drule) {
$drules[$drnum]['up'] = 0;
$drules[$drnum]['down'] = 0;
foreach ($drule['dhosts'] as $dhnum => $dhost) {
if (DRULE_STATUS_DISABLED == $dhost['status']) {
$drules[$drnum]['down']++;
} else {
$drules[$drnum]['up']++;
}
}
}
$header = array(is_show_all_nodes() ? new CCol(S_NODE, 'center') : null, new CCol(S_DISCOVERY_RULE, 'center'), new CCol(S_UP), new CCol(S_DOWN));
$table = new CTableInfo();
$table->setHeader($header, 'header');
foreach ($drules as $drnum => $drule) {
$table->addRow(array(get_node_name_by_elid($drule['druleid']), new CLink(get_node_name_by_elid($drule['druleid'], null, ': ') . $drule['name'], 'discovery.php?druleid=' . $drule['druleid']), new CSpan($drule['up'], 'green'), new CSpan($drule['down'], $drule['down'] > 0 ? 'red' : 'green')));
}
$table->setFooter(new CCol(S_UPDATED . ': ' . zbx_date2str(S_BLOCKS_DISCOVERY_STATUS_TIME_FORMAT)));
return $table;
}