private function simpleHTML() { $table = new CTableInfo(); $table->addRow($this->makeHeaders()); foreach ($this->tree as $id => $rows) { $table->addRow($this->makeRow($id)); } return $table; }
public function _getContent($refresh = false) { global $DB; $table = new CTableInfo(_('No email log data found')); $table->setHeader(array(_('System'), _('Interval'), _('Next Expected'), _('Last Seen'), _('Total Emails'), _('Actions'))); $data = array(); $db = mysql_connect("192.168.211.7", "zabbix", "asmd213)A)SDM@**@@"); $result = DbFetchArray(DBselect(' SELECT email_schedule.*,COUNT(email_match.schedule) as `email_count` FROM email_tracker.email_schedule LEFT JOIN email_tracker.email_match ON email_match.schedule = email_schedule.id GROUP BY email_schedule.id ORDER BY exec_order ')); foreach ($result as $row) { // $link_link = new CLink($row['name'],$row['url']); // $link_link->setTarget("_blank"); // $map_link = new CLink("map","/spider_report.php?wid=$row[aid]"); // $map_link->setTarget("_blank"); $color = $row['missed'] == 0 ? 'green' : 'red'; $last_seen = empty($row['last_seen']) || $row['last_seen'] == '0000-00-00 00:00:00' ? 'Never' : $row['last_seen']; $table->addRow(array(new CDiv($row['name']), new CDiv($row['expected_interval']), new CDiv($row['next_expected']), new CDiv(new CSpan($last_seen, $color)), new CDiv($row['email_count']), new CLink('Ack', '/zabbix/email.php?action=ack&id=' . $row['id']))); // if (!isset($httpTestData[$row['httptestid']])) { // $data[$row['groupid']]['unknown'] = empty($data[$row['groupid']]['unknown']) ? 1 : ++$data[$row['groupid']]['unknown']; // } // elseif ($httpTestData[$row['httptestid']]['lastfailedstep'] != 0) { // $data[$row['groupid']]['failed'] = empty($data[$row['groupid']]['failed']) ? 1 : ++$data[$row['groupid']]['failed']; // } // else { // $data[$row['groupid']]['ok'] = empty($data[$row['groupid']]['ok']) ? 1 : ++$data[$row['groupid']]['ok']; // } } return $table; }
public function _getContent($refresh = false) { $table = new CTableInfo(_('No web scenarios found.')); $table->setHeader(array(_('Website'), _('Links'), _('Broken Links'))); $data = array(); // fetch links between HTTP tests and host groups $result = DbFetchArray(DBselect('SELECT website.*, sum(status LIKE "2%") as links_ok, sum(status != "" AND NOT status LIKE "2%") as links_404, sum(status = "" OR status is null) as links_unchecked FROM zabbix_spider.website LEFT JOIN zabbix_spider.page ON page.website = Website.aid group by page.website;')); foreach ($result as $row) { $deadlinks = DbFetchArray(DBselect('SELECT * FROM zabbix_spider.page WHERE NOT status IS NULL AND status != "200" AND status != "" and website = ' . $row['aid'])); $deadlink_output = array(); $link_options = array("target" => "_blank"); foreach ($deadlinks as $deadlink) { $link_link = new CLink($deadlink['url'] == "" ? "root" : substr($deadlink['url'], 0, 50), ($deadlink['url'] == "" || $deadlink['url'][0] == "/" ? $row['url'] : "") . $deadlink['url']); $link_link->setTarget("_blank"); $map_link = new CLink("map", $this->reportUrl . "?pid={$deadlink['aid']}"); $map_link->setTarget("_blank"); $info_link = new CLink($deadlink["status"], "http://www.checkupdown.com/status/E{$deadlink['status']}.html"); $info_link->setTarget("_blank"); $deadlink_output[] = new CDiv(array($link_link, " [ ", $map_link, " | ", $info_link, " ]")); } $link_link = new CLink($row['name'], $row['url']); $link_link->setTarget("_blank"); $map_link = new CLink("map", $this->reportUrl . "?wid={$row['aid']}"); $map_link->setTarget("_blank"); $table->addRow(array(new CDiv(array($link_link, " [ ", $map_link, " ]")), new CDiv(array(new CSpan($row['links_ok'], 'green'), " / ", new CSpan($row['links_404'], 'red'), " / ", new CSpan($row['links_unchecked'], 'gray'))), new CDiv($deadlink_output))); } return $table; }
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $total = 0; // fetch accessible host ids $hosts = API::Host()->get(['output' => ['hostid'], 'preservekeys' => true]); $hostids = array_keys($hosts); if ($this->screenitem['resourceid'] != 0) { $cond_from = ',hosts_groups hg'; $cond_where = ' AND hg.hostid=h.hostid AND hg.groupid=' . zbx_dbstr($this->screenitem['resourceid']); } else { $cond_from = ''; $cond_where = ''; } $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_TRUE . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostids) . $cond_where); $host_cnt = DBfetch($db_host_cnt); $avail = $host_cnt['cnt']; $total += $host_cnt['cnt']; $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_FALSE . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostids) . $cond_where); $host_cnt = DBfetch($db_host_cnt); $notav = $host_cnt['cnt']; $total += $host_cnt['cnt']; $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_UNKNOWN . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostids) . $cond_where); $host_cnt = DBfetch($db_host_cnt); $uncn = $host_cnt['cnt']; $total += $host_cnt['cnt']; $avail = (new CCol($avail . ' ' . _('Available')))->addClass(ZBX_STYLE_GREEN); $notav = (new CCol($notav . ' ' . _('Not available')))->addClass(ZBX_STYLE_RED); $uncn = (new CCol($uncn . ' ' . _('Unknown')))->addClass(ZBX_STYLE_GREY); $total = new CCol($total . ' ' . _('Total')); $header = (new CDiv([new CTag('h4', true, _('Hosts info'))]))->addClass(ZBX_STYLE_DASHBRD_WIDGET_HEAD); if ($this->screenitem['resourceid'] != 0) { $groups = API::HostGroup()->get(['output' => ['name'], 'groupids' => [$this->screenitem['resourceid']]]); $header->addItem((new CList())->addItem([_('Group'), ':', SPACE, $groups[0]['name']])); } $table = new CTableInfo(); if ($this->screenitem['style'] == STYLE_HORIZONTAL) { $table->addRow([$avail, $notav, $uncn, $total]); } else { $table->addRow($avail); $table->addRow($notav); $table->addRow($uncn); $table->addRow($total); } $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT); return $this->getOutput(new CUiWidget(uniqid(), [$header, $table, $footer])); }
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { // if screen is defined in template, then 'real_resourceid' is defined and should be used if (!empty($this->screenitem['real_resourceid'])) { $this->screenitem['resourceid'] = $this->screenitem['real_resourceid']; } if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && !empty($this->hostid)) { $newitemid = get_same_item_for_host($this->screenitem['resourceid'], $this->hostid); $this->screenitem['resourceid'] = !empty($newitemid) ? $newitemid : 0; } if ($this->screenitem['resourceid'] == 0) { $table = new CTableInfo(_('No values found.')); $table->setHeader(array(_('Timestamp'), _('Item'))); return $this->getOutput($table); } $items = CMacrosResolverHelper::resolveItemNames(array(get_item_by_itemid($this->screenitem['resourceid']))); $item = reset($items); switch ($item['value_type']) { case ITEM_VALUE_TYPE_TEXT: case ITEM_VALUE_TYPE_LOG: $orderField = 'id'; break; case ITEM_VALUE_TYPE_FLOAT: case ITEM_VALUE_TYPE_UINT64: default: $orderField = array('itemid', 'clock'); } $host = get_host_by_itemid($this->screenitem['resourceid']); $table = new CTableInfo(_('No values found.')); $table->setHeader(array(_('Timestamp'), $host['name'] . NAME_DELIMITER . $item['name_expanded'])); $stime = zbxDateToTime($this->timeline['stime']); $histories = API::History()->get(array('history' => $item['value_type'], 'itemids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN, 'sortfield' => $orderField, 'limit' => $this->screenitem['elements'], 'time_from' => $stime, 'time_till' => $stime + $this->timeline['period'])); foreach ($histories as $history) { switch ($item['value_type']) { case ITEM_VALUE_TYPE_FLOAT: sscanf($history['value'], '%f', $value); break; case ITEM_VALUE_TYPE_TEXT: case ITEM_VALUE_TYPE_STR: case ITEM_VALUE_TYPE_LOG: $value = $this->screenitem['style'] ? new CJsScript($history['value']) : $history['value']; break; default: $value = $history['value']; break; } if ($item['valuemapid'] > 0) { $value = applyValueMap($value, $item['valuemapid']); } $class = $this->screenitem['style'] ? null : 'pre'; $table->addRow(array(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $history['clock']), new CCol($value, $class))); } return $this->getOutput($table); }
/** * Generate acknowledgement table * * @param array $event * @param array $event['acknowledges'] * @param array $event['acknowledges']['clock'] * @param array $event['acknowledges']['alias'] * @param array $event['acknowledges']['message'] * * @return CTableInfo */ function makeAckTab($event) { $table = new CTableInfo(_('No acknowledges defined.')); $table->setHeader(array(_('Time'), _('User'), _('Comments'))); if (!empty($event['acknowledges']) && is_array($event['acknowledges'])) { foreach ($event['acknowledges'] as $ack) { $table->addRow(array(zbx_date2str(_('d M Y H:i:s'), $ack['clock']), $ack['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext'))); } } return $table; }
/** * Get acknowledgement table. * * @param array $event * @param array $event['acknowledges'] * @param array $event['acknowledges']['clock'] * @param array $event['acknowledges']['alias'] * @param array $event['acknowledges']['message'] * * @return CTableInfo */ function makeAckTab($event) { $acknowledgeTable = new CTableInfo(_('No acknowledges found.')); $acknowledgeTable->setHeader(array(_('Time'), _('User'), _('Comments'))); if (!empty($event['acknowledges']) && is_array($event['acknowledges'])) { foreach ($event['acknowledges'] as $acknowledge) { $acknowledgeTable->addRow(array(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $acknowledge['clock']), getUserFullname($acknowledge), new CCol(zbx_nl2br($acknowledge['message']), 'wraptext'))); } } return $acknowledgeTable; }
function make_acktab_by_eventid($eventid) { $table = new CTableInfo(); $table->SetHeader(array(S_TIME, S_USER, S_COMMENTS)); $acks = get_acknowledges_by_eventid($eventid); while ($ack = DBfetch($acks)) { //$users = CUser::get(array('userids' => $ack['userid'], 'output' => API_OUTPUT_EXTEND)); //$user = reset($users); $table->addRow(array(zbx_date2str(S_ACKNOWINC_BY_EVENTS_DATE_FORMAT, $ack['clock']), $ack['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext'))); } return $table; }
public function _getContent($refresh = false) { $table = new CTableInfo(_('No Login data found')); $table->setHeader(array(_('User'), _('System'))); $data = array(); $db = mysql_connect($this->config['server'], $this->config['user'], $this->config['password']); $sql = 'SELECT DISTINCT username, GROUP_CONCAT(DISTINCT address SEPARATOR "\\n") as connected_to FROM logs.auth_log WHERE address <> "-" AND NOT username IN ("ANONYMOUS LOGON") AND (current_timestamp-ts_last)<900 GROUP BY username ORDER BY username;'; $result = mysql_query($sql, $db); if (mysql_num_rows($result) == 0) { return $table; } while ($row = mysql_fetch_assoc($result)) { $table->addRow(array($row['username'], new CObject(str_replace("\n", "<br/>", $row['connected_to'])))); } return $table; }
/** * 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); }
public function _getContent($refresh = false) { $table = new CTableInfo(_('No eventlog data found')); $table->setHeader(array(_('System'), _('Notifications'))); $data = array(); $db = mysql_connect($this->config['server'], $this->config['user'], $this->config['password']); $sql = 'SELECT host, priority, COUNT(priority) as eventCount FROM logs.logs GROUP BY host, priority;'; $result = mysql_query($sql, $db); if (mysql_num_rows($result) == 0) { return $table; } $table = new CTableInfo(_('No eventlog data found')); $systems = array(); $headers = array(); $pMerge = array('info' => 'Notice', 'notice' => 'Notice', 'warn' => 'Warning', 'warning' => 'Warning', 'err' => 'Error', 'error' => 'Error', 'crit' => 'Critical', 'critical' => 'Critical'); foreach ($pMerge as $key => $value) { $headers[$value] = $value; } while ($row = mysql_fetch_assoc($result)) { if (!isset($systems[$row['host']])) { $systems[$row['host']] = array(); } if (isset($pMerge[$row['priority']])) { $row['priority'] = $pMerge[$row['priority']]; } $systems[$row['host']][$row['priority']] = $row['eventCount']; $headers[$row['priority']] = $row['priority']; } $headersCompile = array(_("Host")); foreach ($headers as $value) { $headersCompile[] = _($value); } $table->setHeader($headersCompile); foreach ($systems as $systemName => $eventData) { $systemData = array(new CLink($systemName, '/zabbix/eventlog.php?server=' . $systemName)); foreach ($headers as $value) { if (isset($eventData[$value])) { $systemData[] = _($eventData[$value]); } else { $systemData[] = _(""); } } $table->addRow($systemData); } return $table; }
public function _getContent($refresh = false) { if (!isset($this->config['sql'])) { return "SQL not set"; } $table = new CTableInfo($this->emptyText); $resultSet = DBselect($this->config['sql']); $result = DbFetchArray($resultSet); if (!empty($this->columns)) { $headers = array(); foreach ($this->columns as $column) { $headers[] = !empty($column['name']) ? $column['name'] : $column['field']; } } else { if (isset($result[0])) { foreach ($result[0] as $key => $value) { $headers[] = $key; $column = array('eval' => false, 'evalClass' => false, 'class' => null, 'width' => null, 'name' => $key, 'value' => $key); $this->columns[] = $column; } } else { $headers[] = "Empty Table"; } } if ($this->headers) { $table->setHeader($headers); } $index = 0; foreach ($result as $row) { $row['index'] = $index++; $crow = new CRow(null, $this->getRowClass($row)); foreach ($this->columns as $column) { $cell = new CCol($this->getValue($column, $row), $this->getClass($column, $row)); $crow->addItem($cell); } $table->addRow($crow); } return $table; }
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $status = get_status(); $server = $status['zabbix_server'] == _('Yes') ? (new CSpan(_('running')))->addClass(ZBX_STYLE_GREEN) : (new CSpan(_('not running')))->addClass(ZBX_STYLE_RED); $user_link = CWebUser::$data['alias']; if (!CWebUser::isGuest()) { $user_link = new CLink($user_link, 'profile.php'); } $server_link = _('Zabbix server'); if (CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN) { $server_link = new CLink($server_link, 'zabbix.php?action=report.status'); } $table = new CTableInfo(); $table->addRow(_('Users (online)') . NAME_DELIMITER . $status['users_count'] . '(' . $status['users_online'] . ')'); $table->addRow(new CCol([_('Logged in as'), SPACE, $user_link])); $table->addRow(new CCol([$server_link, SPACE, _('is'), SPACE, $server])); $table->addRow(new CCol([_('Hosts (m/n/t)') . NAME_DELIMITER . $status['hosts_count'] . '(', (new CSpan($status['hosts_count_monitored']))->addClass(ZBX_STYLE_GREEN), '/', (new CSpan($status['hosts_count_not_monitored']))->addClass(ZBX_STYLE_RED), '/', (new CSpan($status['hosts_count_template']))->addClass(ZBX_STYLE_GREY), ')'])); $table->addRow(new CCol([_('Items (m/d/n)') . NAME_DELIMITER . $status['items_count'] . '(', (new CSpan($status['items_count_monitored']))->addClass(ZBX_STYLE_GREEN), '/', (new CSpan($status['items_count_disabled']))->addClass(ZBX_STYLE_RED), '/', (new CSpan($status['items_count_not_supported']))->addClass(ZBX_STYLE_GREY), ')'])); $table->addRow(new CCol([_('Triggers (e/d)[p/o]') . NAME_DELIMITER . $status['triggers_count'] . '(' . $status['triggers_count_enabled'] . '/' . $status['triggers_count_disabled'] . ')[', (new CSpan($status['triggers_count_on']))->addClass(ZBX_STYLE_GREEN), '/', (new CSpan($status['triggers_count_off']))->addClass(ZBX_STYLE_RED), ']'])); $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT); return $this->getOutput((new CUiWidget(uniqid(), [$table, $footer]))->setHeader(_('Zabbix server info'))); }
$description[] = new CLink($template_host['name'], '?parent_discoveryid=' . $templateDiscoveryRuleId, 'unknown'); $description[] = NAME_DELIMITER; } $description[] = new CLink($item['name_expanded'], '?form=update&itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid']); $status = new CLink(itemIndicator($item['status']), '?group_itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid'] . '&go=' . ($item['status'] ? 'activate' : 'disable'), itemIndicatorStyle($item['status'])); if (!empty($item['applications'])) { order_result($item['applications'], 'name'); $applications = zbx_objectValues($item['applications'], 'name'); $applications = implode(', ', $applications); if (empty($applications)) { $applications = '-'; } } else { $applications = '-'; } $itemTable->addRow(array(new CCheckBox('group_itemid[' . $item['itemid'] . ']', null, null, $item['itemid']), $description, $item['key_'], $item['delay'], $item['history'], in_array($item['value_type'], array(ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_TEXT)) ? '' : $item['trends'], item_type2str($item['type']), new CCol($applications, 'wraptext'), $status)); } // create go buttons $goComboBox = new CComboBox('go'); $goOption = new CComboItem('activate', _('Enable selected')); $goOption->setAttribute('confirm', _('Enable selected item prototypes?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('disable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected item prototypes?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected item prototypes?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "group_itemid";');
} else { $table = new CTableInfo(S_NO_MEDIA_TYPES_DEFINED); $table->setHeader(array(make_sorting_link(S_TYPE, 'mt.type'), make_sorting_link(S_DESCRIPTION, 'mt.description'), S_DETAILS)); $result = DBselect('SELECT mt.* ' . ' FROM media_type mt' . ' WHERE ' . DBin_node('mt.mediatypeid') . order_by('mt.type,mt.description')); while ($row = DBfetch($result)) { switch ($row['type']) { case MEDIA_TYPE_EMAIL: $details = S_SMTP_SERVER . ": '" . $row['smtp_server'] . "', " . S_SMTP_HELO . ": '" . $row['smtp_helo'] . "', " . S_SMTP_EMAIL . ": '" . $row['smtp_email'] . "'"; break; case MEDIA_TYPE_EXEC: $details = S_SCRIPT_NAME . ": '" . $row['exec_path'] . "'"; break; case MEDIA_TYPE_SMS: $details = S_GSM_MODEM . ": '" . $row['gsm_modem'] . "'"; break; case MEDIA_TYPE_JABBER: $details = S_JABBER_IDENTIFIER . ": '" . $row['username'] . "'"; break; default: $details = ''; } $table->addRow(array(media_type2str($row['type']), new CLink($row["description"], "?&form=update&mediatypeid=" . $row["mediatypeid"], 'action'), $details)); $row_count++; } $table->show(); } zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");'); ?> <?php include_once "include/page_footer.php";
$sec_300[$row["type"]]++; } else { if ($now - $row["nextcheck"] <= 600) { $sec_600[$row["type"]]++; } else { $sec_rest[$row["type"]]++; } } } } } } $table->setHeader(array(S_ITEMS, S_5_SECONDS, S_10_SECONDS, S_30_SECONDS, S_1_MINUTE, S_5_MINUTES, S_MORE_THAN_10_MINUTES)); foreach ($item_types as $type) { $elements = array(item_type2str($type), new CCol($sec_10[$type], $sec_10[$type] ? "unknown_trigger" : "normal"), new CCol($sec_30[$type], $sec_30[$type] ? "information" : "normal"), new CCol($sec_60[$type], $sec_60[$type] ? "warning" : "normal"), new CCol($sec_300[$type], $sec_300[$type] ? "average" : "normal"), new CCol($sec_600[$type], $sec_600[$type] ? "high" : "normal"), new CCol($sec_rest[$type], $sec_rest[$type] ? "disaster" : "normal")); $table->addRow($elements); } } else { if ($_REQUEST["show"] == 1) { $db_proxies = DBselect('select hostid from hosts where status=' . HOST_STATUS_PROXY); while (null != ($db_proxy = DBfetch($db_proxies))) { $sec_10[$db_proxy['hostid']] = 0; $sec_30[$db_proxy['hostid']] = 0; $sec_60[$db_proxy['hostid']] = 0; $sec_300[$db_proxy['hostid']] = 0; $sec_600[$db_proxy['hostid']] = 0; $sec_rest[$db_proxy['hostid']] = 0; } $sec_10[0] = 0; $sec_30[0] = 0; $sec_60[0] = 0;
{ return zbx_date2str(DATE_TIME_FORMAT, $t); } function format_time2($t) { return format_time($t); } break; } $table->setHeader($header); $intervals = array(); for ($t = $from; $t <= $to; $t++) { if (($start = get_time($t)) > time()) { break; } if (($end = get_time($t + 1)) > time()) { $end = time(); } $intervals[] = array('from' => $start, 'to' => $end); } $sla = API::Service()->getSla(array('serviceids' => $service['serviceid'], 'intervals' => $intervals)); $sla = reset($sla); foreach ($sla['sla'] as $intervalSla) { $ok = new CSpan(sprintf('%dd %dh %dm', $intervalSla['okTime'] / SEC_PER_DAY, $intervalSla['okTime'] % SEC_PER_DAY / SEC_PER_HOUR, $intervalSla['okTime'] % SEC_PER_HOUR / SEC_PER_MIN), 'off'); $problems = new CSpan(sprintf('%dd %dh %dm', $intervalSla['problemTime'] / SEC_PER_DAY, $intervalSla['problemTime'] % SEC_PER_DAY / SEC_PER_HOUR, $intervalSla['problemTime'] % SEC_PER_HOUR / SEC_PER_MIN), 'on'); $downtime = sprintf('%dd %dh %dm', $intervalSla['downtimeTime'] / SEC_PER_DAY, $intervalSla['downtimeTime'] % SEC_PER_DAY / SEC_PER_HOUR, $intervalSla['downtimeTime'] % SEC_PER_HOUR / SEC_PER_MIN); $percentage = new CSpan(sprintf('%2.4f', $intervalSla['sla']), $intervalSla['sla'] >= $service['goodsla'] ? 'off' : 'on'); $table->addRow(array(format_time($intervalSla['from']), format_time2($intervalSla['to']), $ok, $problems, $downtime, $service['showsla'] ? $percentage : '-', $service['showsla'] ? new CSpan($service['goodsla']) : '-')); } $table->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
function make_discovery_status() { $drules = array(); $db_drules = DBselect('select distinct * from drules where ' . DBin_node('druleid') . ' order by name'); while ($drule_data = DBfetch($db_drules)) { $drules[$drule_data['druleid']] = $drule_data; $drules[$drule_data['druleid']]['up'] = 0; $drules[$drule_data['druleid']]['down'] = 0; } $db_dhosts = DBselect('SELECT d.* ' . ' FROM dhosts d ' . ' ORDER BY d.dhostid,d.status,d.ip'); $services = array(); $discovery_info = array(); while ($drule_data = DBfetch($db_dhosts)) { if (DHOST_STATUS_DISABLED == $drule_data['status']) { $drules[$drule_data['druleid']]['down']++; } else { $drules[$drule_data['druleid']]['up']++; } } $header = array(is_show_all_nodes() ? new CCol(S_NODE, 'center') : null, new CCol(S_DISCOVERY_RULE, 'center'), new CCol(S_UP), new CCol(S_DOWN)); $table = new CTableInfo(); $table->setHeader($header, 'vertical_header'); foreach ($drules as $druleid => $drule) { $table->addRow(array(get_node_name_by_elid($druleid), new CLink(get_node_name_by_elid($drule['druleid']) . $drule['name'], 'discovery.php?druleid=' . $druleid), new CSpan($drule['up'], 'green'), new CSpan($drule['down'], $drule['down'] > 0 ? 'red' : 'green'))); } $table->setFooter(new CCol(S_UPDATED . ': ' . date("H:i:s", time()))); return $table; }
if ($host['status'] == HOST_STATUS_MONITORED) { $monitoredHostIds[$host['hostid']] = true; } } } if ($monitoredHostIds) { $monitoredHosts = API::Host()->get(array('output' => array('hostid'), 'selectGroups' => array('groupid'), 'hostids' => array_keys($monitoredHostIds), 'preservekeys' => true)); } foreach ($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'] = $monitoredHosts[$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'], 'link_menu menu-host' . ($hosts[$hostId]['status'] == HOST_STATUS_NOT_MONITORED ? ' not-monitored' : '')); $hostName->setMenuPopup(CMenuPopupHelper::getHost($hosts[$hostId], $scripts[$hostId])); $triggerDescription = new CSpan($trigger['description'], 'link_menu'); $triggerDescription->setMenuPopup(CMenuPopupHelper::getTrigger($trigger)); $table->addRow(array($hostName, $triggerDescription, getSeverityCell($trigger['priority']), $trigger['cnt_event'])); } $rprt_wdgt->addItem($table); $rprt_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$exactComboBox->addItem('1', _('exactly')); $filterTable->addRow(array(array(array(bold(_('Field')), SPACE, $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $this->data['filterFieldValue'], 20)))), 'host-inventories'); $filter = new CSubmit('filter_set', _('Filter')); $filter->useJQueryStyle('main'); $reset = new CSubmit('filter_rst', _('Reset')); $reset->useJQueryStyle(); $divButtons = new CDiv(array($filter, SPACE, $reset)); $divButtons->setAttribute('style', 'padding: 4px 0px;'); $footerCol = new CCol($divButtons, 'controls'); $filterTable->addRow($footerCol); $filterForm = new CForm('get'); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter'); $filterForm->addItem($filterTable); $hostInventoryWidget->addFlicker($filterForm, CProfile::get('web.hostinventories.filter.state', 0)); $hostInventoryWidget->addHeaderRowNumber(); $table = new CTableInfo(_('No hosts found.')); $table->setHeader(array(make_sorting_header(_('Host'), 'name', $this->data['sort'], $this->data['sortorder']), _('Group'), make_sorting_header(_('Name'), 'pr_name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'pr_type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('OS'), 'pr_os', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Serial number A'), 'pr_serialno_a', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Tag'), 'pr_tag', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('MAC address A'), 'pr_macaddress_a', $this->data['sort'], $this->data['sortorder']))); foreach ($this->data['hosts'] as $host) { $hostGroups = array(); foreach ($host['groups'] as $group) { $hostGroups[] = $group['name']; } natsort($hostGroups); $hostGroups = implode(', ', $hostGroups); $row = array(new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid'), $host['status'] == HOST_STATUS_NOT_MONITORED ? 'not-monitored' : ''), $hostGroups, zbx_str2links($host['inventory']['name']), zbx_str2links($host['inventory']['type']), zbx_str2links($host['inventory']['os']), zbx_str2links($host['inventory']['serialno_a']), zbx_str2links($host['inventory']['tag']), zbx_str2links($host['inventory']['macaddress_a'])); $table->addRow($row); } $table = array($this->data['paging'], $table, $this->data['paging']); $hostInventoryWidget->addItem($table); return $hostInventoryWidget;
$createForm = new CForm('get'); $createForm->cleanItems(); $createForm->addItem(new CSubmit('form', _('Create discovery rule'))); $discoveryWidget->addPageHeader(_('CONFIGURATION OF DISCOVERY RULES'), $createForm); $discoveryWidget->addHeader(_('Discovery rules')); $discoveryWidget->addHeaderRowNumber(); // create form $discoveryForm = new CForm(); $discoveryForm->setName('druleForm'); // create table $discoveryTable = new CTableInfo(_('No discovery rules found.')); $discoveryTable->setHeader(array(new CCheckBox('all_drules', null, "checkAll('" . $discoveryForm->getName() . "', 'all_drules', 'g_druleid');"), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('IP range'), _('Delay'), _('Checks'), _('Status'))); foreach ($data['drules'] as $drule) { array_push($drule['description'], new CLink($drule['name'], '?form=update&druleid=' . $drule['druleid'])); $status = new CCol(new CLink(discovery_status2str($drule['status']), '?g_druleid[]=' . $drule['druleid'] . '&action=' . ($drule['status'] == DRULE_STATUS_ACTIVE ? 'drule.massdisable' : 'drule.massenable'), discovery_status2style($drule['status']))); $discoveryTable->addRow(array(new CCheckBox('g_druleid[' . $drule['druleid'] . ']', null, null, $drule['druleid']), $drule['description'], $drule['iprange'], $drule['delay'], !empty($drule['checks']) ? implode(', ', $drule['checks']) : '', $status)); } // create go buttons $goComboBox = new CComboBox('action'); $goOption = new CComboItem('drule.massenable', _('Enable selected')); $goOption->setAttribute('confirm', _('Enable selected discovery rules?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('drule.massdisable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected discovery rules?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('drule.massdelete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected discovery rules?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "g_druleid";');
$caption[] = new CLink($tpl['name'], 'templates.php?form=update&templateid=' . $tpl['templateid'], 'unknown'); $caption[] = ', '; } array_pop($caption); $caption[] = ')'; } $hostTemplates[] = $caption; $hostTemplates[] = ', '; } if ($hostTemplates) { array_pop($hostTemplates); } } // status $status = new CLink(item_status2str($hostPrototype['status']), '?group_hostid=' . $hostPrototype['hostid'] . '&parent_discoveryid=' . $discoveryRule['itemid'] . '&go=' . ($hostPrototype['status'] ? 'activate' : 'disable'), itemIndicatorStyle($hostPrototype['status'])); $hostTable->addRow(array(new CCheckBox('group_hostid[' . $hostPrototype['hostid'] . ']', null, null, $hostPrototype['hostid']), $name, new CCol($hostTemplates, 'wraptext'), $status)); } // create go buttons $goComboBox = new CComboBox('go'); $goOption = new CComboItem('activate', _('Activate selected')); $goOption->setAttribute('confirm', _('Enable selected host prototypes?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('disable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected host prototypes?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected host prototypes?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "group_hostid";');
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ zbx_add_post_js('jqBlink.blink();'); $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);
if ($user['type'] == USER_TYPE_ZABBIX_ADMIN) { $userTypeStyle = 'orange'; } if ($user['type'] == USER_TYPE_SUPER_ADMIN) { $userTypeStyle = 'disabled'; } // gui access style $guiAccessStyle = 'green'; if ($user['gui_access'] == GROUP_GUI_ACCESS_INTERNAL) { $guiAccessStyle = 'orange'; } if ($user['gui_access'] == GROUP_GUI_ACCESS_DISABLED) { $guiAccessStyle = 'disabled'; } // append user to table $usersTable->addRow(array(new CCheckBox('group_userid[' . $userId . ']', null, null, $userId), new CLink($user['alias'], 'users.php?form=update&userid=' . $userId), $user['name'], $user['surname'], user_type2str($user['type']), $usersGroups, $online, $blocked, new CSpan(user_auth_type2str($user['gui_access']), $guiAccessStyle), $user['debug_mode'] == GROUP_DEBUG_MODE_ENABLED ? new CSpan(_('Enabled'), 'orange') : new CSpan(_('Disabled'), 'green'), $user['users_status'] == 1 ? new CSpan(_('Disabled'), 'red') : new CSpan(_('Enabled'), 'green'))); } // append Go buttons $goComboBox = new CComboBox('action'); $goOption = new CComboItem('user.massunblock', _('Unblock selected')); $goOption->setAttribute('confirm', _('Unblock selected users?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('user.massdelete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected users?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "group_userid";'); // append table to form $usersForm->addItem(array($this->data['paging'], $usersTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton)))); // append form to widget
$actionLinks = array(); if (!empty($mediaType['listOfActions'])) { foreach ($mediaType['listOfActions'] as $action) { $actionLinks[] = new CLink($action['name'], 'actionconf.php?form=update&actionid=' . $action['actionid']); $actionLinks[] = ', '; } array_pop($actionLinks); } else { $actionLinks = '-'; } $actionColumn = new CCol($actionLinks); $actionColumn->setAttribute('style', 'white-space: normal;'); $statusLink = 'media_types.php?go=' . ($mediaType['status'] == MEDIA_TYPE_STATUS_DISABLED ? 'activate' : 'disable') . '&mediatypeids' . SQUAREBRACKETS . '=' . $mediaType['mediatypeid']; $status = MEDIA_TYPE_STATUS_ACTIVE == $mediaType['status'] ? new CLink(_('Enabled'), $statusLink, 'enabled') : new CLink(_('Disabled'), $statusLink, 'disabled'); // append row $mediaTypeTable->addRow(array(new CCheckBox('mediatypeids[' . $mediaType['mediatypeid'] . ']', null, null, $mediaType['mediatypeid']), $this->data['displayNodes'] ? $mediaType['nodename'] : null, new CLink($mediaType['description'], '?form=edit&mediatypeid=' . $mediaType['mediatypeid']), media_type2str($mediaType['typeid']), $status, $actionColumn, $details)); } // create go button $goComboBox = new CComboBox('go'); $goOption = new CComboItem('activate', _('Enable selected')); $goOption->setAttribute('confirm', _('Enable selected media types?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('disable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected media types?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected media types?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "mediatypeids";');
while ($templategroup = DBfetch($res)) { $hostsgroups[$templategroup['hostid']] = $templategroup['groupid']; } $params = array('nodeids' => get_current_nodeid(), 'pattern' => $search, 'count' => 1, 'editable' => 1); $hosts_count = CTemplate::get($params); $overalCount = $hosts_count['rowscount']; $viewCount = count($templates); $header = array(is_show_all_nodes() ? new CCol(S_NODE) : null, new CCol(S_TEMPLATES), new CCol(S_ITEMS), new CCol(S_TRIGGERS), new CCol(S_GRAPHS)); $table = new CTableInfo(); $table->setHeader($header); foreach ($templates as $num => $template) { $templateid = $template['hostid']; $groupid = isset($hostsgroups[$templateid]) ? $hostsgroups[$templateid] : 0; $link = 'groupid=' . $groupid . '&hostid=' . $templateid; $caption = make_decoration($template['host'], $search); $table->addRow(array(get_node_name_by_elid($templateid), new CLink($caption, 'hosts.php?config=3&hostid=' . $templateid), new CLink(S_GO, 'items.php?' . $link), new CLink(S_GO, 'triggers.php?' . $link), new CLink(S_GO, 'graphs.php?' . $link))); } $table->setFooter(new CCol(S_DISPLAYING . SPACE . $viewCount . SPACE . S_OF_SMALL . SPACE . $overalCount . SPACE . S_FOUND_SMALL)); $wdgt_templates = new CWidget('search_templates', $table); $wdgt_templates->addHeader(S_TEMPLATES, SPACE); $right_tab->addRow($wdgt_templates); } //---------------- $td_l = new CCol($left_tab); $td_l->setAttribute('valign', 'top'); $td_r = new CCol($right_tab); $td_r->setAttribute('valign', 'top'); $outer_table = new CTable(); $outer_table->setAttribute('border', 0); $outer_table->setCellPadding(1); $outer_table->setCellSpacing(1);
/** * 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; }
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; }
order_result($httpTests, getPageSortField('name'), getPageSortOrder()); // fetch the latest results of the web scenario $lastHttpTestData = Manager::HttpTest()->getLastData(array_keys($httpTests)); foreach ($httpTests as $httpTest) { $lastData = isset($lastHttpTestData[$httpTest['httptestid']]) ? $lastHttpTestData[$httpTest['httptestid']] : null; // test has history data if ($lastData) { $lastcheck = zbx_date2str(_('d M Y H:i:s'), $lastData['lastcheck']); if ($lastData['lastfailedstep'] != 0) { $step_data = get_httpstep_by_no($httpTest['httptestid'], $lastData['lastfailedstep']); $status['msg'] = _s('Step "%1$s" [%2$s of %3$s] failed: %4$s', $step_data['name'], $lastData['lastfailedstep'], $httpTest['steps'], $lastData['error']); $status['style'] = 'disabled'; } else { $status['msg'] = _('OK'); $status['style'] = 'enabled'; } } else { $lastcheck = _('Never'); $status['msg'] = _('Unknown'); $status['style'] = 'unknown'; } $cpsan = new CSpan($httpTest['hostname'], $httpTest['host']['status'] == HOST_STATUS_NOT_MONITORED ? 'not-monitored' : ''); $table->addRow(new CRow(array($displayNodes ? get_node_name_by_elid($httpTest['httptestid'], true) : null, $_REQUEST['hostid'] > 0 ? null : $cpsan, new CLink($httpTest['name'], 'httpdetails.php?httptestid=' . $httpTest['httptestid']), $httpTest['steps'], $lastcheck, new CSpan($status['msg'], $status['style'])))); } } else { $tmp = array(); getPagingLine($tmp); } $httpmon_wdgt->addItem(array($paging, $table, $paging)); $httpmon_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
} 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;