require_once dirname(__FILE__) . '/include/page_header.php'; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('hosts' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'groups' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'clear_templates' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'templates' => array(T_ZBX_STR, O_OPT, null, null, null), 'templateid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form})&&({form}=="update")'), 'template_name' => array(T_ZBX_STR, O_OPT, NOT_EMPTY, null, 'isset({save})'), 'visiblename' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'twb_groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'newgroup' => array(T_ZBX_STR, O_OPT, null, null, null), 'macros_rem' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'macros' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'macro_new' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, 'isset({macro_add})'), 'value_new' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, 'isset({macro_add})'), 'macro_add' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'go' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'unlink' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'unlink_and_clear' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'clone' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'full_clone' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'delete' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'delete_and_clear' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_STR, O_OPT, null, null, null)); // OUTER DATA check_fields($fields); validate_sort_and_sortorder('name', ZBX_SORT_UP); $_REQUEST['go'] = get_request('go', 'none'); // PERMISSIONS if (get_request('groupid', 0) > 0) { $groupids = available_groups($_REQUEST['groupid'], 1); if (empty($groupids)) { access_deny(); } } if (get_request('templateid', 0) > 0) { $hostids = available_hosts($_REQUEST['templateid'], 1); if (empty($hostids)) { access_deny(); } } $templateids = get_request('templates', array()); if ($EXPORT_DATA) { $export = new CConfigurationExport(array('templates' => $templateids)); $export->setBuilder(new CConfigurationExportBuilder()); $export->setWriter(CExportWriterFactory::getWriter(CExportWriterFactory::XML)); $exportData = $export->export(); if (no_errors()) { print $exportData; } else { show_messages(); }
* Filtro avançado ----------------------------------------------------------------------------------------------- */ // Inicialização das variáveis ------------------------------------------------------------------------------- $options = array('groups' => array('monitored_hosts' => 1), 'hosts' => array('monitored_hosts' => 1), 'groupid' => get_request('groupid', null), 'hostid' => get_request('hostid', null), 'formato' => get_request('itemid', null)); $groupid = $_REQUEST['groupid'] = get_request('groupid', 0); $hostid = $_REQUEST['hostid'] = get_request('hostid', 0); $formato = $_REQUEST['formato'] = get_request('formato', 'html'); if (get_request('groupid', 0) > 0) { $groupids = available_groups($_REQUEST['groupid'], 1); $params = array('preservekeys' => 1, 'output' => API_OUTPUT_EXTEND); if (empty($groupids)) { access_deny(); } } if (get_request('hostid', 0) > 0) { $hostids = available_hosts($_REQUEST['hostid'], 1); if (empty($hostids)) { access_deny(); } } // $pageFilter = new CPageFilter($options); // Filtro por usuário // Filtro por Tipo de ação // Filtro por Recurso // Filtro por grupo // Filtro por host // Filtro por período /* * Filter */ /*
} elseif (isset($_REQUEST['chstatus']) && isset($_REQUEST['hostid'])) { DBstart(); $result = updateHostStatus($_REQUEST['hostid'], $_REQUEST['chstatus']); $result = DBend($result); show_messages($result, _('Host status updated'), _('Cannot update host status')); unset($_REQUEST['chstatus'], $_REQUEST['hostid']); } elseif ($_REQUEST['go'] == 'delete') { $hostids = get_request('hosts', array()); DBstart(); $go_result = API::Host()->delete(zbx_toObject($hostids, 'hostid')); $go_result = DBend($go_result); show_messages($go_result, _('Host deleted'), _('Cannot delete host')); } elseif (str_in_array($_REQUEST['go'], array('activate', 'disable'))) { $status = $_REQUEST['go'] == 'activate' ? HOST_STATUS_MONITORED : HOST_STATUS_NOT_MONITORED; $hosts = get_request('hosts', array()); $act_hosts = available_hosts($hosts, 1); DBstart(); $go_result = updateHostStatus($act_hosts, $status); $go_result = DBend($go_result); show_messages($go_result, _('Host status updated'), _('Cannot update host status')); } if ($_REQUEST['go'] != 'none' && isset($go_result) && $go_result) { $url = new CUrl(); $path = $url->getPath(); insert_js('cookie.eraseArray("' . $path . '")'); } /* * Display */ $hosts_wdgt = new CWidget(); $pageFilter = new CPageFilter(array('groups' => array('real_hosts' => 1, 'editable' => true), 'groupid' => get_request('groupid', null)));