本文整理汇总了PHP中getSeverityCell函数的典型用法代码示例。如果您正苦于以下问题:PHP getSeverityCell函数的具体用法?PHP getSeverityCell怎么用?PHP getSeverityCell使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSeverityCell函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:21,代码来源:CScreenEvents.php
示例2: bodyToString
public function bodyToString()
{
$this->cleanItems();
$config = select_config();
// array of triggers (not classified, information, warning, average, high, disaster) in problem state
$triggersProblemState = [];
// number of triggers in OK state
$triggersOkState = 0;
$options = ['output' => ['triggerid', 'priority', 'value'], 'monitored' => true, 'skipDependent' => true];
if ($this->groupid != 0) {
$options['groupids'] = $this->groupid;
}
$triggers = API::Trigger()->get($options);
foreach ($triggers as $trigger) {
switch ($trigger['value']) {
case TRIGGER_VALUE_TRUE:
if (!array_key_exists($trigger['priority'], $triggersProblemState)) {
$triggersProblemState[$trigger['priority']] = 0;
}
$triggersProblemState[$trigger['priority']]++;
break;
case TRIGGER_VALUE_FALSE:
$triggersOkState++;
}
}
$severityCells = [getSeverityCell(null, $config, $triggersOkState . SPACE . _('Ok'), true)];
for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) {
$severityCount = isset($triggersProblemState[$severity]) ? $triggersProblemState[$severity] : 0;
$severityCells[] = getSeverityCell($severity, $config, $severityCount . SPACE . getSeverityName($severity, $config), !$severityCount);
}
if ($this->style == STYLE_HORIZONTAL) {
$this->addRow($severityCells);
} else {
foreach ($severityCells as $severityCell) {
$this->addRow($severityCell);
}
}
return parent::bodyToString();
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:39,代码来源:CTriggersInfo.php
示例3: make_trigger_details
function make_trigger_details($trigger)
{
$hostNames = [];
$config = select_config();
$hostIds = zbx_objectValues($trigger['hosts'], 'hostid');
$hosts = API::Host()->get(['output' => ['name', 'hostid', 'status'], 'hostids' => $hostIds, 'selectScreens' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT]);
if (count($hosts) > 1) {
order_result($hosts, 'name', ZBX_SORT_UP);
}
$scripts = API::Script()->getScriptsByHosts($hostIds);
foreach ($hosts as $host) {
$hostName = new CSpan($host['name'], ZBX_STYLE_LINK_ACTION);
$hostName->setMenuPopup(CMenuPopupHelper::getHost($host, $scripts[$host['hostid']]));
$hostNames[] = $hostName;
$hostNames[] = ', ';
}
array_pop($hostNames);
$expression = CMacrosResolverHelper::resolveTriggerExpression($trigger['expression'], ['html' => true, 'resolve_usermacros' => true, 'resolve_macros' => true]);
$table = (new CTableInfo())->addRow([new CCol(_n('Host', 'Hosts', count($hosts))), new CCol($hostNames)])->addRow([new CCol(_('Trigger')), new CCol(CMacrosResolverHelper::resolveTriggerName($trigger))])->addRow([_('Severity'), getSeverityCell($trigger['priority'], $config)])->addRow([new CCol(_('Expression')), new CCol($expression)])->addRow([_('Event generation'), _('Normal') . (TRIGGER_MULT_EVENT_ENABLED == $trigger['type'] ? SPACE . '+' . SPACE . _('Multiple PROBLEM events') : '')])->addRow([_('Disabled'), TRIGGER_STATUS_ENABLED == $trigger['status'] ? (new CCol(_('No')))->addClass(ZBX_STYLE_GREEN) : (new CCol(_('Yes')))->addClass(ZBX_STYLE_RED)]);
return $table;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:21,代码来源:triggers.inc.php
示例4: CWidget
$overviewWidget = new CWidget();
$typeComboBox = new CComboBox('type', $this->data['type'], 'submit()');
$typeComboBox->addItem(SHOW_TRIGGERS, _('Triggers'));
$typeComboBox->addItem(SHOW_DATA, _('Data'));
$headerForm = new CForm('get');
$headerForm->addItem(array(_('Group'), SPACE, $this->data['pageFilter']->getGroupsCB(true)));
$headerForm->addItem(array(SPACE, _('Application'), SPACE, $this->data['pageFilter']->getApplicationsCB(true)));
$headerForm->addItem(array(SPACE, _('Type'), SPACE, $typeComboBox));
$overviewWidget->addHeader(_('Overview'), $headerForm);
$hintTable = new CTableInfo();
$hintTable->setAttribute('style', 'width: 200px');
if ($this->data['type'] == SHOW_TRIGGERS) {
$hintTable->addRow(array(new CCol(SPACE, 'normal'), _('OK')));
}
for ($i = 0; $i < TRIGGER_SEVERITY_COUNT; $i++) {
$hintTable->addRow(array(getSeverityCell($i), _('PROBLEM')));
}
$config = select_config();
if ($this->data['type'] == SHOW_TRIGGERS) {
// blinking preview in help popup (only if blinking is enabled)
if ($config['blink_period'] > 0) {
$row = new CRow(null);
$row->addItem(new CCol(SPACE, 'normal'));
for ($i = 0; $i < TRIGGER_SEVERITY_COUNT; $i++) {
$row->addItem(new CCol(SPACE, getSeverityStyle($i)));
}
$col = new CTable('', 'blink overview-mon-severities');
$col->addRow($row);
// double div necassary for FireFox
$col = new CCol(new CDiv(new CDiv($col), 'overview-mon-severities-container'));
$hintTable->addRow(array($col, _s('Age less than %s', convertUnitsS($config['blink_period']))));
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:monitoring.overview.php
示例5: CLabel
$severity_columns[$severity % 2][] = new CLabel([(new CCheckBox('severities[' . $severity . ']'))->setChecked(in_array($severity, $this->data['filter']['severities'])), getSeverityName($severity, $this->data['config'])], 'severities[' . $severity . ']');
}
$filterColumn1->addRow(_('Severity'), (new CTable())->addRow($severity_columns[0])->addRow($severity_columns[1]));
$filterForm->addColumn($filterColumn1)->addColumn($filterColumn2);
$topTriggers->addItem($filterForm);
// table
$table = (new CTableInfo())->setHeader([_('Host'), _('Trigger'), _('Severity'), _('Number of status changes')]);
foreach ($this->data['triggers'] as $trigger) {
foreach ($trigger['hosts'] as $host) {
if ($host['status'] == HOST_STATUS_MONITORED) {
// Pass a monitored 'hostid' and corresponding first 'groupid' to menu pop-up "Events" link.
$trigger['hostid'] = $host['hostid'];
$trigger['groupid'] = $data['monitored_hosts'][$trigger['hostid']]['groups'][0]['groupid'];
break;
} else {
// Unmonitored will have disabled "Events" link and there is no 'groupid' or 'hostid'.
$trigger['hostid'] = 0;
$trigger['groupid'] = 0;
}
}
$hostId = $trigger['hosts'][0]['hostid'];
$hostName = (new CSpan($trigger['hosts'][0]['name']))->addClass(ZBX_STYLE_LINK_ACTION);
if ($this->data['hosts'][$hostId]['status'] == HOST_STATUS_NOT_MONITORED) {
$hostName->addClass(ZBX_STYLE_RED);
}
$hostName->setMenuPopup(CMenuPopupHelper::getHost($this->data['hosts'][$hostId], $this->data['scripts'][$hostId]));
$triggerDescription = (new CSpan($trigger['description']))->addClass(ZBX_STYLE_LINK_ACTION)->setMenuPopup(CMenuPopupHelper::getTrigger($trigger));
$table->addRow([$hostName, $triggerDescription, getSeverityCell($trigger['priority'], $this->data['config']), $trigger['cnt_event']]);
}
$topTriggers->addItem($table);
return $topTriggers;
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:reports.toptriggers.php
示例6: getSeverityCell
}
$table->addRow([item_type2str($type), getSeverityCell(TRIGGER_SEVERITY_NOT_CLASSIFIED, $severityConfig, $itemTypeData['delay5'], !$itemTypeData['delay5']), getSeverityCell(TRIGGER_SEVERITY_INFORMATION, $severityConfig, $itemTypeData['delay10'], !$itemTypeData['delay10']), getSeverityCell(TRIGGER_SEVERITY_WARNING, $severityConfig, $itemTypeData['delay30'], !$itemTypeData['delay30']), getSeverityCell(TRIGGER_SEVERITY_AVERAGE, $severityConfig, $itemTypeData['delay60'], !$itemTypeData['delay60']), getSeverityCell(TRIGGER_SEVERITY_HIGH, $severityConfig, $itemTypeData['delay300'], !$itemTypeData['delay300']), getSeverityCell(TRIGGER_SEVERITY_DISASTER, $severityConfig, $itemTypeData['delay600'], !$itemTypeData['delay600'])]);
}
} elseif ($config == QUEUE_OVERVIEW_BY_PROXY) {
$proxies = API::proxy()->get(['output' => ['hostid', 'host'], 'preservekeys' => true]);
order_result($proxies, 'host');
$proxies[0] = ['host' => _('Server')];
$table->setHeader([_('Proxy'), _('5 seconds'), _('10 seconds'), _('30 seconds'), _('1 minute'), _('5 minutes'), _('More than 10 minutes')]);
$queueData = zbx_toHash($queueData, 'proxyid');
foreach ($proxies as $proxyId => $proxy) {
if (isset($queueData[$proxyId])) {
$proxyData = $queueData[$proxyId];
} else {
$proxyData = ['delay5' => 0, 'delay10' => 0, 'delay30' => 0, 'delay60' => 0, 'delay300' => 0, 'delay600' => 0];
}
$table->addRow([$proxy['host'], getSeverityCell(TRIGGER_SEVERITY_NOT_CLASSIFIED, $severityConfig, $proxyData['delay5'], !$proxyData['delay5']), getSeverityCell(TRIGGER_SEVERITY_INFORMATION, $severityConfig, $proxyData['delay10'], !$proxyData['delay10']), getSeverityCell(TRIGGER_SEVERITY_WARNING, $severityConfig, $proxyData['delay30'], !$proxyData['delay30']), getSeverityCell(TRIGGER_SEVERITY_AVERAGE, $severityConfig, $proxyData['delay60'], !$proxyData['delay60']), getSeverityCell(TRIGGER_SEVERITY_HIGH, $severityConfig, $proxyData['delay300'], !$proxyData['delay300']), getSeverityCell(TRIGGER_SEVERITY_DISASTER, $severityConfig, $proxyData['delay600'], !$proxyData['delay600'])]);
}
} elseif ($config == QUEUE_DETAILS) {
$queueData = zbx_toHash($queueData, 'itemid');
$items = API::Item()->get(['output' => ['itemid', 'hostid', 'name', 'key_'], 'selectHosts' => ['name'], 'itemids' => array_keys($queueData), 'webitems' => true, 'preservekeys' => true]);
$items = CMacrosResolverHelper::resolveItemNames($items);
// get hosts for queue items
$hostIds = zbx_objectValues($items, 'hostid');
$hostIds = array_keys(array_flip($hostIds));
$hosts = API::Host()->get(['output' => ['hostid', 'proxy_hostid'], 'hostids' => $hostIds, 'preservekeys' => true]);
// get proxies for those hosts
$proxyHostIds = [];
foreach ($hosts as $host) {
if ($host['proxy_hostid']) {
$proxyHostIds[$host['proxy_hostid']] = $host['proxy_hostid'];
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:queue.php
示例7: dbConditionInt
}
$sql .= ' AND ' . dbConditionInt('t.flags', array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED)) . ' GROUP BY e.objectid' . ' ORDER BY cnt_event desc';
$result = DBselect($sql, 100);
while ($row = DBfetch($result)) {
$triggersEventCount[$row['objectid']] = $row['cnt_event'];
}
$triggers = API::Trigger()->get(array('triggerids' => array_keys($triggersEventCount), 'output' => array('triggerid', 'description', 'expression', 'priority', 'flags', 'url', 'lastchange'), 'selectItems' => array('hostid', 'name', 'value_type', 'key_'), 'selectHosts' => array('hostid'), 'expandDescription' => true, 'expandData' => true, 'preservekeys' => true, 'nopermissions' => true));
$hostIds = array();
foreach ($triggers as $triggerId => $trigger) {
$hostIds[$trigger['hostid']] = $trigger['hostid'];
$triggerItems = array();
foreach ($trigger['items'] as $item) {
$triggerItems[] = array('name' => itemName($item), 'params' => array('itemid' => $item['itemid'], 'action' => in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues'));
}
$triggers[$triggerId]['items'] = $triggerItems;
$triggers[$triggerId]['cnt_event'] = $triggersEventCount[$triggerId];
}
CArrayHelper::sort($triggers, array(array('field' => 'cnt_event', 'order' => ZBX_SORT_DOWN), 'host', 'description', 'priority'));
$hosts = API::Host()->get(array('output' => array('hostid'), 'hostids' => $hostIds, 'selectScreens' => API_OUTPUT_COUNT, 'preservekeys' => true));
$scripts = API::Script()->getScriptsByHosts($hostIds);
foreach ($triggers as $trigger) {
$hostId = $trigger['hostid'];
$hostName = new CSpan($trigger['hostname'], 'link_menu');
$hostName->setMenuPopup(getMenuPopupHost($hosts[$hostId], $scripts[$hostId]));
$triggerDescription = new CSpan($trigger['description'], 'link_menu');
$triggerDescription->setMenuPopup(getMenuPopupTrigger($trigger, $trigger['items']));
$table->addRow(array(get_node_name_by_elid($trigger['triggerid']), $hostName, $triggerDescription, getSeverityCell($trigger['priority']), $trigger['cnt_event']));
}
$rprt_wdgt->addItem($table);
$rprt_wdgt->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:report5.php
示例8: CLink
$triggerDescription[] = new CLink(CHtml::encode($realHost['name']), 'triggers.php?hostid=' . $realHost['hostid'], 'unknown');
$triggerDescription[] = ':';
}
}
$trigger['hosts'] = zbx_toHash($trigger['hosts'], 'hostid');
if ($trigger['flags'] == ZBX_FLAG_DISCOVERY_CREATED) {
$triggerDescription[] = new CSpan(CHtml::encode($trigger['description']));
} else {
$triggerDescription[] = new CLink(CHtml::encode($trigger['description']), 'triggers.php?form=update&hostid=' . key($trigger['hosts']) . '&triggerid=' . $trigger['triggerid']);
}
if ($trigger['state'] == TRIGGER_STATE_UNKNOWN) {
$trigger['error'] = '';
}
$trigger['items'] = zbx_toHash($trigger['items'], 'itemid');
$trigger['functions'] = zbx_toHash($trigger['functions'], 'functionid');
$triggerHintTable->addRow(array(getSeverityCell($trigger['priority']), $triggerDescription, triggerExpression($trigger, true), new CSpan(triggerIndicator($trigger['status'], $trigger['state']), triggerIndicatorStyle($trigger['status'], $trigger['state']))));
$item['triggers'][$num] = $trigger;
}
unset($trigger);
if (!empty($item['triggers'])) {
$triggerInfo = new CSpan(_('Triggers'), 'link_menu');
$triggerInfo->setHint($triggerHintTable);
$triggerInfo = array($triggerInfo);
$triggerInfo[] = ' (' . count($item['triggers']) . ')';
$triggerHintTable = array();
} else {
$triggerInfo = SPACE;
}
// if item type is 'Log' we must show log menu
if (in_array($item['value_type'], array(ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_TEXT))) {
$triggers = array();
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:configuration.item.list.php
示例9: get_next_event
$event['duration'] = ($nextEvent = get_next_event($event, $events)) ? zbx_date2age($event['clock'], $nextEvent['clock']) : zbx_date2age($event['clock']);
// action
$action = isset($actions[$event['eventid']]) ? $actions[$event['eventid']] : '';
if ($csvExport) {
$csvRows[] = [zbx_date2str(DATE_TIME_FORMAT_SECONDS, $event['clock']), $pageFilter->hostid == 0 ? $host['name'] : null, $description, trigger_value2str($event['value']), getSeverityName($trigger['priority'], $config), $event['duration'], $config['event_ack_enable'] ? $event['acknowledges'] ? _('Yes') : _('No') : null, strip_tags((string) $action)];
} else {
$triggerDescription = (new CSpan($description))->addClass(ZBX_STYLE_LINK_ACTION)->setMenuPopup(CMenuPopupHelper::getTrigger($trigger, null, $event['clock']));
// add colors and blinking to span depending on configuration and trigger parameters
$statusSpan = new CSpan(trigger_value2str($event['value']));
addTriggerValueStyle($statusSpan, $event['value'], $event['clock'], $event['acknowledged']);
// host JS menu link
$hostName = null;
if ($pageFilter->hostid == 0) {
$hostName = (new CSpan($host['name']))->addClass(ZBX_STYLE_LINK_ACTION)->setMenuPopup(CMenuPopupHelper::getHost($host, $scripts[$host['hostid']]));
}
$table->addRow([(new CLink(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $event['clock']), 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid']))->addClass('action'), $hostName, $triggerDescription, $statusSpan, getSeverityCell($trigger['priority'], $config, null, !$event['value']), $event['duration'], $config['event_ack_enable'] ? getEventAckState($event, $page['file']) : null, (new CCol($action))->addClass(ZBX_STYLE_NOWRAP)]);
}
}
} else {
if (!$csvExport) {
$events = [];
$url = (new CUrl('events.php'))->setArgument('fullscreen', getRequest('fullscreen'))->setArgument('groupid', $pageFilter->groupid)->setArgument('hostid', $pageFilter->hostid);
$paging = getPagingLine($events, ZBX_SORT_UP, $url);
}
}
}
if (!$csvExport) {
$table = [$table, $paging];
}
}
if ($csvExport) {
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:events.php
示例10: make_trigger_details
function make_trigger_details($trigger)
{
$hostNames = array();
$hostIds = zbx_objectValues($trigger['hosts'], 'hostid');
$hosts = API::Host()->get(array('output' => array('name', 'hostid', 'status'), 'hostids' => $hostIds, 'selectScreens' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT));
if (count($hosts) > 1) {
order_result($hosts, 'name', ZBX_SORT_UP);
}
$scripts = API::Script()->getScriptsByHosts($hostIds);
foreach ($hosts as $host) {
$hostName = new CSpan($host['name'], 'link_menu');
$hostName->setMenuPopup(CMenuPopupHelper::getHost($host, $scripts[$host['hostid']]));
$hostNames[] = $hostName;
$hostNames[] = ', ';
}
array_pop($hostNames);
$table = new CTableInfo();
$table->addRow(array(new CCol(_n('Host', 'Hosts', count($hosts))), new CCol($hostNames, 'wraptext')));
$table->addRow(array(new CCol(_('Trigger')), new CCol(CMacrosResolverHelper::resolveTriggerName($trigger), 'wraptext')));
$table->addRow(array(_('Severity'), getSeverityCell($trigger['priority'])));
$table->addRow(array(new CCol(_('Expression')), new CCol(explode_exp($trigger['expression'], true, true), 'trigger-expression')));
$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:TonywalkerCN,项目名称:Zabbix,代码行数:25,代码来源:triggers.inc.php
示例11: bodyToString
public function bodyToString()
{
$this->cleanItems();
$ok = $uncl = $info = $warn = $avg = $high = $dis = 0;
$options = array('monitored' => true, 'skipDependent' => true, 'output' => API_OUTPUT_SHORTEN);
if ($this->hostid > 0) {
$options['hostids'] = $this->hostid;
} elseif ($this->groupid > 0) {
$options['groupids'] = $this->groupid;
}
$triggers = API::Trigger()->get($options);
$triggers = zbx_objectValues($triggers, 'triggerid');
$db_priority = DBselect('SELECT t.priority,t.value,count(DISTINCT t.triggerid) AS cnt' . ' FROM triggers t' . ' WHERE ' . dbConditionInt('t.triggerid', $triggers) . ' GROUP BY t.priority,t.value');
while ($row = DBfetch($db_priority)) {
switch ($row['value']) {
case TRIGGER_VALUE_TRUE:
switch ($row['priority']) {
case TRIGGER_SEVERITY_NOT_CLASSIFIED:
$uncl += $row['cnt'];
break;
case TRIGGER_SEVERITY_INFORMATION:
$info += $row['cnt'];
break;
case TRIGGER_SEVERITY_WARNING:
$warn += $row['cnt'];
break;
case TRIGGER_SEVERITY_AVERAGE:
$avg += $row['cnt'];
break;
case TRIGGER_SEVERITY_HIGH:
$high += $row['cnt'];
break;
case TRIGGER_SEVERITY_DISASTER:
$dis += $row['cnt'];
break;
}
break;
case TRIGGER_VALUE_FALSE:
$ok += $row['cnt'];
break;
}
}
if ($this->show_header) {
$header_str = _('Triggers info') . SPACE;
if (!is_null($this->nodeid)) {
$node = get_node_by_nodeid($this->nodeid);
if ($node > 0) {
$header_str .= '(' . $node['name'] . ')' . SPACE;
}
}
if (remove_nodes_from_id($this->groupid) > 0) {
$group = get_hostgroup_by_groupid($this->groupid);
$header_str .= _('Group') . SPACE . '"' . $group['name'] . '"';
} else {
$header_str .= _('All groups');
}
$header = new CCol($header_str, 'header');
if ($this->style == STYLE_HORISONTAL) {
$header->setColspan(8);
}
$this->addRow($header);
}
$trok = getSeverityCell(null, $ok . SPACE . _('Ok'), true);
$uncl = getSeverityCell(TRIGGER_SEVERITY_NOT_CLASSIFIED, $uncl . SPACE . getSeverityCaption(TRIGGER_SEVERITY_NOT_CLASSIFIED), !$uncl);
$info = getSeverityCell(TRIGGER_SEVERITY_INFORMATION, $info . SPACE . getSeverityCaption(TRIGGER_SEVERITY_INFORMATION), !$info);
$warn = getSeverityCell(TRIGGER_SEVERITY_WARNING, $warn . SPACE . getSeverityCaption(TRIGGER_SEVERITY_WARNING), !$warn);
$avg = getSeverityCell(TRIGGER_SEVERITY_AVERAGE, $avg . SPACE . getSeverityCaption(TRIGGER_SEVERITY_AVERAGE), !$avg);
$high = getSeverityCell(TRIGGER_SEVERITY_HIGH, $high . SPACE . getSeverityCaption(TRIGGER_SEVERITY_HIGH), !$high);
$dis = getSeverityCell(TRIGGER_SEVERITY_DISASTER, $dis . SPACE . getSeverityCaption(TRIGGER_SEVERITY_DISASTER), !$dis);
if (STYLE_HORISONTAL == $this->style) {
$this->addRow(array($trok, $uncl, $info, $warn, $avg, $high, $dis));
} else {
$this->addRow($trok);
$this->addRow($uncl);
$this->addRow($info);
$this->addRow($warn);
$this->addRow($avg);
$this->addRow($high);
$this->addRow($dis);
}
return parent::bodyToString();
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:82,代码来源:class.ctriggersinfo.php
示例12: make_trigger_details
function make_trigger_details($trigger)
{
$table = new CTableInfo();
if (is_show_all_nodes()) {
$table->addRow(array(_('Node'), get_node_name_by_elid($trigger['triggerid'])));
}
$expression = explode_exp($trigger['expression'], true, true);
$host = API::Host()->get(array('output' => array('name', 'hostid'), 'hostids' => $trigger['hosts'][0]['hostid'], 'selectScreens' => API_OUTPUT_COUNT, 'selectInventory' => array('hostid'), 'preservekeys' => true));
$host = reset($host);
$hostScripts = API::Script()->getScriptsByHosts($host['hostid']);
// host js link
$hostSpan = new CSpan($host['name'], 'link_menu menu-host');
$scripts = $hostScripts[$host['hostid']];
$hostSpan->attr('data-menu', hostMenuData($host, $scripts));
// get visible name of the first host
$table->addRow(array(_('Host'), $hostSpan));
$table->addRow(array(_('Trigger'), CTriggerHelper::expandDescription($trigger)));
$table->addRow(array(_('Severity'), getSeverityCell($trigger['priority'])));
$table->addRow(array(_('Expression'), $expression));
$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:quanta-computing,项目名称:debian-packages,代码行数:23,代码来源:triggers.inc.php
示例13: jQuery
$description->setAttribute('onclick', $js_action . ' jQuery(this).removeAttr("onclick");');
if (count($trigger['dependencies']) > 0) {
$description = array($description, BR(), bold(_('Depends on')), BR());
foreach ($trigger['dependencies'] as $val) {
$description[] = array(CTriggerHelper::expandDescription($val), BR());
}
}
switch ($trigger['status']) {
case TRIGGER_STATUS_DISABLED:
$status = new CSpan(_('Disabled'), 'disabled');
break;
case TRIGGER_STATUS_ENABLED:
$status = new CSpan(_('Enabled'), 'enabled');
break;
}
$table->addRow(array($multiselect ? new CCheckBox('triggers[' . zbx_jsValue($trigger[$srcfld1]) . ']', null, null, $trigger['triggerid']) : null, $description, getSeverityCell($trigger['priority']), $status));
// made to save memmory usage
if ($multiselect) {
$jsTriggers[$trigger['triggerid']] = array('triggerid' => $trigger['triggerid'], 'description' => $trigger['description'], 'expression' => $trigger['expression'], 'priority' => $trigger['priority'], 'status' => $trigger['status'], 'host' => $trigger['hostname']);
}
}
if ($multiselect) {
$button = new CButton('select', _('Select'), "addSelectedValues('triggers', " . zbx_jsvalue($reference) . ');');
$table->setFooter(new CCol($button, 'right'));
insert_js('var popupReference = ' . zbx_jsValue($jsTriggers, true) . ';');
}
zbx_add_post_js('chkbxRange.pageGoName = "triggers";');
$form->addItem($table);
$form->show();
} elseif ($srctbl == 'items') {
$form = new CForm();
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:popup.php
示例14: array
$csvRows[] = array(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $event['clock']), getRequest('hostid', 0) == 0 ? $host['name'] : null, $description, trigger_value2str($event['value']), getSeverityCaption($trigger['priority']), $event['duration'], $config['event_ack_enable'] ? $event['acknowledges'] ? _('Yes') : _('No') : null, strip_tags((string) $action));
} else {
$triggerDescription = new CSpan($description, 'pointer link_menu');
$triggerDescription->setMenuPopup(CMenuPopupHelper::getTrigger($trigger, $triggerItems, null, $event['clock']));
// acknowledge
$ack = getEventAckState($event, true);
// add colors and blinking to span depending on configuration and trigger parameters
$statusSpan = new CSpan(trigger_value2str($event['value']));
addTriggerValueStyle($statusSpan, $event['value'], $event['clock'], $event['acknowledged']);
// host JS menu link
$hostName = null;
if (getRequest('hostid', 0) == 0) {
$hostName = new CSpan($host['name'], 'link_menu');
$hostName->setMenuPopup(CMenuPopupHelper::getHost($host, $scripts[$host['hostid']]));
}
$table->addRow(array(new CLink(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $event['clock']), 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid'], 'action'), $hostName, $triggerDescription, $statusSpan, getSeverityCell($trigger['priority'], null, !$event['value']), $event['duration'], $config['event_ack_enable'] ? $ack : null, $action));
}
}
} else {
if (!$csvExport) {
$events = array();
$paging = getPagingLine($events);
}
}
}
if (!$csvExport) {
$table = array($paging, $table, $paging);
}
}
if ($csvExport) {
echo zbx_toCSV($csvRows);
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:events.php
示例15: zbx_jsvalue
if (isset($srcfld3)) {
$values[$dstfld3] = $trigger[$srcfld3];
}
$js_action = 'addValues(' . zbx_jsvalue($dstfrm) . ', ' . zbx_jsvalue($values) . '); return false;';
}
$description->onClick($js_action . ' jQuery(this).removeAttr("onclick");');
if ($trigger['dependencies']) {
$description = [$description, BR(), bold(_('Depends on')), BR()];
$dependencies = CMacrosResolverHelper::resolveTriggerNames(zbx_toHash($trigger['dependencies'], 'triggerid'));
foreach ($dependencies as $dependency) {
$description[] = $dependency['description'];
$description[] = BR();
}
array_pop($description);
}
$table->addRow([$multiselect ? new CCheckBox('triggers[' . zbx_jsValue($trigger[$srcfld1]) . ']', $trigger['triggerid']) : null, $description, getSeverityCell($trigger['priority'], $config), (new CSpan(triggerIndicator($trigger['status'], $trigger['state'])))->addClass(triggerIndicatorStyle($trigger['status'], $trigger['state']))]);
// made to save memory usage
if ($multiselect) {
$jsTriggers[$trigger['triggerid']] = ['id' => $trigger['triggerid'], 'name' => $trigger['description'], 'triggerid' => $trigger['triggerid'], 'description' => $trigger['description'], 'expression' => $trigger['expression'], 'priority' => $trigger['priority'], 'status' => $trigger['status'], 'host' => $trigger['hostname']];
}
}
if ($multiselect) {
$table->setFooter(new CCol((new CButton('select', _('Select')))->onClick("addSelectedValues('triggers', " . zbx_jsvalue($reference) . ', ' . $parentId . ');')));
insert_js('var popupReference = ' . zbx_jsValue($jsTriggers, true) . ';');
}
$form->addItem($table);
$widget->addItem($form)->show();
} elseif ($srctbl === 'items' || $srctbl === 'item_prototypes') {
$form = (new CForm())->setName('itemform')->setId('items');
$itemPrototypesPopup = $srctbl === 'item_prototypes';
$table = (new CTableInfo())->setHeader([$pageFilter->hostsAll ? _('Host') : null, $multiselect ? (new CColHeader((new CCheckBox('all_items'))->onClick("javascript: checkAll('" . $form->getName() . "', 'all_items', 'items');")))->addClass(ZBX_STYLE_CELL_WIDTH) : null, _('Name'), _('Key'), _('Type'), _('Type of information'), _('Status')]);
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:popup.php
示例16: zbx_jsvalue
$js_action = 'addValue(' . zbx_jsvalue($reference) . ', ' . zbx_jsvalue($trigger['triggerid']) . ', ' . $parentId . ');';
} else {
$values = array($dstfld1 => $trigger[$srcfld1], $dstfld2 => $trigger[$srcfld2]);
if (isset($srcfld3)) {
$values[$dstfld3] = $trigger[$srcfld3];
}
$js_action = 'addValues(' . zbx_jsvalue($dstfrm) . ', ' . zbx_jsvalue($values) . '); return false;';
}
$description->setAttribute('onclick', $js_action . ' jQuery(this).removeAttr("onclick");');
if (count($trigger['dependencies']) > 0) {
$description = array($description, BR(), bold(_('Depends on')), BR());
foreach ($trigger['dependencies'] as $dependentTrigger) {
$description[] = array(CMacrosResolverHelper::resolveTriggerName($dependentTrigger), BR());
}
}
$table->addRow(array($multiselect ? new CCheckBox('triggers[' . zbx_jsValue($trigger[$srcfld1]) . ']', null, null, $trigger['triggerid']) : null, $description, getSeverityCell($trigger['priority']), new CSpan(triggerIndicator($trigger['status'], $trigger['state']), triggerIndicatorStyle($trigger['status'], $trigger['state']))));
// made to save memory usage
if ($multiselect) {
$jsTriggers[$trigger['triggerid']] = array('id' => $trigger['triggerid'], 'name' => $trigger['description'], 'prefix' => get_node_name_by_elid($trigger['triggerid'], null, NAME_DELIMITER), 'triggerid' => $trigger['triggerid'], 'description' => $trigger['description'], 'expression' => $trigger['expression'], 'priority' => $trigger['priority'], 'status' => $trigger['status'], 'host' => $trigger['hostname']);
}
}
if ($multiselect) {
$button = new CButton('select', _('Select'), "addSelectedValues('triggers', " . zbx_jsvalue($reference) . ', ' . $parentId . ');');
$table->setFooter(new CCol($button, 'right'));
insert_js('var popupReference = ' . zbx_jsValue($jsTriggers, true) . ';');
}
zbx_add_post_js('chkbxRange.pageGoName = "triggers";');
$form->addItem($table);
$form->show();
} elseif ($srctbl == 'items') {
$form = new CForm();
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:popup.php
示例17: CCol
$ackColumn = new CCol(_('No events'), 'unknown');
}
} else {
$ackColumn = null;
}
// open or close
if ($showEvents != EVENTS_OPTION_NOEVENT && !empty($trigger['events'])) {
$openOrCloseDiv = new CDiv(SPACE, 'filterclosed');
$openOrCloseDiv->setAttribute('data-switcherid', $trigger['triggerid']);
} elseif ($showEvents == EVENTS_OPTION_NOEVENT) {
$openOrCloseDiv = null;
} else {
$openOrCloseDiv = SPACE;
}
// severity
$severityColumn = getSeverityCell($trigger['priority'], null, !$trigger['value']);
if ($showEventColumn) {
$severityColumn->setColSpan(2);
}
// unknown triggers
$unknown = SPACE;
if ($trigger['state'] == TRIGGER_STATE_UNKNOWN) {
$unknown = new CDiv(SPACE, 'status_icon iconunknown');
$unknown->setHint($trigger['error'], '', 'on');
}
// comments
if (isset($triggerEditable[$trigger['triggerid']])) {
$comments = new CLink(zbx_empty($trigger['comments']) ? _('Add') : _('Show'), 'tr_comments.php?triggerid=' . $trigger['triggerid']);
} else {
$comments = zbx_empty($trigger['comments']) ? new CSpan('-') : new CLink(_('Show'), 'tr_comments.php?triggerid=' . $trigger['triggerid']);
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:tr_status.php
示例18: array
$trigger['items'][$item['itemid']] = array('itemid' => $item['itemid'], 'action' => str_in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues', 'name' => itemName($item), 'value_type' => $item['value_type']);
}
$triggers[$tid] = $trigger;
}
CArrayHelper::sort($triggers, array(array('field' => 'cnt_event', 'order' => ZBX_SORT_DOWN), 'host', 'description', 'priority'));
$scripts_by_hosts = API::Script()->getScriptsByHosts($hosts);
foreach ($triggers as $trigger) {
$menus = '';
$host_nodeid = id2nodeid($trigger['hostid']);
foreach ($scripts_by_hosts[$trigger['hostid']] as $script) {
$script_nodeid = id2nodeid($script['scriptid']);
if (bccomp($host_nodeid, $script_nodeid) == 0) {
$menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $trigger['hostid'] . "&scriptid=" . $script['scriptid'] . "','Global script',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
}
$menus .= "['" . _('URLs') . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
$menus .= "['" . _('Latest data') . "',\"javascript: redirect('latest.php?hostid=" . $trigger['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
$menus = "show_popup_menu(event,[['" . _('Scripts') . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus . "],180);";
$hostSpan = new CSpan($trigger['hostname'], 'link_menu');
$hostSpan->setAttribute('onclick', $menus);
$tr_conf_link = 'null';
if ($USER_DETAILS['type'] > USER_TYPE_ZABBIX_USER && $trigger['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
$tr_conf_link = "['" . _('Configuration of trigger') . "',\"javascript: redirect('triggers.php?form=update&triggerid=" . $trigger['triggerid'] . "&hostid=" . $trigger['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
}
$tr_desc = new CSpan($trigger['description'], 'link_menu');
$tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " [{'triggerid': '" . $trigger['triggerid'] . "', 'lastchange': '" . $trigger['lastchange'] . "'}," . $tr_conf_link . "]," . zbx_jsvalue($trigger['items'], true) . ");");
$table->addRow(array(get_node_name_by_elid($trigger['triggerid']), $hostSpan, $tr_desc, getSeverityCell($trigger['priority']), $trigger['cnt_event']));
}
$rprt_wdgt->addItem($table);
$rprt_wdgt->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:report5.php
示例19: CLink
$status = new CLink(triggerIndicator($trigger['status'], $trigger['state']), 'triggers.php?' . 'action=' . ($trigger['status'] == TRIGGER_STATUS_DISABLED ? 'trigger.massenable' : 'trigger.massdisable') . '&hostid=' . $this->data['hostid'] . '&g_triggerid=' . $triggerid, triggerIndicatorStyle($trigger['st
|
请发表评论