/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { global $page; // rewrite page file $page['file'] = $this->pageFile; $item = new CUIWidget('hat_syssum', make_system_status(array('groupids' => null, 'hostids' => null, 'maintenance' => null, 'severity' => null, 'limit' => null, 'extAck' => 0, 'screenid' => $this->screenid))); $item->setHeader(_('Status of Zabbix'), SPACE); $item->setFooter(_s('Updated: %s', zbx_date2str(_('H:i:s')))); return $this->getOutput($item); }
$lastiss = new CUIWidget('hat_lastiss', new CSpan(_('Loading...'), 'textcolorstyles'), CProfile::get('web.dashboard.hats.hat_lastiss.state', 1)); $lastiss->setHeader(_n('Last %1$d issue', 'Last %1$d issues', DEFAULT_LATEST_ISSUES_CNT), array($refresh_menu)); $lastiss->setFooter(new CDiv(SPACE, 'textwhite', 'hat_lastiss_footer')); $rightColumn[] = $lastiss; // web monitoring $refresh_menu = get_icon('menu', array('menu' => 'hat_webovr')); $web_mon = new CUIWidget('hat_webovr', new CSpan(_('Loading...'), 'textcolorstyles'), CProfile::get('web.dashboard.hats.hat_webovr.state', 1)); $web_mon->setHeader(_('Web monitoring'), array($refresh_menu)); $web_mon->setFooter(new CDiv(SPACE, 'textwhite', 'hat_webovr_footer')); $rightColumn[] = $web_mon; // discovery info $drules = DBfetch(DBselect('SELECT COUNT(d.druleid) AS cnt FROM drules d WHERE ' . DBin_node('d.druleid') . ' AND d.status=' . DRULE_STATUS_ACTIVE)); if ($drules['cnt'] > 0 && check_right_on_discovery(PERM_READ_ONLY)) { $refresh_tab[] = array('id' => 'hat_dscvry', 'frequency' => CProfile::get('web.dashboard.rf_rate.hat_dscvry', 60)); $refresh_menu = get_icon('menu', array('menu' => 'hat_dscvry')); $dcvr_mon = new CUIWidget('hat_dscvry', new CSpan(_('Loading...'), 'textcolorstyles'), CProfile::get('web.dashboard.hats.hat_dscvry.state', 1)); $dcvr_mon->setHeader(_('Discovery status'), array($refresh_menu)); $dcvr_mon->setFooter(new CDiv(SPACE, 'textwhite', 'hat_dscvry_footer')); $rightColumn[] = $dcvr_mon; } add_doll_objects($refresh_tab); $dashboardTable = new CTable(); $dashboardTable->addRow(array(new CDiv($leftColumn, 'column'), new CDiv($rightColumn, 'column'), new CDiv(null, 'column')), 'top'); $dashboardWidget->addItem($dashboardTable); $dashboardWidget->show(); // activating blinking zbx_add_post_js('jqBlink.blink();'); ?> <script type="text/javascript"> //<!--<![CDATA[ function addPopupValues(list) {
$link = 'groupid=' . $group['groupid'] . '&hostid=' . $templateid . '&switch_node=' . id2nodeid($templateid); $caption = make_decoration($template['name'], $search); if (isset($rw_templates[$templateid])) { $template_link = new CLink($caption, 'templates.php?form=update&' . '&templateid=' . $templateid . '&switch_node=' . id2nodeid($templateid)); $applications_link = array(new CLink(_('Applications'), 'applications.php?' . $link), ' (' . $template['applications'] . ')'); $items_link = array(new CLink(_('Items'), 'items.php?filter_set=1&' . $link), ' (' . $template['items'] . ')'); $triggers_link = array(new CLink(_('Triggers'), 'triggers.php?' . $link), ' (' . $template['triggers'] . ')'); $graphs_link = array(new CLink(_('Graphs'), 'graphs.php?' . $link), ' (' . $template['graphs'] . ')'); $screensLink = array(new CLink(_('Screens'), 'screenconf.php?templateid=' . $templateid), ' (' . $template['screens'] . ')'); $discoveryLink = array(new CLink(_('Discovery'), 'host_discovery.php?' . $link), ' (' . $template['discoveries'] . ')'); $httpTestsLink = array(new CLink(_('Web'), 'httpconf.php?' . $link), ' (' . $template['httpTests'] . ')'); } else { $template_link = new CSpan($caption); $applications_link = _('Applications') . ' (' . $template['applications'] . ')'; $items_link = _('Items') . ' (' . $template['items'] . ')'; $triggers_link = _('Triggers') . ' (' . $template['triggers'] . ')'; $graphs_link = _('Graphs') . ' (' . $template['graphs'] . ')'; $screensLink = _('Screens') . ' (' . $template['screens'] . ')'; $discoveryLink = _('Discovery') . ' (' . $template['discoveries'] . ')'; $httpTestsLink = _('Web') . ' (' . $template['httpTests'] . ')'; } $table->addRow(array(get_node_name_by_elid($templateid, true), $template_link, $applications_link, $items_link, $triggers_link, $graphs_link, $screensLink, $discoveryLink, $httpTestsLink)); } $wdgt_templates = new CUIWidget('search_templates', $table, CProfile::get('web.search.hats.search_templates.state', true)); $wdgt_templates->setHeader(_('Templates'), SPACE); $wdgt_templates->setFooter(_s('Displaying %1$s of %2$s found', $viewCount, $overalCount)); $searchWidget->addItem(new CDiv($wdgt_templates)); } //---------------- $searchWidget->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $params = array('groupids' => null, 'hostids' => null, 'screenid' => $this->screenid, 'maintenance' => null, 'severity' => null, 'limit' => $this->screenitem['elements'], 'backUrl' => $this->pageFile); // by default triggers are sorted by date desc, do we need to override this? switch ($this->screenitem['sort_triggers']) { case SCREEN_SORT_TRIGGERS_SEVERITY_DESC: $params['sortfield'] = 'priority'; $params['sortorder'] = ZBX_SORT_DOWN; break; case SCREEN_SORT_TRIGGERS_HOST_NAME_ASC: // a little black magic here - there is no such field 'hostname' in 'triggers', // but API has a special case for sorting by hostname $params['sortfield'] = 'hostname'; $params['sortorder'] = ZBX_SORT_UP; break; } if ($this->screenitem['resourceid'] > 0) { $hosts = API::Host()->get(array('hostids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND)); $host = reset($hosts); $item = new CSpan(_('Host') . ': ' . $host['host'], 'white'); $params['hostids'] = $host['hostid']; } else { $groupid = get_request('tr_groupid', CProfile::get('web.screens.tr_groupid', 0)); $hostid = get_request('tr_hostid', CProfile::get('web.screens.tr_hostid', 0)); CProfile::update('web.screens.tr_groupid', $groupid, PROFILE_TYPE_ID); CProfile::update('web.screens.tr_hostid', $hostid, PROFILE_TYPE_ID); // get groups $groups = API::HostGroup()->get(array('monitored_hosts' => true, 'output' => API_OUTPUT_EXTEND)); order_result($groups, 'name'); // get hsots $options = array('monitored_hosts' => true, 'output' => API_OUTPUT_EXTEND); if ($groupid > 0) { $options['groupids'] = $groupid; } $hosts = API::Host()->get($options); $hosts = zbx_toHash($hosts, 'hostid'); order_result($hosts, 'host'); if (!isset($hosts[$hostid])) { $hostid = 0; } if ($groupid > 0) { $params['groupids'] = $groupid; } if ($hostid > 0) { $params['hostids'] = $hostid; } $item = new CForm(null, $this->pageFile); $groupComboBox = new CComboBox('tr_groupid', $groupid, 'submit()'); $groupComboBox->addItem(0, _('all')); foreach ($groups as $group) { $groupComboBox->addItem($group['groupid'], get_node_name_by_elid($group['groupid'], null, ': ') . $group['name']); } $hostsComboBox = new CComboBox('tr_hostid', $hostid, 'submit()'); $hostsComboBox->addItem(0, _('all')); foreach ($hosts as $host) { $hostsComboBox->addItem($host['hostid'], get_node_name_by_elid($host['hostid'], null, ': ') . $host['host']); } if ($this->mode == SCREEN_MODE_EDIT) { $groupComboBox->attr('disabled', 'disabled'); $hostsComboBox->attr('disabled', 'disabled'); } $item->addItem(array(_('Group') . SPACE, $groupComboBox)); $item->addItem(array(SPACE . _('Host') . SPACE, $hostsComboBox)); } $output = new CUIWidget('hat_trstatus', make_latest_issues($params)); $output->setDoubleHeader(array(_('STATUS OF TRIGGERS'), SPACE, zbx_date2str(_('[H:i:s]')), SPACE), $item); return $this->getOutput($output); }
$left_col[] = $triggerDetails; // event details $eventDetails = new CUIWidget('hat_eventdetails', make_event_details($event, $trigger)); $eventDetails->setHeader(_('Event details')); $left_col[] = $eventDetails; $right_col = array(); // if acknowledges are not disabled in configuration, let's show them if ($config['event_ack_enable']) { $event_ack = new CUIWidget('hat_eventack', makeAckTab($event), CProfile::get('web.tr_events.hats.hat_eventack.state', 1)); $event_ack->setHeader(_('Acknowledges')); $right_col[] = $event_ack; } // event sms actions $actions_sms = new CUIWidget('hat_eventactionmsgs', get_action_msgs_for_event($event), CProfile::get('web.tr_events.hats.hat_eventactionmsgs.state', 1)); $actions_sms->setHeader(_('Message actions')); $right_col[] = $actions_sms; // event cmd actions $actions_cmd = new CUIWidget('hat_eventactionmcmds', get_action_cmds_for_event($event), CProfile::get('web.tr_events.hats.hat_eventactioncmds.state', 1)); $actions_cmd->setHeader(_('Command actions')); $right_col[] = $actions_cmd; // event history $events_histry = new CUIWidget('hat_eventlist', make_small_eventlist($event), CProfile::get('web.tr_events.hats.hat_eventlist.state', 1)); $events_histry->setHeader(_('Event list [previous 20]')); $right_col[] = $events_histry; $leftDiv = new CDiv($left_col, 'column'); $middleDiv = new CDiv($right_col, 'column'); $ieTab = new CTable(); $ieTab->addRow(array($leftDiv, $middleDiv), 'top'); $tr_event_wdgt->addItem($ieTab); $tr_event_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';