本文整理汇总了PHP中get_node_name_by_elid函数的典型用法代码示例。如果您正苦于以下问题:PHP get_node_name_by_elid函数的具体用法?PHP get_node_name_by_elid怎么用?PHP get_node_name_by_elid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_node_name_by_elid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getImageByIdent
function getImageByIdent($ident)
{
zbx_value2array($ident);
if (!isset($ident['name'])) {
return 0;
}
static $images;
if (is_null($images)) {
$images = array();
$dbImages = API::Image()->get(array('output' => array('imageid', 'name'), 'nodeids' => get_current_nodeid(true)));
foreach ($dbImages as $image) {
if (!isset($images[$image['name']])) {
$images[$image['name']] = array();
}
$nodeName = get_node_name_by_elid($image['imageid'], true);
if (!is_null($nodeName)) {
$images[$image['name']][$nodeName] = $image;
} else {
$images[$image['name']][] = $image;
}
}
}
$ident['name'] = trim($ident['name'], ' ');
if (!isset($images[$ident['name']])) {
return 0;
}
$searchedImages = $images[$ident['name']];
if (!isset($ident['node'])) {
return reset($searchedImages);
} elseif (isset($searchedImages[$ident['node']])) {
return $searchedImages[$ident['node']];
} else {
return 0;
}
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:35,代码来源:ident.inc.php
示例2: show_report2_header
function show_report2_header($config, &$PAGE_GROUPS, &$PAGE_HOSTS)
{
global $USER_DETAILS;
$available_groups = $PAGE_GROUPS['groupids'];
$available_hosts = $PAGE_HOSTS['hostids'];
// $available_groups = $PAGE_GROUPS['groupids'];
// $available_hosts = $PAGE_HOSTS['hostids'];
$r_form = new CForm();
$r_form->setMethod('get');
$cmbConf = new CComboBox('config', $config, 'submit()');
$cmbConf->addItem(0, S_BY_HOST);
$cmbConf->addItem(1, S_BY_TRIGGER_TEMPLATE);
$r_form->addItem(array(S_MODE . SPACE, $cmbConf, SPACE));
$cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
$cmbHosts = new CComboBox('hostid', $PAGE_HOSTS['selected'], 'javascript: submit();');
foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
$cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
}
foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
$cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
}
$r_form->addItem(array(S_GROUP . SPACE, $cmbGroups));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
if (1 == $config) {
$cmbTrigs = new CComboBox('tpl_triggerid', get_request('tpl_triggerid', 0), 'submit()');
$cmbHGrps = new CComboBox('hostgroupid', get_request('hostgroupid', 0), 'submit()');
$cmbTrigs->addItem(0, S_ALL_SMALL);
$cmbHGrps->addItem(0, S_ALL_SMALL);
}
if (0 == $config) {
show_table_header(S_AVAILABILITY_REPORT_BIG, $r_form);
} else {
$sql_cond = ' AND h.hostid=ht.hostid ';
if ($_REQUEST['hostid'] > 0) {
$sql_cond .= ' AND ht.templateid=' . $_REQUEST['hostid'];
}
if (isset($_REQUEST['tpl_triggerid']) && $_REQUEST['tpl_triggerid'] > 0) {
$sql_cond .= ' AND t.templateid=' . $_REQUEST['tpl_triggerid'];
}
$result = DBselect('SELECT DISTINCT g.groupid,g.name ' . ' FROM triggers t,hosts h,items i,functions f, hosts_templates ht, groups g, hosts_groups hg ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid' . ' AND g.groupid=hg.groupid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND h.status=' . HOST_STATUS_MONITORED . $sql_cond . ' ORDER BY g.name');
while ($row = DBfetch($result)) {
$cmbHGrps->addItem($row['groupid'], get_node_name_by_elid($row['groupid']) . $row['name']);
}
$sql_cond = $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] : ' AND ' . DBcondition('h.hostid', $available_hosts);
$sql = 'SELECT DISTINCT t.triggerid,t.description ' . ' FROM triggers t,hosts h,items i,functions f ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND h.status=' . HOST_STATUS_TEMPLATE . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . $sql_cond . ' ORDER BY t.description';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$cmbTrigs->addItem($row['triggerid'], get_node_name_by_elid($row['triggerid']) . expand_trigger_description($row['triggerid']));
}
$rr_form = new CForm();
$rr_form->setMethod('get');
$rr_form->addVar('config', $config);
$rr_form->addVar('groupid', $_REQUEST['groupid']);
$rr_form->addVar('hostid', $_REQUEST['hostid']);
$rr_form->addItem(array(S_TRIGGER . SPACE, $cmbTrigs, BR(), S_FILTER, SPACE, S_HOST_GROUP . SPACE, $cmbHGrps));
show_table_header(S_AVAILABILITY_REPORT_BIG, array($r_form, $rr_form));
}
}
开发者ID:rennhak,项目名称:zabbix,代码行数:58,代码来源:reports.inc.php
示例3: 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);
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:21,代码来源:CScreenEvents.php
示例4: makeTriggersPopup
/**
* Generate table for dashboard triggers popup.
*
* @see make_system_status
*
* @param array $triggers
* @param array $ackParams
* @param array $actions
*
* @return CTableInfo
*/
function makeTriggersPopup(array $triggers, array $ackParams, array $actions)
{
$config = select_config();
$popupTable = new CTableInfo();
$popupTable->setAttribute('style', 'width: 400px;');
$popupTable->setHeader(array(is_show_all_nodes() ? _('Node') : null, _('Host'), _('Issue'), _('Age'), _('Info'), $config['event_ack_enable'] ? _('Ack') : null, _('Actions')));
CArrayHelper::sort($triggers, array(array('field' => 'lastchange', 'order' => ZBX_SORT_DOWN)));
foreach ($triggers as $trigger) {
// unknown triggers
$unknown = SPACE;
if ($trigger['state'] == TRIGGER_STATE_UNKNOWN) {
$unknown = new CDiv(SPACE, 'status_icon iconunknown');
$unknown->setHint($trigger['error'], '', 'on');
}
// ack
if ($config['event_ack_enable']) {
$ack = isset($trigger['event']['eventid']) ? getEventAckState($trigger['event'], true, true, $ackParams) : _('No events');
} else {
$ack = null;
}
// action
$action = isset($trigger['event']['eventid']) && isset($actions[$trigger['event']['eventid']]) ? $actions[$trigger['event']['eventid']] : _('-');
$popupTable->addRow(array(get_node_name_by_elid($trigger['triggerid']), $trigger['hosts'][0]['name'], getSeverityCell($trigger['priority'], $trigger['description']), zbx_date2age($trigger['lastchange']), $unknown, $ack, $action));
}
return $popupTable;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:37,代码来源:blocks.inc.php
示例5: DBselect
$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";
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:queue.php
示例6: CDiv
}
if ($show_events != EVENTS_OPTION_NOEVENT && !empty($trigger['events'])) {
$open_close = new CDiv(SPACE, 'filterclosed');
$open_close->setAttribute('data-switcherid', $trigger['triggerid']);
} else {
if ($show_events == EVENTS_OPTION_NOEVENT) {
$open_close = null;
} else {
$open_close = SPACE;
}
}
$severity_col = new CCol(get_severity_description($trigger['priority']), get_severity_style($trigger['priority'], $trigger['value']));
if ($show_event_col) {
$severity_col->setColSpan(2);
}
$table->addRow(array($open_close, $config['event_ack_enable'] ? $show_event_col ? null : new CCheckBox('triggers[' . $trigger['triggerid'] . ']', 'no', null, $trigger['triggerid']) : null, $severity_col, $status, $lastchange, zbx_date2age($trigger['lastchange']), $show_event_col ? SPACE : NULL, $to_ack, get_node_name_by_elid($trigger['triggerid']), $host, $tr_desc, new CLink(zbx_empty($trigger['comments']) ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $trigger['triggerid'])), 'even_row');
if ($show_events != EVENTS_OPTION_NOEVENT) {
$i = 1;
foreach ($trigger['events'] as $enum => $row_event) {
$i++;
$status = new CSpan(trigger_value2str($row_event['value']), get_trigger_value_style($row_event['value']));
if ($config['event_ack_enable']) {
if ($row_event['value'] == TRIGGER_VALUE_TRUE) {
if ($row_event['acknowledged'] == 1) {
$acks_cnt = DBfetch(DBselect('SELECT COUNT(*) as cnt FROM acknowledges WHERE eventid=' . $row_event['eventid']));
$ack = array(new CSpan(S_YES, 'off'), SPACE . '(' . $acks_cnt['cnt'] . SPACE, new CLink(S_SHOW, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file']), ')');
} else {
$ack = new CLink(S_NOT_ACKNOWLEDGED, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file'], 'on');
}
} else {
$ack = SPACE;
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:tr_status.php
示例7: 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;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:21,代码来源:triggers.inc.php
示例8: make_trigger_details
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;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:14,代码来源:triggers.inc.php
示例9: url_param
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);
// $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(S_MINUS_OTHER_MINUS), SPACE . '(' . $db_host['item_cnt'] . SPACE . S_ITEMS . ')'));
$col->SetColSpan(5);
$table->AddRow(array(get_node_name_by_elid($db_host['hostid']), $_REQUEST['hostid'] > 0 ? NULL : $db_host['host'], $col));
foreach ($app_rows as $row) {
$table->AddRow($row);
}
}
$p_elements[] = $table;
/*
// Refresh tab
$refresh_tab = array(
array('id' => ZBX_PAGE_MAIN_HAT,
'interval' => $USER_DETAILS['refresh'],
'url' => zbx_empty($_SERVER['QUERY_STRING'])?'':'?'.$_SERVER['QUERY_STRING'],
)
);
//*/
$url = '?fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1');
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:latest.php
示例10: CTextBox
$itemForm->addVar('delta', $this->data['delta']);
$deltaComboBox = new CTextBox('delta_name', $deltaOptions[$this->data['delta']], null, 'yes');
} else {
$deltaComboBox = new CComboBox('delta', $this->data['delta']);
$deltaComboBox->addItems($deltaOptions);
}
$itemFormList->addRow(_('Store value'), $deltaComboBox, false, 'row_delta');
// append valuemap to form list
if ($this->data['limited']) {
$itemForm->addVar('valuemapid', $this->data['valuemapid']);
$valuemapComboBox = new CTextBox('valuemap_name', !empty($this->data['valuemaps']) ? $this->data['valuemaps'] : _('As is'), ZBX_TEXTBOX_SMALL_SIZE, 'yes');
} else {
$valuemapComboBox = new CComboBox('valuemapid', $this->data['valuemapid']);
$valuemapComboBox->addItem(0, _('As is'));
foreach ($this->data['valuemaps'] as $valuemap) {
$valuemapComboBox->addItem($valuemap['valuemapid'], get_node_name_by_elid($valuemap['valuemapid'], null, NAME_DELIMITER) . CHtml::encode($valuemap['name']));
}
}
$link = new CLink(_('show value mappings'), 'adm.valuemapping.php');
$link->setAttribute('target', '_blank');
$itemFormList->addRow(_('Show value'), array($valuemapComboBox, SPACE, $link), null, 'row_valuemap');
$itemFormList->addRow(_('Allowed hosts'), new CTextBox('trapper_hosts', $this->data['trapper_hosts'], ZBX_TEXTBOX_STANDARD_SIZE), false, 'row_trapper_hosts');
// append applications to form list
$itemFormList->addRow(_('New application'), new CTextBox('new_application', $this->data['new_application'], ZBX_TEXTBOX_STANDARD_SIZE), false, null, 'new');
$applicationComboBox = new CListBox('applications[]', $this->data['applications'], 6);
$applicationComboBox->addItem(0, '-' . _('None') . '-');
foreach ($this->data['db_applications'] as $application) {
$applicationComboBox->addItem($application['applicationid'], CHtml::encode($application['name']));
}
$itemFormList->addRow(_('Applications'), $applicationComboBox);
// append populate host to form list
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:configuration.item.edit.php
示例11: array
}
// new operation
if (!empty($data['new_operation'])) {
if (!is_array($data['new_operation'])) {
$data['new_operation'] = array('action' => 'create', 'operationtype' => 0, 'esc_period' => 0, 'esc_step_from' => 1, 'esc_step_to' => 1, 'evaltype' => 0);
}
}
// render view
$actionView = new CView('configuration.action.edit', $data);
$actionView->render();
$actionView->show();
} else {
$data = array('eventsource' => getRequest('eventsource', CProfile::get('web.actionconf.eventsource', EVENT_SOURCE_TRIGGERS)), 'displayNodes' => is_array(get_current_nodeid()));
$sortfield = getPageSortField('name');
$data['actions'] = API::Action()->get(array('output' => API_OUTPUT_EXTEND, 'filter' => array('eventsource' => array($data['eventsource'])), 'selectConditions' => API_OUTPUT_EXTEND, 'selectOperations' => API_OUTPUT_EXTEND, 'editable' => true, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1));
// sorting && paging
order_result($data['actions'], $sortfield, getPageSortOrder());
$data['paging'] = getPagingLine($data['actions'], array('actionid'));
// nodes
if ($data['displayNodes']) {
foreach ($data['actions'] as &$action) {
$action['nodename'] = get_node_name_by_elid($action['actionid'], true);
}
unset($action);
}
// render view
$actionView = new CView('configuration.action.list', $data);
$actionView->render();
$actionView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:hujingguang,项目名称:work,代码行数:31,代码来源:actionconf.php
示例12: get_actions_hint_by_eventid
function get_actions_hint_by_eventid($eventid, $status = NULL)
{
$hostids = array();
$sql = 'SELECT DISTINCT i.hostid ' . ' FROM events e, functions f, items i ' . ' WHERE e.eventid=' . $eventid . ' AND e.objectid=' . EVENT_SOURCE_TRIGGERS . ' AND f.triggerid=' . $_REQUEST['triggerid'] . ' AND i.itemid=f.itemid';
if ($host = DBfetch(DBselect($sql, 1))) {
$hostids[$host['hostid']] = $host['hostid'];
}
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, $hostids);
$tab_hint = new CTableInfo(S_NO_ACTIONS_FOUND);
$tab_hint->addOption('style', 'width: 300px;');
$tab_hint->SetHeader(array(is_show_subnodes() ? S_NODES : null, S_USER, S_DETAILS, S_STATUS));
/*
$sql = 'SELECT DISTINCT a.alertid,mt.description,a.sendto,a.status,u.alias,a.retries '.
' FROM events e,users u,alerts a'.
' left join media_type mt on mt.mediatypeid=a.mediatypeid'.
' WHERE a.eventid='.$eventid.
(is_null($status)?'':' AND a.status='.$status).
' AND e.eventid = a.eventid'.
' AND a.alerttype IN ('.ALERT_TYPE_MESSAGE.','.ALERT_TYPE_COMMAND.')'.
' AND '.DBcondition('e.objectid',$available_triggers).
' AND '.DBin_node('a.alertid').
' AND u.userid=a.userid '.
' ORDER BY mt.description';
//*/
$sql = 'SELECT DISTINCT a.alertid,mt.description,u.alias,a.subject,a.message,a.sendto,a.status,a.retries,a.alerttype ' . ' FROM events e,alerts a ' . ' LEFT JOIN users u ON u.userid=a.userid ' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid' . ' WHERE a.eventid=' . $eventid . (is_null($status) ? '' : ' AND a.status=' . $status) . ' AND e.eventid = a.eventid' . ' AND a.alerttype IN (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND ' . DBcondition('e.objectid', $available_triggers) . ' AND ' . DBin_node('a.alertid') . ' ORDER BY a.alertid';
$result = DBselect($sql, 30);
while ($row = DBfetch($result)) {
if ($row["status"] == ALERT_STATUS_SENT) {
$status = new CSpan(S_SENT, "green");
$retries = new CSpan(SPACE, "green");
} else {
if ($row["status"] == ALERT_STATUS_NOT_SENT) {
$status = new CSpan(S_IN_PROGRESS, "orange");
$retries = new CSpan(ALERT_MAX_RETRIES - $row["retries"], "orange");
} else {
$status = new CSpan(S_NOT_SENT, "red");
$retries = new CSpan(0, "red");
}
}
switch ($row['alerttype']) {
case ALERT_TYPE_MESSAGE:
$message = empty($row['description']) ? '-' : $row['description'];
break;
case ALERT_TYPE_COMMAND:
$message = array(bold(S_COMMAND . ':'));
$msg = explode("\n", $row['message']);
foreach ($msg as $m) {
array_push($message, BR(), $m);
}
break;
default:
$message = '-';
}
$tab_hint->addRow(array(get_node_name_by_elid($row['alertid']), empty($row['alias']) ? ' - ' : $row['alias'], $message, $status));
}
return $tab_hint;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:57,代码来源:actions.inc.php
示例13: foreach
$caption[] = ' (';
foreach ($templates[$template['templateid']]['parentTemplates'] as $tpl) {
$caption[] = new CLink(CHtml::encode($tpl['name']), 'templates.php?form=update&templateid=' . $tpl['templateid'], 'unknown');
$caption[] = ', ';
}
array_pop($caption);
$caption[] = ')';
}
$hostTemplates[] = $caption;
$hostTemplates[] = ', ';
}
if ($hostTemplates) {
array_pop($hostTemplates);
}
}
$table->addRow(array(new CCheckBox('hosts[' . $host['hostid'] . ']', null, null, $host['hostid']), $displayNodes ? get_node_name_by_elid($host['hostid'], true) : null, $description, $applications, $items, $triggers, $graphs, $discoveries, $httpTests, $hostInterface, new CCol($hostTemplates, 'wraptext'), $status, getAvailabilityTable($host)));
}
$goBox = new CComboBox('go');
$goBox->addItem('export', _('Export selected'));
$goBox->addItem('massupdate', _('Mass update'));
$goOption = new CComboItem('activate', _('Enable selected'));
$goOption->setAttribute('confirm', _('Enable selected hosts?'));
$goBox->addItem($goOption);
$goOption = new CComboItem('disable', _('Disable selected'));
$goOption->setAttribute('confirm', _('Disable selected hosts?'));
$goBox->addItem($goOption);
$goOption = new CComboItem('delete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected hosts?'));
$goBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
$goButton->setAttribute('id', 'goButton');
开发者ID:micromachine,项目名称:RackTables-ZABBIX-bridge,代码行数:31,代码来源:hosts.php
示例14: get_actions_hint_by_eventid
function get_actions_hint_by_eventid($eventid, $status = null)
{
$tab_hint = new CTableInfo(_('No actions found.'));
$tab_hint->setAttribute('style', 'width: 300px;');
$tab_hint->setHeader(array(is_show_all_nodes() ? _('Nodes') : null, _('User'), _('Details'), _('Status')));
$sql = 'SELECT a.alertid,mt.description,u.alias,u.name,u.surname,a.subject,a.message,a.sendto,a.status,a.retries,a.alerttype' . ' FROM events e,alerts a' . ' LEFT JOIN users u ON u.userid=a.userid' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid' . ' WHERE a.eventid=' . zbx_dbstr($eventid) . (is_null($status) ? '' : ' AND a.status=' . $status) . ' AND e.eventid=a.eventid' . ' AND a.alerttype IN (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . andDbNode('a.alertid') . ' ORDER BY a.alertid';
$result = DBselect($sql, 30);
while ($row = DBfetch($result)) {
if ($row['status'] == ALERT_STATUS_SENT) {
$status = new CSpan(_('Sent'), 'green');
} elseif ($row['status'] == ALERT_STATUS_NOT_SENT) {
$status = new CSpan(_('In progress'), 'orange');
} else {
$status = new CSpan(_('not sent'), 'red');
}
switch ($row['alerttype']) {
case ALERT_TYPE_MESSAGE:
$message = empty($row['description']) ? '-' : $row['description'];
break;
case ALERT_TYPE_COMMAND:
$message = array(bold(_('Command') . NAME_DELIMITER));
$msg = explode("\n", $row['message']);
foreach ($msg as $m) {
array_push($message, BR(), $m);
}
break;
default:
$message = '-';
}
if (!$row['alias']) {
$row['alias'] = ' - ';
} else {
$fullname = '';
if ($row['name']) {
$fullname = $row['name'];
}
if ($row['surname']) {
$fullname .= $fullname ? ' ' . $row['surname'] : $row['surname'];
}
if ($fullname) {
$row['alias'] .= ' (' . $fullname . ')';
}
}
$tab_hint->addRow(array(get_node_name_by_elid($row['alertid']), $row['alias'], $message, $status));
}
return $tab_hint;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:47,代码来源:actions.inc.php
示例15: check_fields
check_fields($fields);
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY, get_current_nodeid(true));
$items = get_request('items', array());
asort_by_key($items, 'sortorder');
foreach ($items as $id => $gitem) {
if (!($host = DBfetch(DBselect('select h.* from hosts h,items i where h.hostid=i.hostid and i.itemid=' . $gitem['itemid'])))) {
fatal_error(S_NO_ITEM_DEFINED);
}
if (!isset($available_hosts[$host['hostid']])) {
access_deny();
}
}
$graph = new CChart(get_request('graphtype', GRAPH_TYPE_NORMAL));
$chart_header = '';
if (id2nodeid($host['hostid']) != get_current_nodeid()) {
$chart_header = get_node_name_by_elid($host['hostid'], true);
}
$chart_header .= $host['host'] . ':' . get_request('name', '');
$graph->setHeader($chart_header);
unset($host);
if (isset($_REQUEST['period'])) {
$graph->setPeriod($_REQUEST['period']);
}
if (isset($_REQUEST['from'])) {
$graph->setFrom($_REQUEST['from']);
}
if (isset($_REQUEST['stime'])) {
$graph->setSTime($_REQUEST['stime']);
}
if (isset($_REQUEST['border'])) {
$graph->etBorder(0);
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:chart3.php
示例16: get_request
} else {
$severity = get_request('severity', array(0, 1, 2, 3, 4, 5));
}
$media = get_request('media', -1);
$sendto = get_request('sendto', '');
$mediatypeid = get_request('mediatypeid', 0);
$active = get_request('active', 0);
$period = get_request('period', '1-7,00:00-23:59');
$frmMedia = new CFormTable(S_NEW_MEDIA);
$frmMedia->SetHelp("web.media.php");
$frmMedia->AddVar("media", $media);
$frmMedia->AddVar("dstfrm", $_REQUEST["dstfrm"]);
$cmbType = new CComboBox("mediatypeid", $mediatypeid);
$types = DBselect('SELECT mediatypeid,description ' . ' FROM media_type' . ' WHERE ' . DBin_node('mediatypeid') . ' ORDER BY type');
while ($type = DBfetch($types)) {
$cmbType->AddItem($type["mediatypeid"], get_node_name_by_elid($type["mediatypeid"]) . $type["description"]);
}
$frmMedia->AddRow(S_TYPE, $cmbType);
$frmMedia->AddRow(S_SEND_TO, new CTextBox("sendto", $sendto, 20));
$frmMedia->AddRow(S_WHEN_ACTIVE, new CTextBox("period", $period, 48));
$frm_row = array();
for ($i = 0; $i <= 5; $i++) {
array_push($frm_row, array(new CCheckBox("severity[{$i}]", str_in_array($i, $severity) ? 'yes' : 'no', null, $i), get_severity_description($i)), BR());
}
$frmMedia->AddRow(S_USE_IF_SEVERITY, $frm_row);
$cmbStat = new CComboBox("active", $active);
$cmbStat->AddItem(0, S_ENABLED);
$cmbStat->AddItem(1, S_DISABLED);
$frmMedia->AddRow("Status", $cmbStat);
$frmMedia->AddItemToBottomRow(new CButton("add", $media > -1 ? S_SAVE : S_ADD));
$frmMedia->AddItemToBottomRow(SPACE);
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:popup_media.php
示例17: 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';
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:events.php
示例18: get_request
$severity = get_request('severity', array(0, 1, 2, 3, 4, 5));
}
$media = get_request('media', -1);
$sendto = get_request('sendto', '');
$mediatypeid = get_request('mediatypeid', 0);
$active = get_request('active', 0);
$period = get_request('period', '1-7,00:00-23:59');
$frmMedia = new CFormTable(S_NEW_MEDIA);
$frmMedia->SetHelp('web.media.php');
$frmMedia->addVar('media', $media);
$frmMedia->addVar('dstfrm', $_REQUEST['dstfrm']);
$cmbType = new CComboBox('mediatypeid', $mediatypeid);
$sql = 'SELECT mediatypeid,description ' . ' FROM media_type' . ' WHERE ' . DBin_node('mediatypeid') . ' ORDER BY type';
$types = DBselect($sql);
while ($type = DBfetch($types)) {
$cmbType->addItem($type['mediatypeid'], get_node_name_by_elid($type['mediatypeid'], null, ': ') . $type['description']);
}
$frmMedia->addRow(S_TYPE, $cmbType);
$frmMedia->addRow(S_SEND_TO, new CTextBox('sendto', $sendto, 20));
$frmMedia->addRow(S_WHEN_ACTIVE, new CTextBox('period', $period, 48));
$frm_row = array();
for ($i = 0; $i <= 5; $i++) {
array_push($frm_row, array(new CCheckBox('severity[' . $i . ']', str_in_array($i, $severity) ? 'yes' : 'no', null, $i), get_severity_description($i)), BR());
}
$frmMedia->addRow(S_USE_IF_SEVERITY, $frm_row);
$cmbStat = new CComboBox('active', $active);
$cmbStat->addItem(0, S_ENABLED);
$cmbStat->addItem(1, S_DISABLED);
$frmMedia->addRow(S_STATUS, $cmbStat);
$frmMedia->addItemToBottomRow(new CButton('add', $media > -1 ? S_SAVE : S_ADD));
$frmMedia->addItemToBottomRow(SPACE);
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:popup_media.php
示例19: CTweenBox
}
$cmbHosts = new CTweenBox($frmHostG, 'hosts', $hosts, 25);
// get hosts from selected twb_groupid combo
$params = array('groupids' => $twb_groupid, 'templated_hosts' => 1, 'order' => 'host', 'editable' => 1, 'extendoutput' => 1);
$db_hosts = CHost::get($params);
foreach ($db_hosts as $hostid => $db_host) {
// add all except selected hosts
if (!isset($hosts[$hostid])) {
$cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $db_host['host']);
}
}
// select selected hosts and add them
$params = array('hostids' => $hosts, 'templated_hosts' => 1, 'order' => 'host', 'editable' => 1, 'extendoutput' => 1);
$db_hosts = CHost::get($params);
foreach ($db_hosts as $hostid => $db_host) {
$cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $db_host['host']);
}
$frmHostG->addRow(S_HOSTS, $cmbHosts->Get(S_HOSTS . SPACE . S_IN, array(S_OTHER . SPACE . S_HOSTS . SPACE . '|' . SPACE . S_GROUP . SPACE, $cmbGroups)));
$frmHostG->addItemToBottomRow(new CButton('save', S_SAVE));
if ($groupid > 0) {
$frmHostG->addItemToBottomRow(SPACE);
$frmHostG->addItemToBottomRow(new CButton('clone', S_CLONE));
$frmHostG->addItemToBottomRow(SPACE);
$dltButton = new CButtonDelete('Delete selected group?', url_param('form') . url_param('config') . url_param('groupid'));
$dlt_groups = getDeletableHostGroups($_REQUEST['groupid']);
if (empty($dlt_groups)) {
$dltButton->setAttribute('disabled', 'disabled');
}
$frmHostG->addItemToBottomRow($dltButton);
}
$frmHostG->addItemToBottomRow(SPACE);
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:hostgroups.php
示例20: url_param
}
} else {
if (empty($apps)) {
$url = '?open=1&applicationid=0';
} else {
if (isset($apps[0])) {
$url = '?close=1' . url_param($tmp_apps, false, 'apps');
} else {
$url = '?close=1&applicationid=0' . url_param($tmp_apps, false, 'apps');
}
}
}
$url .= url_param('groupid') . url_param('hostid') . url_param('fullscreen') . url_param('select');
$link = new CLink($img, $url);
$col = new CCol(array(bold('- ' . 'other' . ' -'), SPACE . '(' . _n('%1$s Item', '%1$s Items', $db_host['item_cnt']) . ')'));
$col->setColSpan(5);
// host JS menu link
$hostSpan = null;
if ($_REQUEST['hostid'] == 0) {
$hostSpan = new
|
请发表评论