示例#1
0
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null), 'btnSelect' => array(T_ZBX_STR, O_OPT, null, null, null), 'filter_rst' => array(T_ZBX_STR, O_OPT, P_ACT, null, NULL), 'filter_set' => array(T_ZBX_STR, O_OPT, P_ACT, null, NULL), 'show_triggers' => array(T_ZBX_INT, O_OPT, null, null, null), 'show_events' => array(T_ZBX_INT, O_OPT, P_SYS, null, null), 'ack_status' => array(T_ZBX_INT, O_OPT, P_SYS, null, null), 'show_severity' => array(T_ZBX_INT, O_OPT, P_SYS, null, null), 'show_details' => array(T_ZBX_INT, O_OPT, null, null, null), 'status_change_days' => array(T_ZBX_INT, O_OPT, null, null, null), 'status_change' => array(T_ZBX_INT, O_OPT, null, null, null), 'txt_select' => array(T_ZBX_STR, O_OPT, null, null, 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);
if (isset($_REQUEST['favobj'])) {
    if ('filter' == $_REQUEST['favobj']) {
        CProfile::update('web.tr_status.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';
    exit;
}
//--------
$config = select_config();
$options = array('groups' => array('monitored_hosts' => 1, 'with_monitored_triggers' => 1), 'hosts' => array('monitored_hosts' => 1, 'with_monitored_triggers' => 1), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = $pageFilter->hostid;
/* FILTER */
if (isset($_REQUEST['filter_rst'])) {
    $_REQUEST['show_details'] = 0;
    $_REQUEST['show_triggers'] = TRIGGERS_OPTION_ONLYTRUE;
    $_REQUEST['show_events'] = EVENTS_OPTION_NOEVENT;
    $_REQUEST['ack_status'] = ZBX_ACK_STS_ANY;
    $_REQUEST['show_severity'] = -1;
    $_REQUEST['txt_select'] = '';
    $_REQUEST['status_change'] = 0;
    $_REQUEST['status_change_days'] = 14;
} else {
    if (isset($_REQUEST['filter_set'])) {
        $_REQUEST['show_details'] = get_request('show_details', 0);
示例#2
0
require_once dirname(__FILE__) . '/include/page_header.php';
//		VAR				TYPE		OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), 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));
check_fields($fields);
/*
 * Permissions
 */
if (get_request('groupid') && !API::HostGroup()->isReadable(array($_REQUEST['groupid']))) {
    access_deny();
}
if (get_request('hostid') && !API::Host()->isReadable(array($_REQUEST['hostid']))) {
    access_deny();
}
validate_sort_and_sortorder('name', ZBX_SORT_DOWN);
$options = array('groups' => array('real_hosts' => true, 'with_httptests' => true), 'hosts' => array('with_monitored_items' => true, 'with_httptests' => true), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = $pageFilter->hostid;
$displayNodes = is_array(get_current_nodeid()) && $pageFilter->groupid == 0 && $pageFilter->hostid == 0;
$r_form = new CForm('get');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$r_form->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
$r_form->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true)));
$httpmon_wdgt = new CWidget();
$httpmon_wdgt->addPageHeader(_('STATUS OF WEB MONITORING'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$httpmon_wdgt->addHeader(_('Web scenarios'), $r_form);
$httpmon_wdgt->addHeaderRowNumber();
// TABLE
$table = new CTableInfo(_('No web scenarios found.'));
$table->SetHeader(array($displayNodes ? _('Node') : null, $_REQUEST['hostid'] == 0 ? make_sorting_header(_('Host'), 'hostname') : null, make_sorting_header(_('Name'), 'name'), _('Number of steps'), _('Last check'), _('Status')));
$paging = null;
$sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'host_count'));
$sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_DOWN));
CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR);
CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
/*
 * Permissions
 */
