require_once 'include/config.inc.php'; require_once 'include/hosts.inc.php'; require_once 'include/events.inc.php'; require_once 'include/actions.inc.php'; require_once 'include/discovery.inc.php'; require_once 'include/html.inc.php'; $page['title'] = 'S_LATEST_EVENTS'; $page['file'] = 'events.php'; $page['hist_arg'] = array('groupid', 'hostid'); $page['scripts'] = array('class.calendar.js', 'effects.js', 'dragdrop.js', 'gtlc.js'); $page['type'] = detect_page_type(PAGE_TYPE_HTML); if (PAGE_TYPE_HTML == $page['type']) { define('ZBX_PAGE_DO_REFRESH', 1); } include_once 'include/page_header.php'; $allow_discovery = check_right_on_discovery(PERM_READ_ONLY); $allowed_sources[] = EVENT_SOURCE_TRIGGERS; if ($allow_discovery) { $allowed_sources[] = EVENT_SOURCE_DISCOVERY; } // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('source' => array(T_ZBX_INT, O_OPT, P_SYS, IN($allowed_sources), NULL), 'groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'triggerid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'period' => array(T_ZBX_INT, O_OPT, null, null, null), 'dec' => array(T_ZBX_INT, O_OPT, null, null, null), 'inc' => array(T_ZBX_INT, O_OPT, null, null, null), 'left' => array(T_ZBX_INT, O_OPT, null, null, null), 'right' => array(T_ZBX_INT, O_OPT, null, null, null), 'stime' => array(T_ZBX_STR, O_OPT, null, null, null), 'load' => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), NULL), 'filter_rst' => array(T_ZBX_INT, O_OPT, P_SYS, IN(array(0, 1)), NULL), 'filter_set' => array(T_ZBX_STR, O_OPT, P_SYS, null, NULL), 'hide_unknown' => array(T_ZBX_INT, O_OPT, P_SYS, IN(array(0, 1)), NULL), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, NULL, NULL), 'favref' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'), 'state' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})')); check_fields($fields); /* AJAX */ if (isset($_REQUEST['favobj'])) { if ('filter' == $_REQUEST['favobj']) { CProfile::update('web.events.filter.state', $_REQUEST['state'], PROFILE_TYPE_INT); } } if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) { include_once 'include/page_footer.php';
} // 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.widget.webovr.state', 1)); $web_mon->setHeader(_('Web monitoring'), array($refresh_menu)); $web_mon->setFooter(new CDiv(SPACE, 'textwhite', 'hat_webovr_footer')); $col = CProfile::get('web.dashboard.widget.webovr.col', '1'); $row = CProfile::get('web.dashboard.widget.webovr.row', '4'); if (!isset($columns[$col][$row])) { $columns[$col][$row] = $web_mon; } else { $columns[$col][] = $web_mon; } // discovery info $drules = DBfetch(DBselect('SELECT COUNT(d.druleid) AS cnt' . ' FROM drules d' . ' WHERE d.status=' . DRULE_STATUS_ACTIVE . andDbNode('d.druleid'))); if ($drules['cnt'] > 0 && check_right_on_discovery()) { $refresh_tab[] = array('id' => 'hat_dscvry', 'frequency' => CProfile::get('web.dashboard.widget.dscvry.rf_rate', 60)); $refresh_menu = get_icon('menu', array('menu' => 'hat_dscvry')); $dcvr_mon = new CUIWidget('hat_dscvry', new CSpan(_('Loading...'), 'textcolorstyles'), CProfile::get('web.dashboard.widget.dscvry.state', 1)); $dcvr_mon->setHeader(_('Discovery status'), array($refresh_menu)); $dcvr_mon->setFooter(new CDiv(SPACE, 'textwhite', 'hat_dscvry_footer')); $col = CProfile::get('web.dashboard.widget.dscvry.col', '1'); $row = CProfile::get('web.dashboard.widget.dscvry.row', '5'); if (!isset($columns[$col][$row])) { $columns[$col][$row] = $dcvr_mon; } else { $columns[$col][] = $dcvr_mon; } } add_doll_objects($refresh_tab); foreach ($columns as $key => $val) {
$rightColumn[] = $hoststat; // last issues $refresh_menu = get_icon('menu', array('menu' => 'hat_lastiss')); $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();'); ?>
$csvRows = []; $page['type'] = detect_page_type(PAGE_TYPE_CSV); $page['file'] = 'zbx_events_export.csv'; require_once dirname(__FILE__) . '/include/func.inc.php'; } else { $csvExport = false; $page['title'] = _('Latest events'); $page['file'] = 'events.php'; $page['scripts'] = ['class.calendar.js', 'gtlc.js']; $page['type'] = detect_page_type(PAGE_TYPE_HTML); if (PAGE_TYPE_HTML == $page['type']) { define('ZBX_PAGE_DO_REFRESH', 1); } } require_once dirname(__FILE__) . '/include/page_header.php'; $allow_discovery = check_right_on_discovery(); $allowed_sources[] = EVENT_SOURCE_TRIGGERS; if ($allow_discovery) { $allowed_sources[] = EVENT_SOURCE_DISCOVERY; } // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = ['source' => [T_ZBX_INT, O_OPT, P_SYS, IN($allowed_sources), null], 'groupid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null], 'hostid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null], 'triggerid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null], 'period' => [T_ZBX_INT, O_OPT, null, null, null], 'stime' => [T_ZBX_STR, O_OPT, null, null, null], 'load' => [T_ZBX_STR, O_OPT, P_SYS, NULL, null], 'fullscreen' => [T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null], 'csv_export' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'filter_rst' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'filter_set' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'favobj' => [T_ZBX_STR, O_OPT, P_ACT, null, null], 'favid' => [T_ZBX_INT, O_OPT, P_ACT, null, null]]; check_fields($fields); /* * Permissions */ if (getRequest('groupid') && !API::HostGroup()->isReadable([getRequest('groupid')])) { access_deny(); } if (getRequest('hostid') && !API::Host()->isReadable([getRequest('hostid')])) { access_deny();