本文整理汇总了PHP中expand_trigger_description_by_data函数的典型用法代码示例。如果您正苦于以下问题:PHP expand_trigger_description_by_data函数的具体用法?PHP expand_trigger_description_by_data怎么用?PHP expand_trigger_description_by_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expand_trigger_description_by_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: CLink
// We add 1 to event start url, so events would show it
$clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row['lastchange']), 'events.php?triggerid=' . $row['triggerid'] . '&nav_time=' . ($row['lastchange'] + 1), 'action');
//--
$table->addRow(array($show_event_col ? SPACE : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row['value'])), $value, $clock, get_node_name_by_elid($row['triggerid']), $host, $tr_desc, $actions, $show_event_col ? SPACE : NULL, new CLink(zbx_empty($row['comments']) ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action')));
$event_limit = 0;
foreach ($row['events'] as $eventid => $row_event) {
$value = new CSpan(trigger_value2str($row_event['value']), get_trigger_value_style($row_event['value']));
if ($config['event_ack_enable']) {
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'], 'action'), ')');
} else {
$ack = new CLink(S_NOT_ACKNOWLEDGED, 'acknow.php?eventid=' . $row_event['eventid'], 'on');
}
}
$description = expand_trigger_description_by_data(array_merge($row, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
$font = new CTag('font', 'yes');
$font->setAttribute('color', '#808080');
$font->addItem(array(' - ', $description));
$description = $font;
$description = new CCol($description);
$description->setAttribute('style', 'white-space: normal; width: 90%;');
$clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row_event['eventid'], 'action');
$table->addRow(array($config['event_ack_enable'] ? $row_event['acknowledged'] == 1 ? SPACE : new CCheckBox('events[' . $row_event['eventid'] . ']', 'no', NULL, $row_event['eventid']) : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row_event['value'])), $value, $clock, get_node_name_by_elid($row['triggerid']), $host, $description, $actions, $config['event_ack_enable'] ? new CCol($ack, 'center') : NULL, new CLink($row['comments'] == '' ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action')));
$event_limit++;
if ($event_limit >= $config['event_show_max']) {
break;
}
}
unset($row, $description, $actions);
}
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:tr_status.php
示例2: CTableInfo
}
$sql_cond = $show_unknown == 0 ? ' AND e.value<>' . TRIGGER_VALUE_UNKNOWN . ' ' : '';
$sql_cond .= ' AND e.clock<' . $time_end;
$table = new CTableInfo(S_NO_EVENTS_FOUND);
$table->setHeader(array(make_sorting_link(S_TIME, 'clock'), is_show_all_nodes() ? S_NODE : null, $_REQUEST['hostid'] == 0 ? S_HOST : null, make_sorting_link(S_DESCRIPTION, 'desc'), make_sorting_link(S_STATUS, 'status'), make_sorting_link(S_SEVERITY, 'priority'), S_DURATION, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
if (!empty($triggers)) {
$clock = array();
$events = array();
$sql = 'SELECT e.eventid, e.objectid as triggerid, e.clock, e.value, e.acknowledged ' . ' FROM events e ' . ' WHERE ' . DBcondition('e.objectid', $triggerids) . ' AND (e.object+0)=' . EVENT_OBJECT_TRIGGER . $sql_cond . ' ORDER BY e.clock DESC';
$result = DBselect($sql, 0 == $show_unknown ? $limit * 50 : $limit);
while (($row = DBfetch($result)) && $col < $limit) {
$row = array_merge($triggers[$row['triggerid']], $row);
if (0 == $show_unknown && !event_initial_time($row, $show_unknown)) {
continue;
}
$row['desc'] = expand_trigger_description_by_data($row, ZBX_FLAG_EVENT);
$row['duration'] = zbx_date2age($row['clock']);
if ($next_event = get_next_event($row, $show_unknown)) {
$row['duration'] = zbx_date2age($row['clock'], $next_event['clock']);
}
$row['value'] = new CCol(trigger_value2str($row['value']), get_trigger_value_style($row['value']));
$col++;
$clock[] = $row['clock'];
$events[] = $row;
}
$last_clock = !empty($clock) ? min($clock) : null;
order_page_result($events, 'clock', ZBX_SORT_DOWN);
foreach ($events as $num => $row) {
// Actions
$actions = get_event_actions_status($row['eventid']);
//--------
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:events.php
示例3: insert_map_element_form
function insert_map_element_form()
{
global $USER_DETAILS;
$frmEl = new CFormTable('New map element', 'sysmap.php');
$frmEl->SetHelp('web.sysmap.host.php');
$frmEl->addVar('sysmapid', $_REQUEST['sysmapid']);
if (isset($_REQUEST['selementid'])) {
$frmEl->addVar('selementid', $_REQUEST['selementid']);
$element = get_sysmaps_element_by_selementid($_REQUEST['selementid']);
$frmEl->SetTitle('Map element "' . $element['label'] . '"');
}
if (isset($_REQUEST['selementid']) && !isset($_REQUEST['form_refresh'])) {
$elementid = $element['elementid'];
$elementtype = $element['elementtype'];
$label = $element['label'];
$x = $element['x'];
$y = $element['y'];
$url = $element['url'];
$iconid_off = $element['iconid_off'];
$iconid_on = $element['iconid_on'];
$iconid_unknown = $element['iconid_unknown'];
$iconid_disabled = $element['iconid_disabled'];
$label_location = $element['label_location'];
if (is_null($label_location)) {
$label_location = -1;
}
} else {
$elementid = get_request('elementid', 0);
$elementtype = get_request('elementtype', SYSMAP_ELEMENT_TYPE_HOST);
$label = get_request('label', '');
$x = get_request('x', 0);
$y = get_request('y', 0);
$url = get_request('url', '');
$iconid_off = get_request('iconid_off', 0);
$iconid_on = get_request('iconid_on', 0);
$iconid_unknown = get_request('iconid_unknown', 0);
$iconid_disabled = get_request('iconid_disabled', 0);
$label_location = get_request('label_location', '-1');
}
$cmbType = new CComboBox('elementtype', $elementtype, 'submit()');
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, null, get_current_nodeid(true));
$sql = 'SELECT DISTINCT n.name as node_name,h.hostid,h.host ' . ' FROM hosts h' . ' LEFT JOIN nodes n on n.nodeid=' . DBid2nodeid('h.hostid') . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . ' ORDER BY node_name,h.host';
$db_hosts = DBselect($sql);
if ($db_hosts) {
$cmbType->addItem(SYSMAP_ELEMENT_TYPE_HOST, S_HOST);
}
$db_maps = DBselect('SELECT sysmapid FROM sysmaps WHERE sysmapid!=' . $_REQUEST['sysmapid']);
if (DBfetch($db_maps)) {
$cmbType->addItem(SYSMAP_ELEMENT_TYPE_MAP, S_MAP);
}
$cmbType->addItem(SYSMAP_ELEMENT_TYPE_TRIGGER, S_TRIGGER);
$cmbType->addItem(SYSMAP_ELEMENT_TYPE_HOST_GROUP, S_HOST_GROUP);
$cmbType->addItem(SYSMAP_ELEMENT_TYPE_IMAGE, S_IMAGE);
$frmEl->addRow(S_TYPE, $cmbType);
$frmEl->addRow(S_LABEL, new CTextArea('label', $label, 32, 4));
$cmbLocation = new CComboBox('label_location', $label_location);
$cmbLocation->addItem(-1, '-');
$cmbLocation->addItem(0, S_BOTTOM);
$cmbLocation->addItem(1, S_LEFT);
$cmbLocation->addItem(2, S_RIGHT);
$cmbLocation->addItem(3, S_TOP);
$frmEl->addRow(S_LABEL_LOCATION, $cmbLocation);
if ($elementtype == SYSMAP_ELEMENT_TYPE_HOST) {
$host = '';
$host_info = DBfetch(DBselect('SELECT DISTINCT n.name as node_name,h.hostid,h.host ' . ' FROM hosts h ' . ' LEFT JOIN nodes n ON n.nodeid=' . DBid2nodeid('h.hostid') . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . ' AND hostid=' . $elementid . ' ORDER BY node_name,h.host'));
if ($host_info) {
$host = $host_info['host'];
} else {
$elementid = 0;
}
if ($elementid == 0) {
$host = '';
$elementid = 0;
}
$frmEl->addVar('elementid', $elementid);
$frmEl->addRow(S_HOST, array(new CTextBox('host', $host, 32, 'yes'), new CButton('btn1', S_SELECT, "return PopUp('popup.php?dstfrm=" . $frmEl->GetName() . "&dstfld1=elementid&dstfld2=host&srctbl=hosts&srcfld1=hostid&srcfld2=host',450,450);", 'T')));
} else {
if ($elementtype == SYSMAP_ELEMENT_TYPE_MAP) {
$cmbMaps = new CComboBox('elementid', $elementid);
$db_maps = DBselect('SELECT DISTINCT n.name as node_name,s.sysmapid,s.name ' . ' FROM sysmaps s' . ' LEFT JOIN nodes n on n.nodeid=' . DBid2nodeid('s.sysmapid') . ' ORDER BY node_name,s.name');
while ($db_map = DBfetch($db_maps)) {
if (!sysmap_accessible($db_map['sysmapid'], PERM_READ_ONLY)) {
continue;
}
$node_name = isset($db_map['node_name']) ? '(' . $db_map['node_name'] . ') ' : '';
$cmbMaps->addItem($db_map['sysmapid'], $node_name . $db_map['name']);
}
$frmEl->addRow(S_MAP, $cmbMaps);
} else {
if ($elementtype == SYSMAP_ELEMENT_TYPE_TRIGGER) {
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_IDS_ARRAY, get_current_nodeid(true));
$trigger = '';
$trigger_info = DBfetch(DBselect('SELECT DISTINCT n.name as node_name,h.hostid,h.host,t.*' . ' FROM triggers t ' . ' LEFT JOIN functions f on t.triggerid=f.triggerid ' . ' LEFT JOIN items i on i.itemid=f.itemid ' . ' LEFT JOIN hosts h on h.hostid=i.hostid ' . ' LEFT JOIN nodes n on n.nodeid=' . DBid2nodeid('t.triggerid') . ' WHERE t.triggerid=' . $elementid . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' ORDER BY node_name,h.host,t.description'));
if ($trigger_info) {
$trigger = expand_trigger_description_by_data($trigger_info);
} else {
$elementid = 0;
}
if ($elementid == 0) {
$trigger = '';
//.........这里部分代码省略.........
开发者ID:rennhak,项目名称:zabbix,代码行数:101,代码来源:forms.inc.php
示例4: imagecolorallocate
$green = imagecolorallocate($im, 0, 255, 0);
$darkgreen = imagecolorallocate($im, 0, 150, 0);
$bluei = imagecolorallocate($im, 0, 0, 255);
$darkblue = imagecolorallocate($im, 0, 0, 150);
$yellow = imagecolorallocate($im, 255, 255, 0);
$darkyellow = imagecolorallocate($im, 150, 150, 0);
$cyan = imagecolorallocate($im, 0, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 150, 150, 150);
$white = imagecolorallocate($im, 255, 255, 255);
$bg = imagecolorallocate($im, 6 + 6 * 16, 7 + 7 * 16, 8 + 8 * 16);
$x = imagesx($im);
$y = imagesy($im);
imagefilledrectangle($im, 0, 0, $x, $y, $white);
imagerectangle($im, 0, 0, $x - 1, $y - 1, $black);
$str = expand_trigger_description_by_data($db_data);
$str = $str . ' (year ' . date('Y') . ')';
$x = imagesx($im) / 2 - imagefontwidth(4) * strlen($str) / 2;
imagestring($im, 4, $x, 1, $str, $darkred);
$now = time(NULL);
$count_now = array();
$true = array();
$false = array();
$unknown = array();
$year = date('Y');
$start = mktime(0, 0, 0, 1, 1, $year);
$wday = date('w', $start);
if ($wday == 0) {
$wday = 7;
}
$start = $start - ($wday - 1) * 24 * 3600;
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:chart4.php
示例5: CButton
$cmbType->addItem($i, $value);
}
//---
$btnSelect = new CButton('btn1', S_SELECT, "return PopUp('popup.php?srctbl=triggers" . '&srcfld1=triggerid' . '&real_hosts=1' . '&reference=linktrigger' . '&multiselect=1' . "&writeonly=1');", 'T');
$btnSelect->setType('button');
$btnRemove = new CButton('remove', S_REMOVE);
// END preparation
$trList = new CListBox('del_linktriggers[]', null, 15);
if (empty($triggers)) {
$trList->setAttribute('style', 'width: 300px;');
}
foreach ($triggers as $tnum => $trigger) {
$dbTriggers = CTrigger::get($options);
order_result($dbTriggers, 'description');
$host = reset($trigger['hosts']);
$trList->addItem($trigger['triggerid'], $host['host'] . ':' . expand_trigger_description_by_data($trigger));
}
$frmCnct->addRow(S_TRIGGERS, array($trList, BR(), $btnSelect, $btnRemove));
$frmCnct->addRow(S_TYPE . ' (' . S_PROBLEM_BIG . ')', $cmbType);
$frmCnct->addRow(S_COLOR . ' (' . S_PROBLEM_BIG . ')', new CColor('color', $color));
$frmCnct->addItemToBottomRow(new CButton('save', isset($_REQUEST['triggerid']) ? S_SAVE : S_ADD));
$frmCnct->addItemToBottomRow(SPACE);
$frmCnct->addItemToBottomRow(new CButton('cancel', S_CANCEL, 'javascript: window.close();'));
$frmCnct->show();
}
?>
<script type="text/javascript">
//<!--<![CDATA[
function addPopupValues(list){
if(!isset('object', list)) return false;
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:30,代码来源:popup_link_tr.php
示例6: str_in_array
$i['value_type'] = $item['value_type'];
//ZBX-3059: So it would be possible to show different caption for history for chars and numbers (KB)
$i['action'] = str_in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues';
$i['description'] = item_description($item);
$items[] = $i;
}
// Actions
$actions = get_event_actions_status($event['eventid']);
if ($config['event_ack_enable']) {
if ($event['acknowledged'] == 1) {
$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();
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:events.php
示例7: expand_trigger_description_simple
function expand_trigger_description_simple($triggerid)
{
$sql = 'SELECT DISTINCT t.description,h.host,t.expression,t.triggerid ' . ' FROM triggers t ' . ' LEFT JOIN functions f on t.triggerid=f.triggerid ' . ' LEFT JOIN items i on f.itemid=i.itemid ' . ' LEFT JOIN hosts h on i.hostid=h.hostid ' . ' WHERE t.triggerid=' . $triggerid;
return expand_trigger_description_by_data(DBfetch(DBselect($sql)));
}
开发者ID:rennhak,项目名称:zabbix,代码行数:5,代码来源:triggers.inc.php
示例8: foreach
foreach ($triggers as $tnum => $trigger) {
$host = reset($trigger['hosts']);
$trigger['host'] = $host['host'];
$description = new CSpan($trigger['description'], 'link');
$trigger['description'] = $trigger['host'] . ':' . $trigger['description'];
if ($multiselect) {
$js_action = "javascript: addValue(" . zbx_jsvalue($reference) . ", " . zbx_jsvalue($trigger[$srcfld1]) . ");";
} else {
$values = array($dstfld1 => $trigger[$srcfld1], $dstfld2 => $trigger[$srcfld2]);
$js_action = 'javascript: addValues(' . zbx_jsvalue($dstfrm) . ',' . zbx_jsvalue($values) . '); return false;';
}
$description->setAttribute('onclick', $js_action);
if (count($trigger['dependencies']) > 0) {
$description = array($description, BR(), bold(S_DEPENDS_ON), BR());
foreach ($trigger['dependencies'] as $val) {
$description[] = array(expand_trigger_description_by_data($val), BR());
}
}
switch ($trigger['status']) {
case TRIGGER_STATUS_DISABLED:
$status = new CSpan(S_DISABLED, 'disabled');
break;
case TRIGGER_STATUS_ENABLED:
$status = new CSpan(S_ENABLED, 'enabled');
break;
}
$table->addRow(array($multiselect ? new CCheckBox('triggers[' . zbx_jsValue($trigger[$srcfld1]) . ']', NULL, NULL, $trigger['triggerid']) : null, $description, new CCol(get_severity_description($trigger['priority']), get_severity_style($trigger['priority'])), $status));
}
if ($multiselect) {
$button = new CButton('select', S_SELECT, "javascript: addSelectedValues('triggers', " . zbx_jsvalue($reference) . ");");
$button->setType('button');
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:popup.php
示例9: make_latest_issues
function make_latest_issues($filter = array())
{
global $page;
$config = select_config();
$limit = isset($filter['limit']) ? $filter['limit'] : 20;
$options = array('groupids' => $filter['groupids'], 'monitored' => 1, 'maintenance' => $filter['maintenance'], 'skipDependent' => 1, 'filter' => array('priority' => $filter['severity'], 'value' => TRIGGER_VALUE_TRUE), 'select_groups' => API_OUTPUT_EXTEND, 'select_hosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND, 'sortfield' => 'lastchange', 'sortorder' => ZBX_SORT_DOWN, 'limit' => $limit);
if (isset($filter['hostids'])) {
$options['hostids'] = $filter['hostids'];
}
$triggers = CTrigger::get($options);
// GATHER HOSTS FOR SELECTED TRIGGERS {{{
$triggers_hosts = array();
foreach ($triggers as $tnum => $trigger) {
// if trigger is lost(broken expression) we skip it
if (empty($trigger['hosts'])) {
unset($triggers[$tnum]);
continue;
}
$triggers_hosts = array_merge($triggers_hosts, $trigger['hosts']);
}
$triggers_hosts = zbx_toHash($triggers_hosts, 'hostid');
$triggers_hostids = array_keys($triggers_hosts);
// }}} GATHER HOSTS FOR SELECTED TRIGGERS
$scripts_by_hosts = CScript::getScriptsByHosts($triggers_hostids);
$table = new CTableInfo();
$table->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST, S_ISSUE, S_LAST_CHANGE, S_AGE, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
$thosts_cache = array();
foreach ($triggers as $tnum => $trigger) {
// Check for dependencies
$group = reset($trigger['groups']);
$host = reset($trigger['hosts']);
$trigger['hostid'] = $host['hostid'];
$trigger['host'] = $host['host'];
$host = null;
$menus = '';
$host_nodeid = id2nodeid($trigger['hostid']);
foreach ($scripts_by_hosts[$trigger['hostid']] as $id => $script) {
$script_nodeid = id2nodeid($script['scriptid']);
if (bccomp($host_nodeid, $script_nodeid) == 0) {
$menus .= "[" . zbx_jsvalue($script['name']) . ",\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $trigger['hostid'] . "&scriptid=" . $script['scriptid'] . "','" . S_TOOLS . "',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
}
if (!empty($scripts_by_hosts)) {
$menus = "['" . S_TOOLS . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus;
}
if (isset($thosts_cache[$trigger['hostid']])) {
$hprofile = $thosts_cache[$trigger['hostid']];
} else {
$hprofile = CHost::get(array('hostids' => $trigger['hostid'], 'output' => API_OUTPUT_SHORTEN, 'select_profile' => API_OUTPUT_EXTEND));
$hprofile = reset($hprofile);
$thosts_cache[$hprofile['hostid']] = $hprofile;
}
$menus .= "['" . S_LINKS . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
$menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?groupid=" . $group['groupid'] . '&hostid=' . $trigger['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
if (!empty($hprofile['profile'])) {
$menus .= "['" . S_PROFILE . "',\"javascript: redirect('hostprofiles.php?hostid=" . $trigger['hostid'] . "&prof_type=0')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
if (!empty($hprofile['profile_ext'])) {
$menus .= "['" . S_EXTENDED_PROFILE . "',\"javascript: redirect('hostprofiles.php?hostid=" . $trigger['hostid'] . "&prof_type=1')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
$menus = rtrim($menus, ',');
$menus = 'show_popup_menu(event,[' . $menus . '],180);';
$host = new CSpan($trigger['host'], 'link_menu pointer');
$host->setAttribute('onclick', 'javascript: ' . $menus);
//$host = new CSpan($trigger['host'],'link_menu pointer');
//$host->setAttribute('onclick','javascript: '.$menus);
// Maintenance {{{
$trigger_host = $triggers_hosts[$trigger['hostid']];
$text = null;
$style = 'link_menu';
if ($trigger_host['maintenance_status']) {
$style .= ' orange';
$options = array('maintenanceids' => $trigger_host['maintenanceid'], 'output' => API_OUTPUT_EXTEND);
$maintenances = CMaintenance::get($options);
$maintenance = reset($maintenances);
$text = $maintenance['name'];
$text .= ' [' . ($trigger_host['maintenance_type'] ? S_NO_DATA_MAINTENANCE : S_NORMAL_MAINTENANCE) . ']';
}
$host = new CSpan($trigger['host'], $style . ' pointer');
$host->setAttribute('onclick', 'javascript: ' . $menus);
if (!is_null($text)) {
$host->setHint($text, '', '', false);
}
// }}} Maintenance
$event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged' . ' FROM events e' . ' WHERE e.object=' . EVENT_OBJECT_TRIGGER . ' AND e.objectid=' . $trigger['triggerid'] . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';
$res_events = DBSelect($event_sql, 1);
while ($row_event = DBfetch($res_events)) {
$ack = NULL;
if ($config['event_ack_enable']) {
if ($row_event['acknowledged'] == 1) {
$ack_info = make_acktab_by_eventid($row_event['eventid']);
$ack_info->setAttribute('style', 'width: auto;');
$ack = new CLink(S_YES, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file'], 'off');
$ack->setHint($ack_info, '', '', false);
} else {
$ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file'], 'on');
}
}
// $description = expand_trigger_description($row['triggerid']);
$description = expand_trigger_description_by_data(zbx_array_merge($trigger, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
//.........这里部分代码省略.........
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:blocks.inc.php
示例10: DBselect
}
if ($_REQUEST['hostid'] > 0) {
$sql_where .= ' AND h.hostid=' . $_REQUEST['hostid'];
}
} else {
if ($_REQUEST['hostid'] > 0) {
$sql_from .= ',hosts_templates ht ';
$sql_where .= ' AND ht.hostid=h.hostid AND ht.templateid=' . $_REQUEST['hostid'];
}
if (isset($_REQUEST['tpl_triggerid']) && $_REQUEST['tpl_triggerid'] > 0) {
$sql_where .= ' AND t.templateid=' . $_REQUEST['tpl_triggerid'];
}
}
$result = DBselect('SELECT DISTINCT h.hostid,h.host,t.triggerid,t.expression,t.description,t.value ' . ' FROM triggers t,hosts h,items i,functions f ' . $sql_from . ' WHERE h.status=' . HOST_STATUS_MONITORED . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND i.hostid=h.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND f.itemid=i.itemid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . $sql_where . ' ORDER BY h.host, t.description');
$table = new CTableInfo();
$table->setHeader(array(is_show_subnodes() ? S_NODE : null, $_REQUEST['hostid'] == 0 || 1 == $config ? S_HOST : NULL, S_NAME, S_TRUE, S_FALSE, S_UNKNOWN, S_GRAPH));
while ($row = DBfetch($result)) {
if (!check_right_on_trigger_by_triggerid(null, $row['triggerid'])) {
continue;
}
$availability = calculate_availability($row['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?hostid=' . $_REQUEST['hostid'] . '&triggerid=' . $row['triggerid'], 'action');
$table->addRow(array(get_node_name_by_elid($row['hostid']), $_REQUEST['hostid'] == 0 || 1 == $config ? $row['host'] : NULL, new CLink(expand_trigger_description_by_data($row), 'events.php?triggerid=' . $row['triggerid'], 'action'), $true, $false, $unknown, $actions));
}
$table->show();
}
}
include_once 'include/page_footer.php';
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:report2.php
示例11: getSelementsInfo
//.........这里部分代码省略.........
}
}
}
$all_triggers = zbx_toHash($all_triggers, 'triggerid');
$options = array('triggerids' => array_keys($all_triggers), 'withLastEventUnacknowledged' => true, 'output' => API_OUTPUT_SHORTEN, 'nodeids' => get_current_nodeid(true), 'nopermissions' => 1, 'monitored' => true, 'filter' => array('value' => TRIGGER_VALUE_TRUE));
$unack_triggerids = CTrigger::get($options);
$unack_triggerids = zbx_toHash($unack_triggerids, 'triggerid');
// }}}
$info = array();
foreach ($selements as $selementid => $selement) {
$i = array('disabled' => 0, 'maintenance' => 0, 'problem' => 0, 'problem_unack' => 0, 'unknown' => 0, 'priority' => 0, 'trigger_disabled' => 0, 'latelyChanged' => false, 'ack' => true);
foreach ($selement['hosts'] as $hostid) {
$host = $all_hosts[$hostid];
$last_hostid = $hostid;
if ($host['status'] == HOST_STATUS_NOT_MONITORED) {
$i['disabled']++;
} else {
if ($host['maintenance_status'] == HOST_MAINTENANCE_STATUS_ON) {
$i['maintenance']++;
}
}
}
foreach ($selement['triggers'] as $triggerid) {
$trigger = $all_triggers[$triggerid];
if ($trigger['status'] == TRIGGER_STATUS_DISABLED) {
$i['trigger_disabled']++;
} else {
if ($trigger['value'] == TRIGGER_VALUE_TRUE) {
$i['problem']++;
$last_problemid = $triggerid;
if ($i['priority'] < $trigger['priority']) {
$i['priority'] = $trigger['priority'];
}
} else {
if ($trigger['value'] == TRIGGER_VALUE_UNKNOWN) {
$i['unknown']++;
}
}
if (isset($unack_triggerids[$triggerid])) {
$i['problem_unack']++;
}
$i['latelyChanged'] |= time() - $trigger['lastchange'] < TRIGGER_BLINK_PERIOD;
}
}
$i['ack'] = (bool) (!$i['problem_unack']);
if ($sysmap['expandproblem'] && $i['problem'] == 1) {
$i['problem_title'] = expand_trigger_description_by_data($all_triggers[$last_problemid]);
}
if ($selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST && $i['maintenance'] == 1) {
$mnt = get_maintenance_by_maintenanceid($all_hosts[$last_hostid]['maintenanceid']);
$i['maintenance_title'] = $mnt['name'];
}
switch ($selement['elementtype']) {
case SYSMAP_ELEMENT_TYPE_MAP:
$info[$selementid] = getMapsInfo($selement, $i, $show_unack);
break;
case SYSMAP_ELEMENT_TYPE_HOST_GROUP:
$info[$selementid] = getHostGroupsInfo($selement, $i, $show_unack);
break;
case SYSMAP_ELEMENT_TYPE_HOST:
$info[$selementid] = getHostsInfo($selement, $i, $show_unack);
break;
case SYSMAP_ELEMENT_TYPE_TRIGGER:
$info[$selementid] = getTriggersInfo($selement, $i);
break;
case SYSMAP_ELEMENT_TYPE_IMAGE:
$info[$selementid] = getImagesInfo($selement);
break;
}
}
// get names if is needed
if ($sysmap['label_type'] == MAP_LABEL_TYPE_NAME) {
$elems = separateMapElements($sysmap);
if (!empty($elems['sysmaps'])) {
$maps = CMap::get(array('sysmapids' => zbx_objectValues($elems['sysmaps'], 'elementid'), 'nopermissions' => 1, 'output' => API_OUTPUT_EXTEND));
$maps = zbx_toHash($maps, 'sysmapid');
foreach ($elems['sysmaps'] as $elem) {
$info[$elem['selementid']]['name'] = $maps[$elem['elementid']]['name'];
}
}
if (!empty($elems['hostgroups'])) {
$hostgroups = CHostGroup::get(array('groupids' => zbx_objectValues($elems['hostgroups'], 'elementid'), 'nopermissions' => 1, 'output' => API_OUTPUT_EXTEND));
$hostgroups = zbx_toHash($hostgroups, 'groupid');
foreach ($elems['hostgroups'] as $elem) {
$info[$elem['selementid']]['name'] = $hostgroups[$elem['elementid']]['name'];
}
}
if (!empty($elems['triggers'])) {
foreach ($elems['triggers'] as $elem) {
$info[$elem['selementid']]['name'] = expand_trigger_description_by_data($all_triggers[$elem['elementid']]);
}
}
if (!empty($elems['hosts'])) {
foreach ($elems['hosts'] as $elem) {
$info[$elem['selementid']]['name'] = $all_hosts[$elem['elementid']]['host'];
}
}
}
return $info;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:maps.inc.php
示例12: get_info_by_selementid
function get_info_by_selementid($selementid)
{
global $colors;
$el_name = '';
$tr_info = array();
$db_element = get_sysmaps_element_by_selementid($selementid);
$el_type =& $db_element["elementtype"];
$sql = array(SYSMAP_ELEMENT_TYPE_TRIGGER => 'SELECT DISTINCT t.triggerid,t.priority,t.value,t.description' . ',t.expression,h.host,h.status as h_status,i.status as i_status,t.status as t_status' . ' FROM triggers t, items i, functions f, hosts h ' . ' WHERE t.triggerid=' . $db_element['elementid'] . ' AND h.hostid=i.hostid ' . ' AND i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid ', SYSMAP_ELEMENT_TYPE_HOST_GROUP => 'SELECT DISTINCT t.triggerid, t.priority, t.value, t.description, t.expression, h.host' . ' FROM items i,functions f,triggers t,hosts h,hosts_groups hg,groups g ' . ' WHERE h.hostid=i.hostid ' . ' AND hg.groupid=g.groupid ' . ' AND g.groupid=' . $db_element['elementid'] . ' AND hg.hostid=h.hostid ' . ' AND i.itemid=f.itemid' . ' AND f.triggerid=t.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE, SYSMAP_ELEMENT_TYPE_HOST => 'SELECT DISTINCT t.triggerid, t.priority, t.value, t.description, t.expression, h.host' . ' FROM items i,functions f,triggers t,hosts h WHERE h.hostid=i.hostid' . ' AND i.hostid=' . $db_element['elementid'] . ' AND i.itemid=f.itemid' . ' AND f.triggerid=t.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE);
$out['triggers'] = array();
if (isset($sql[$el_type])) {
$db_triggers = DBselect($sql[$el_type]);
$trigger = DBfetch($db_triggers);
if ($trigger) {
if ($el_type == SYSMAP_ELEMENT_TYPE_TRIGGER) {
$el_name = expand_trigger_description_by_data($trigger);
}
do {
if ($el_type == SYSMAP_ELEMENT_TYPE_TRIGGER && ($trigger['h_status'] != HOST_STATUS_MONITORED || $trigger['i_status'] != ITEM_STATUS_ACTIVE || $trigger['t_status'] != TRIGGER_STATUS_ENABLED)) {
$type = TRIGGER_VALUE_UNKNOWN;
$out['disabled'] = 1;
} else {
$type =& $trigger['value'];
}
if (!isset($tr_info[$type])) {
$tr_info[$type] = array('count' => 0);
}
$tr_info[$type]['count']++;
if (!isset($tr_info[$type]['priority']) || $tr_info[$type]['priority'] < $trigger["priority"]) {
$tr_info[$type]['priority'] = $trigger["priority"];
if ($el_type != SYSMAP_ELEMENT_TYPE_TRIGGER && $type != TRIGGER_VALUE_UNKNOWN) {
$tr_info[$type]['info'] = expand_trigger_description_by_data($trigger);
}
}
if ($type == TRIGGER_VALUE_TRUE) {
array_push($out['triggers'], $trigger['triggerid']);
}
} while ($trigger = DBfetch($db_triggers));
}
} else {
if ($el_type == SYSMAP_ELEMENT_TYPE_MAP) {
$triggers = array();
$db_subelements = DBselect("select selementid FROM sysmaps_elements" . " WHERE sysmapid=" . $db_element["elementid"]);
while ($db_subelement = DBfetch($db_subelements)) {
// recursion
$inf = get_info_by_selementid($db_subelement["selementid"]);
foreach ($inf['triggers'] as $id => $triggerid) {
if (!in_array($triggerid, $triggers)) {
array_push($triggers, $triggerid);
}
}
$type = $inf['type'];
if (!isset($tr_info[$type]['count'])) {
$tr_info[$type]['count'] = 0;
}
$tr_info[$type]['count'] += isset($inf['count']) ? $inf['count'] : 1;
if (!isset($tr_info[$type]['priority']) || $tr_info[$type]['priority'] < $inf["priority"]) {
$tr_info[$type]['priority'] = $inf['priority'];
$tr_info[$type]['info'] = $inf['info'];
}
}
$count = count($triggers);
if ($count > 0) {
$tr_info[TRIGGER_VALUE_TRUE]['count'] = $count;
if ($tr_info[TRIGGER_VALUE_TRUE]['count'] == 1) {
$db_trigger = DBfetch(DBselect('SELECT DISTINCT t.triggerid,t.priority,t.value,t.description' . ',t.expression,h.host FROM triggers t, items i, functions f, hosts h' . ' WHERE t.triggerid=' . $triggers[0] . ' AND h.hostid=i.hostid' . ' AND i.itemid=f.itemid AND f.triggerid=t.triggerid'));
$tr_info[TRIGGER_VALUE_TRUE]['info'] = expand_trigger_description_by_data($db_trigger);
}
}
}
}
if ($el_type == SYSMAP_ELEMENT_TYPE_HOST) {
$host = get_host_by_hostid($db_element["elementid"]);
$el_name = $host['host'];
if ($host["status"] == HOST_STATUS_TEMPLATE) {
$tr_info[TRIGGER_VALUE_UNKNOWN]['count'] = 0;
$tr_info[TRIGGER_VALUE_UNKNOWN]['priority'] = 0;
$tr_info[TRIGGER_VALUE_UNKNOWN]['info'] = 'template';
} else {
if ($host["status"] == HOST_STATUS_NOT_MONITORED) {
$tr_info[TRIGGER_VALUE_UNKNOWN]['count'] = 0;
$tr_info[TRIGGER_VALUE_UNKNOWN]['priority'] = 0;
$out['disabled'] = 1;
} else {
if (!isset($tr_info[TRIGGER_VALUE_FALSE])) {
$tr_info[TRIGGER_VALUE_FALSE]['count'] = 0;
$tr_info[TRIGGER_VALUE_FALSE]['priority'] = 0;
$tr_info[TRIGGER_VALUE_FALSE]['info'] = 'OK';
}
}
}
} else {
if ($el_type == SYSMAP_ELEMENT_TYPE_HOST_GROUP) {
$group = get_hostgroup_by_groupid($db_element["elementid"]);
$el_name = $group['name'];
if (!isset($tr_info[TRIGGER_VALUE_FALSE])) {
$tr_info[TRIGGER_VALUE_FALSE]['count'] = 0;
$tr_info[TRIGGER_VALUE_FALSE]['priority'] = 0;
$tr_info[TRIGGER_VALUE_FALSE]['info'] = 'OK';
}
} else {
//.........这里部分代码省略.........
开发者ID:rennhak,项目名称:zabbix,代码行数:101,代码来源:maps.inc.php
示例13: array
}
}
$eventsData = array('eventids' => zbx_objectValues($_REQUEST['events'], 'eventid'), 'message' => $_REQUEST['message']);
$result = CEvent::acknowledge($eventsData);
show_messages($result, S_EVENT_ACKNOWLEDGED, S_CANNOT_ACKNOWLEDGE_EVENT);
if ($result) {
$event_acknowledged = true;
add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_TRIGGER, S_ACKNOWLEDGE_ADDED . ' [' . $bulk ? ' BULK ACKNOWLEDGE ' : expand_trigger_description_by_data($event_trigger) . ']' . ' [' . $_REQUEST['message'] . ']');
}
if (isset($_REQUEST['saveandreturn'])) {
$url = new CUrl(urldecode($_REQUEST['backurl']));
jsRedirect($url->getUrl());
exit;
}
}
$msg = $bulk ? ' BULK ACKNOWLEDGE ' : expand_trigger_description_by_data($event_trigger);
show_table_header(array(S_ALARM_ACKNOWLEDGES_BIG . ': ', $msg));
print SBR;
if ($bulk) {
$title = S_ACKNOWLEDGE_ALARM_BY;
$btn_txt2 = S_ACKNOWLEDGE . ' ' . S_AND_SYMB . ' ' . S_RETURN;
} else {
$db_acks = get_acknowledges_by_eventid($_REQUEST['eventid']);
if ($db_acks) {
$table = new CTable(null, 'ack_msgs');
$table->setAlign('center');
while ($db_ack = DBfetch($db_acks)) {
//$db_users = CUser::get(array('userids' => $db_ack['userid'], 'output' => API_OUTPUT_EXTEND));
//$db_user = reset($db_users);
$table->addRow(array(new CCol($db_ack['alias'], 'user'), new CCol(zbx_date2str(S_ACKNOWLEDGE_DATE_FORMAT, $db_ack['clock']), 'time')), 'title');
$msgCol = new CCol(zbx_nl2br($db_ack['message']));
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:acknow.php
示例14: get_history_of_triggers_events
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;
}
开发者ID:phedders,项目名称:zabbix,代码行数:55,代码来源:events.inc.php
示例15: add_host_to_services
function add_host_to_services($hostid, $serviceid)
{
$result = DBselect('SELECT distinct h.host,t.trig
|
请发表评论