if (getRequest('groupid') && !API::HostGroup()->isReadable([$_REQUEST['groupid']])) {
    access_deny();
}
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
    require_once dirname(__FILE__) . '/include/page_footer.php';
    exit;
}
$options = ['groups' => ['real_hosts' => 1], 'groupid' => getRequest('groupid')];
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['groupby'] = getRequest('groupby', '');
$groupFieldTitle = '';
$hostinvent_wdgt = (new CWidget())->setTitle(_('Host inventory overview'));
// getting inventory fields to make a drop down
$inventoryFields = getHostInventories(true);
// 'true' means list should be ordered by title
$inventoryFieldsComboBox = new CComboBox('groupby', $_REQUEST['groupby'], 'submit()');
$inventoryFieldsComboBox->addItem('', _('not selected'));
foreach ($inventoryFields as $inventoryField) {
    $inventoryFieldsComboBox->addItem($inventoryField['db_field'], $inventoryField['title'], $_REQUEST['groupby'] === $inventoryField['db_field'] ? 'yes' : null);
    if ($_REQUEST['groupby'] === $inventoryField['db_field']) {
        $groupFieldTitle = $inventoryField['title'];
    }
}
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('Host inventory overview');
$page['file'] = 'hostinventoriesoverview.php';
$page['hist_arg'] = array('groupid', 'hostid');
require_once dirname(__FILE__) . '/include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'groupby' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, NULL));
check_fields($fields);
validate_sort_and_sortorder('host_count', ZBX_SORT_DOWN);
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
    require_once dirname(__FILE__) . '/include/page_footer.php';
    exit;
}
$options = array('groups' => array('real_hosts' => 1), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['groupby'] = get_request('groupby', '');
$groupFieldTitle = '';
$hostinvent_wdgt = new CWidget();
$hostinvent_wdgt->addPageHeader(_('HOST INVENTORY OVERVIEW'));
// getting inventory fields to make a drop down
$inventoryFields = getHostInventories(true);
// 'true' means list should be ordered by title
$inventoryFieldsComboBox = new CComboBox('groupby', $_REQUEST['groupby'], 'submit()');
$inventoryFieldsComboBox->addItem('', _('not selected'));
foreach ($inventoryFields as $inventoryField) {
    $inventoryFieldsComboBox->addItem($inventoryField['db_field'], $inventoryField['title'], $_REQUEST['groupby'] === $inventoryField['db_field'] ? 'yes' : null);
    if ($_REQUEST['groupby'] === $inventoryField['db_field']) {
        $groupFieldTitle = $inventoryField['title'];
    }
示例#5
0
    // if elementid is used to fetch an element, saving it in profile
    if (!$this->data['use_screen_name']) {
        CProfile::update('web.screens.elementid', $screen['screenid'], PROFILE_TYPE_ID);
    }
    // page header
    $screenWidget->addPageHeader(_('SCREENS'), array($headerForm, SPACE, get_icon('favourite', array('fav' => 'web.favorite.screenids', 'elname' => 'screenid', 'elid' => $screen['screenid'])), SPACE, get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen']))));
    $screenWidget->addItem(BR());
    // append screens combobox to page header
    $headerForm = new CForm('get');
    $headerForm->setName('headerForm');
    $headerForm->addVar('fullscreen', $this->data['fullscreen']);
    $elementsComboBox = new CComboBox('elementid', $screen['screenid'], 'submit()');
    foreach ($this->data['screens'] as $dbScreen) {
        $elementsComboBox->addItem($dbScreen['screenid'], htmlspecialchars(get_node_name_by_elid($dbScreen['screenid'], null, NAME_DELIMITER) . $dbScreen['name']));
    }
    $headerForm->addItem(array(_('Screens') . SPACE, $elementsComboBox));
    if (check_dynamic_items($screen['screenid'], 0)) {
        $pageFilter = new CPageFilter(array('groups' => array('monitored_hosts' => true, 'with_items' => true), 'hosts' => array('monitored_hosts' => true, 'with_items' => true, 'DDFirstLabel' => _('Default')), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null)));
        $_REQUEST['groupid'] = $pageFilter->groupid;
        $_REQUEST['hostid'] = $pageFilter->hostid;
        $headerForm->addItem(array(SPACE, _('Group'), SPACE, $pageFilter->getGroupsCB(true)));
        $headerForm->addItem(array(SPACE, _('Host'), SPACE, $pageFilter->getHostsCB(true)));
    }
    $screenWidget->addHeader($screen['name'], $headerForm);
    // append screens to widget
    $screenBuilder = new CScreenBuilder(array('screenid' => $screen['screenid'], 'mode' => SCREEN_MODE_PREVIEW, 'profileIdx' => 'web.screens', 'profileIdx2' => $screen['screenid'], 'groupid' => get_request('groupid'), 'hostid' => get_request('hostid'), 'period' => $this->data['period'], 'stime' => $this->data['stime']));
    $screenWidget->addItem($screenBuilder->show());
    CScreenBuilder::insertScreenStandardJs(array('timeline' => $screenBuilder->timeline, 'profileIdx' => $screenBuilder->profileIdx));
    $screenWidget->addItem(BR());
}
return $screenWidget;
        # update racktables object
        require_once 'racktablesapi.php';
        $response = updateObjectStatus($hostNames, $status);
        if (isset($response['error'])) {
            show_messages(false, '', "Updating racktables object is failed. Error message:" . $response['error']);
        }
        ################################################################
        show_messages($result, $messageSuccess, $messageFailed);
        clearCookies($result);
    }
}
/*
 * Display
 */
$hostsWidget = new CWidget();
$pageFilter = new CPageFilter(array('groups' => array('real_hosts' => true, 'editable' => true), 'groupid' => get_request('groupid', null)));
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = get_request('hostid', 0);
if ($_REQUEST['go'] == 'massupdate' && isset($_REQUEST['hosts'])) {
    $hostsWidget->addPageHeader(_('CONFIGURATION OF HOSTS'));
    $data = array('hosts' => get_request('hosts', array()), 'visible' => get_request('visible', array()), 'mass_replace_tpls' => get_request('mass_replace_tpls'), 'mass_clear_tpls' => get_request('mass_clear_tpls'), 'groups' => get_request('groups', array()), 'newgroup' => get_request('newgroup', ''), 'status' => get_request('status', HOST_STATUS_MONITORED), 'proxy_hostid' => get_request('proxy_hostid', ''), 'ipmi_authtype' => get_request('ipmi_authtype', -1), 'ipmi_privilege' => get_request('ipmi_privilege', 2), 'ipmi_username' => get_request('ipmi_username', ''), 'ipmi_password' => get_request('ipmi_password', ''), 'inventory_mode' => get_request('inventory_mode', HOST_INVENTORY_DISABLED), 'host_inventory' => get_request('host_inventory', array()), 'templates' => get_request('templates', array()));
    // sort templates
    natsort($data['templates']);
    // get groups
    $data['all_groups'] = API::HostGroup()->get(array('output' => API_OUTPUT_EXTEND, 'editable' => true));
    order_result($data['all_groups'], 'name');
    // get proxies
    $data['proxies'] = DBfetchArray(DBselect('SELECT h.hostid,h.host' . ' FROM hosts h' . ' WHERE h.status IN (' . HOST_STATUS_PROXY_ACTIVE . ',' . HOST_STATUS_PROXY_PASSIVE . ')' . andDbNode('h.hostid')));
    order_result($data['proxies'], 'host');
    // get inventories
    if ($data['inventory_mode'] != HOST_INVENTORY_DISABLED) {
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
$widget = (new CWidget())->setTitle(_('Screens'))->addItem((new CList())->addClass(ZBX_STYLE_OBJECT_GROUP)->addItem([(new CSpan())->addItem(new CLink(_('All screens'), 'screenconf.php')), '/', (new CSpan())->addClass(ZBX_STYLE_SELECTED)->addItem(new CLink($data['screen']['name'], 'screens.php?elementid=' . $data['screen']['screenid'] . '&fullscreen=' . $data['fullscreen']))]))->addItem((new CFilter('web.screens.filter.state'))->addNavigator());
$controls = (new CList())->addItem(new CComboBox('config', 'screens.php', 'redirect(this.options[this.selectedIndex].value);', ['screens.php' => _('Screens'), 'slides.php' => _('Slide shows')]));
// Append screens combobox to page header.
$form = (new CForm())->setName('headerForm')->addVar('fullscreen', $data['fullscreen']);
if (check_dynamic_items($data['screen']['screenid'], 0)) {
    $pageFilter = new CPageFilter(['groups' => ['monitored_hosts' => true, 'with_items' => true], 'hosts' => ['monitored_hosts' => true, 'with_items' => true, 'DDFirstLabel' => _('not selected')], 'hostid' => getRequest('hostid'), 'groupid' => getRequest('groupid')]);
    $_REQUEST['groupid'] = $pageFilter->groupid;
    $_REQUEST['hostid'] = $pageFilter->hostid;
    $controls->addItem([_('Group') . SPACE, $pageFilter->getGroupsCB()])->addItem([_('Host') . SPACE, $pageFilter->getHostsCB()]);
}
// page header
$controls->addItem($data['screen']['editable'] ? (new CButton('edit', _('Edit screen')))->onClick('redirect("screenedit.php?screenid=' . $data['screen']['screenid'] . '")') : null)->addItem(get_icon('favourite', ['fav' => 'web.favorite.screenids', 'elname' => 'screenid', 'elid' => $data['screen']['screenid']]))->addItem(get_icon('fullscreen', ['fullscreen' => $data['fullscreen']]));
$form->addItem($controls);
$widget->setControls($form);
// Append screens to widget.
$screenBuilder = new CScreenBuilder(['screenid' => $data['screen']['screenid'], 'mode' => SCREEN_MODE_PREVIEW, 'profileIdx' => 'web.screens', 'profileIdx2' => $data['screen']['screenid'], 'groupid' => getRequest('groupid'), 'hostid' => getRequest('hostid'), 'period' => $data['period'], 'stime' => $data['stime']]);
$widget->addItem((new CDiv($screenBuilder->show()))->addClass(ZBX_STYLE_TABLE_FORMS_CONTAINER));
CScreenBuilder::insertScreenStandardJs(['timeline' => $screenBuilder->timeline, 'profileIdx' => $screenBuilder->profileIdx]);
return $widget;
示例#8
0
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/hosts.inc.php';
require_once 'include/forms.inc.php';
$page['title'] = 'S_HOST_PROFILES';
$page['file'] = 'hostprofiles.php';
$page['hist_arg'] = array('groupid', 'hostid');
include_once 'include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'prof_type' => array(T_ZBX_INT, O_OPT, P_SYS, NULL, NULL));
check_fields($fields);
validate_sort_and_sortorder('host', ZBX_SORT_UP);
$options = array('groups' => array('real_hosts' => 1), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = get_request('hostid', 0);
// permission check, imo should be remuved in future.
if ($_REQUEST['hostid'] > 0) {
    $res = CHost::get(array('real_hosts' => 1, 'hostids' => $_REQUEST['hostid']));
    if (empty($res)) {
        access_deny();
    }
}
$_REQUEST['prof_type'] = get_request('prof_type', 0);
$hostprof_wdgt = new CWidget();
$profile_form = new CForm(null, 'get');
$cmbProf = new CComboBox('prof_type', $_REQUEST['prof_type'], 'javascript: submit();');
$cmbProf->additem(0, S_NORMAL);
$cmbProf->additem(1, S_EXTENDED);
示例#9
0
    $options['groups']['with_applications'] = true;
    $options['hosts']['with_applications'] = true;
} elseif ($withGraphs) {
    $options['groups']['with_graphs'] = true;
    $options['hosts']['with_graphs'] = true;
} elseif ($withSimpleGraphItems) {
    $options['groups']['with_simple_graph_items'] = true;
    $options['hosts']['with_simple_graph_items'] = true;
} elseif ($withTriggers) {
    $options['groups']['with_triggers'] = true;
    $options['hosts']['with_triggers'] = true;
} elseif ($withMonitoredTriggers) {
    $options['groups']['with_monitored_triggers'] = true;
    $options['hosts']['with_monitored_triggers'] = true;
}
$pageFilter = new CPageFilter($options);
// get groupid
$groupid = null;
if ($pageFilter->groupsSelected) {
    if ($pageFilter->groupid > 0) {
        $groupid = $pageFilter->groupid;
    }
} else {
    $groupid = 0;
}
// get hostid
$hostid = null;
if ($pageFilter->hostsSelected) {
    if ($pageFilter->hostid > 0) {
        $hostid = $pageFilter->hostid;
    }
示例#10
0
require_once 'include/reports.inc.php';
require_once 'include/zbxe_visual_imp.php';
$page['title'] = _zeT('Not Supported Items');
$page['file'] = 'zbxe-ns.php';
$page['hist_arg'] = array('groupid', 'hostid', 'graphid');
$page['scripts'] = array('class.calendar.js', 'scriptaculous.js?load=effects');
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
include_once 'include/page_header.php';
//		VAR				TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'applicationid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'itemid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'timeshiftsource' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'timeshiftprojection' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'agregation' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'num_projection' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, null), 'formato' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, null), 'report_timesince' => array(T_ZBX_STR, O_OPT, null, null, 'isset({filter})'), 'report_timetill' => array(T_ZBX_STR, O_OPT, null, null, 'isset({filter})'));
check_fields($fields);
// --------------------------- Filtro ---------------------------------------------------------------------
$options = array('groups' => array('monitored_hosts' => 1), 'hosts' => array('monitored_hosts' => 1), 'groupid' => get_request('groupid', null), 'hostid' => get_request('hostid', null));
$hostid = $_REQUEST['hostid'] = get_request('hostid', 0);
$groupid = $_REQUEST['groupid'] = get_request('groupid', 0);
$pageFilter = new CPageFilter($options);
$filter_table = new CTable('', 'filter_config');
$filter_table->setAttribute('border', 0);
$filter_table->setAttribute('width', '100%');
$cmbGroups = $pageFilter->getGroupsCB(true);
$cmbHosts = $pageFilter->getHostsCB(true);
$filter_table->addRow(array(array(bold(_('Group')), ': ', $cmbGroups), array(bold(_('Host')), ': ', $cmbHosts), array()));
$groupids = checkAccessGroup('groupid');
$hostids = checkAccessHost('hostid');
// --------------------------- Fim Filtro ---------------------------------------------------------------------
$options = array();
$options['templated_hosts'] = 1;
$hosts = API::Host()->get($options);
$filtroSegHosts = " hos.status <> 1 AND " . dbConditionInt('hos.hostid', zbx_objectValues($hosts, 'hostid'));
$rep2_wdgt = new CWidget();
$rep2_wdgt->addPageHeader(_zeT('Not Supported Items Report'));
示例#11
0
$options = array('config' => array('select_latest' => true), 'groups' => array('nodeids' => get_request('nodeid', get_current_nodeid(false))), 'hosts' => array('nodeids' => get_request('nodeid', get_current_nodeid(false))), 'groupid' => get_request('groupid', null), 'hostid' => get_request('hostid', null));
if ($monitored_hosts) {
    $options['groups']['monitored_hosts'] = true;
    $options['hosts']['monitored_hosts'] = true;
} else {
    if ($real_hosts) {
        $options['groups']['real_hosts'] = true;
    } else {
        $options['hosts']['templated_hosts'] = true;
    }
}
if (!is_null($writeonly)) {
    $options['groups']['editable'] = true;
    $options['hosts']['editable'] = true;
}
$pageFilter = new CPageFilter($options);
$nodeid = get_request('nodeid', get_current_nodeid(false));
$groupid = null;
if ($pageFilter->groupsSelected) {
    if ($pageFilter->groupid > 0) {
        $groupid = $pageFilter->groupid;
    }
} else {
    $groupid = 0;
}
$hostid = null;
if ($pageFilter->hostsSelected) {
    if ($pageFilter->hostid > 0) {
        $hostid = $pageFilter->hostid;
    }
} else {
示例#12
0
}
$from = zbxDateToTime($stime);
$till = $from + $period;
/*
 * Display
 */
if ($csvExport) {
    if (!hasRequest('hostid')) {
        $_REQUEST['hostid'] = 0;
    }
    if (!hasRequest('groupid')) {
        $_REQUEST['groupid'] = 0;
    }
} else {
    if ($source == EVENT_SOURCE_TRIGGERS) {
        $pageFilter = new CPageFilter(array('groups' => array('monitored_hosts' => true, 'with_monitored_triggers' => true), 'hosts' => array('monitored_hosts' => true, 'with_monitored_triggers' => true), 'hostid' => getRequest('hostid'), 'groupid' => getRequest('groupid')));
        // try to find matching trigger when host is changed
        // use the host ID from the page filter since it may not be present in the request
        // if all hosts are selected, preserve the selected trigger
        if ($triggerId != 0 && $pageFilter->hostid != 0) {
            $hostId = $pageFilter->hostid;
            $oldTriggers = API::Trigger()->get(array('output' => array('triggerid', 'description', 'expression'), 'selectHosts' => array('hostid', 'host'), 'selectItems' => array('itemid', 'hostid', 'key_', 'type', 'flags', 'status'), 'selectFunctions' => API_OUTPUT_EXTEND, 'triggerids' => $triggerId));
            $oldTrigger = reset($oldTriggers);
            $oldTrigger['hosts'] = zbx_toHash($oldTrigger['hosts'], 'hostid');
            // if the trigger doesn't belong to the selected host - find a new one on that host
            if (!isset($oldTrigger['hosts'][$hostId])) {
                $triggerId = 0;
                $oldTrigger['items'] = zbx_toHash($oldTrigger['items'], 'itemid');
                $oldTrigger['functions'] = zbx_toHash($oldTrigger['functions'], 'functionid');
                $oldExpression = triggerExpression($oldTrigger);
                $newTriggers = API::Trigger()->get(array('output' => array('triggerid', 'description', 'expression'), 'selectHosts' => array('hostid', 'host'), 'selectItems' => array('itemid', 'key_'), 'selectFunctions' => API_OUTPUT_EXTEND, 'filter' => array('description' => $oldTrigger['description']), 'hostids' => $hostId));
示例#13
0
        $result = API::Template()->massUpdate(['templates' => zbx_toObject($templates, 'templateid'), 'hosts' => []]);
    }
    if ($result) {
        $result = API::Template()->delete($templates);
    }
    $result = DBend($result);
    if ($result) {
        uncheckTableRows();
    }
    show_messages($result, _('Template deleted'), _('Cannot delete template'));
}
/*
 * Display
 */
$templateWidget = (new CWidget())->setTitle(_('Templates'));
$pageFilter = new CPageFilter(['config' => ['individual' => 1], 'groups' => ['templated_hosts' => true, 'editable' => true], 'groupid' => getRequest('groupid')]);
$_REQUEST['groupid'] = $pageFilter->groupid;
if (hasRequest('form')) {
    if ($templateId = getRequest('templateid', 0)) {
        $templateWidget->addItem(get_header_host_table('', $templateId));
    }
    $data = ['form' => getRequest('form'), 'groupId' => getRequest('groupid', 0), 'groupIds' => getRequest('groups', []), 'show_inherited_macros' => getRequest('show_inherited_macros', 0)];
    if ($templateId) {
        $dbTemplates = API::Template()->get(['templateids' => $templateId, 'selectGroups' => API_OUTPUT_EXTEND, 'selectParentTemplates' => ['templateid', 'name'], 'selectMacros' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND]);
        $data['dbTemplate'] = reset($dbTemplates);
        $data['original_templates'] = [];
        foreach ($data['dbTemplate']['parentTemplates'] as $parentTemplate) {
            $data['original_templates'][$parentTemplate['templateid']] = $parentTemplate['templateid'];
        }
    } else {
        $data['original_templates'] = [];
示例#14
0
    }
}
if ($_REQUEST['go'] != 'none' && isset($go_result) && $go_result) {
    $url = new CUrl();
    $path = $url->getPath();
    insert_js('cookie.eraseArray("' . $path . '")');
}
$frmForm = new CForm();
if (!isset($_REQUEST['form'])) {
    $frmForm->addItem(new CButton('form', S_CREATE_HOST));
    $frmForm->addItem(new CButton('form', S_IMPORT_HOST));
}
$hosts_wdgt = new CWidget();
$hosts_wdgt->addPageHeader(S_CONFIGURATION_OF_HOSTS, $frmForm);
$options = array('groups' => array('real_hosts' => 1, 'editable' => 1), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = get_request('hostid', 0);
// echo SBR;
if ($_REQUEST['go'] == 'massupdate' && isset($_REQUEST['hosts'])) {
    $hosts_wdgt->addItem(insert_mass_update_host_form());
} else {
    if (isset($_REQUEST['form'])) {
        if ($_REQUEST['form'] == S_IMPORT_HOST) {
            $hosts_wdgt->addItem(import_host_form());
        } else {
            $hosts_wdgt->addItem(insert_host_form());
        }
    } else {
        $frmForm = new CForm();
        $frmForm->setMethod('get');
示例#15
0
    $options['groups']['with_applications'] = true;
    $options['hosts']['with_applications'] = true;
} elseif ($withGraphs) {
    $options['groups']['with_graphs'] = true;
    $options['hosts']['with_graphs'] = true;
} elseif ($withSimpleGraphItems) {
    $options['groups']['with_simple_graph_items'] = true;
    $options['hosts']['with_simple_graph_items'] = true;
} elseif ($withTriggers) {
    $options['groups']['with_triggers'] = true;
    $options['hosts']['with_triggers'] = true;
} elseif ($withMonitoredTriggers) {
    $options['groups']['with_monitored_triggers'] = true;
    $options['hosts']['with_monitored_triggers'] = true;
}
$pageFilter = new CPageFilter($options);
// get groupid
$groupid = null;
if ($pageFilter->groupsSelected) {
    if ($pageFilter->groupid > 0) {
        $groupid = $pageFilter->groupid;
    }
} else {
    $groupid = 0;
}
// get hostid
$hostid = null;
if ($pageFilter->hostsSelected) {
    if ($pageFilter->hostid > 0) {
        $hostid = $pageFilter->hostid;
    }