Exemplo n.º 1
0
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/graphs.inc.php';
require_once dirname(__FILE__) . '/include/screens.inc.php';
require_once dirname(__FILE__) . '/include/blocks.inc.php';
$page['title'] = _('Custom slides');
$page['file'] = 'slides.php';
$page['scripts'] = ['class.pmaster.js', 'class.calendar.js', 'gtlc.js', 'flickerfreescreen.js'];
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
define('ZBX_PAGE_DO_JS_REFRESH', 1);
ob_start();
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = ['groupid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null], 'hostid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null], 'elementid' => [T_ZBX_INT, O_OPT, P_SYS | P_NZERO, DB_ID, null], 'step' => [T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 65535), null], 'period' => [T_ZBX_INT, O_OPT, P_SYS, null, null], 'stime' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'reset' => [T_ZBX_STR, O_OPT, P_SYS, IN('"reset"'), null], 'fullscreen' => [T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null], 'widgetRefresh' => [T_ZBX_STR, O_OPT, null, null, null], 'widgetRefreshRate' => [T_ZBX_STR, O_OPT, P_ACT, null, null], 'favobj' => [T_ZBX_STR, O_OPT, P_ACT, null, null], 'favid' => [T_ZBX_INT, O_OPT, P_ACT, null, null], 'upd_counter' => [T_ZBX_INT, O_OPT, P_ACT, null, null]];
check_fields($fields);
/*
 * Permissions
 */
$data = [];
if (getRequest('groupid') && !API::HostGroup()->isReadable([getRequest('groupid')]) || getRequest('hostid') && !API::Host()->isReadable([getRequest('hostid')])) {
    access_deny();
}
if (hasRequest('elementid')) {
    $data['screen'] = get_slideshow_by_slideshowid(getRequest('elementid'), PERM_READ);
    if (!$data['screen']) {
        access_deny();
    }
} else {
    $data['screen'] = [];
Exemplo n.º 2
0
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/maps.inc.php';
$page['title'] = _('Logo');
$page['file'] = 'zbxe-customer-logo.php';
$page['type'] = detect_page_type(PAGE_TYPE_IMAGE);
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION		EXCEPTION
$fields = array('sysmapid' => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null), 'selements' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, null), 'links' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, null), 'noselements' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'nolinks' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'nocalculations' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'expand_macros' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'show_triggers' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1,2,3'), null), 'severity_min' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2,3,4,5'), null), 'grid' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 500), null), 'base64image' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null));
check_fields($fields);
$maps = API::Map()->get(array('sysmapids' => $_REQUEST['sysmapid'], 'selectSelements' => API_OUTPUT_EXTEND, 'selectLinks' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND, 'preservekeys' => true));
$map = reset($maps);
if (empty($map)) {
    access_deny();
}
$mapPainter = new CMapPainter($map, array('map' => array('drawAreas' => !isset($_REQUEST['selements']) && !isset($_REQUEST['noselements'])), 'grid' => array('size' => get_request('grid', 0))));
$im = $mapPainter->paint();
$colors['Red'] = imagecolorallocate($im, 255, 0, 0);
$colors['Dark Red'] = imagecolorallocate($im, 150, 0, 0);
$colors['Green'] = imagecolorallocate($im, 0, 255, 0);
$colors['Dark Green'] = imagecolorallocate($im, 0, 150, 0);
$colors['Blue'] = imagecolorallocate($im, 0, 0, 255);
$colors['Dark Blue'] = imagecolorallocate($im, 0, 0, 150);
$colors['Yellow'] = imagecolorallocate($im, 255, 255, 0);
Exemplo n.º 3
0
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/graphs.inc.php';
$page['file'] = 'chart3.php';
$page['type'] = PAGE_TYPE_IMAGE;
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('period' => array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD, ZBX_MAX_PERIOD), null), 'stime' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'httptestid' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'http_item_type' => array(T_ZBX_INT, O_OPT, null, null, null), 'name' => array(T_ZBX_STR, O_OPT, null, null, null), 'width' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null), 'height' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null), 'ymin_type' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), null), 'ymax_type' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), null), 'ymin_itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'ymax_itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'legend' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'showworkperiod' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'showtriggers' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'graphtype' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'yaxismin' => array(T_ZBX_DBL, O_OPT, null, null, null), 'yaxismax' => array(T_ZBX_DBL, O_OPT, null, null, null), 'percent_left' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(0, 100), null), 'percent_right' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(0, 100), null), 'items' => array(T_ZBX_STR, O_OPT, null, null, null));
$isDataValid = check_fields($fields);
if ($httptestid = get_request('httptestid', false)) {
    $color = array('current' => 0, 0 => array('next' => '1'), 1 => array('color' => 'Red', 'next' => '2'), 2 => array('color' => 'Dark Green', 'next' => '3'), 3 => array('color' => 'Blue', 'next' => '4'), 4 => array('color' => 'Dark Yellow', 'next' => '5'), 5 => array('color' => 'Cyan', 'next' => '6'), 6 => array('color' => 'Gray', 'next' => '7'), 7 => array('color' => 'Dark Red', 'next' => '8'), 8 => array('color' => 'Green', 'next' => '9'), 9 => array('color' => 'Dark Blue', 'next' => '10'), 10 => array('color' => 'Yellow', 'next' => '11'), 11 => array('color' => 'Black', 'next' => '1'));
    $items = array();
    $dbItems = DBselect('SELECT i.itemid' . ' FROM httpstepitem hi,items i,httpstep hs' . ' WHERE i.itemid=hi.itemid' . ' AND hs.httptestid=' . $httptestid . ' AND hs.httpstepid=hi.httpstepid' . ' AND hi.type=' . get_request('http_item_type', HTTPSTEP_ITEM_TYPE_TIME) . ' ORDER BY hs.no DESC');
    while ($item = DBfetch($dbItems)) {
        $itemColor = $color[$color['current'] = $color[$color['current']]['next']]['color'];
        $items[] = array('itemid' => $item['itemid'], 'color' => $itemColor);
    }
    $httptest = get_httptest_by_httptestid($httptestid);
    $name = $httptest['name'];
} else {
    $items = get_request('items', array());
    asort_by_key($items, 'sortorder');
    $dbItems = API::Item()->get(array('webitems' => true, 'itemids' => zbx_objectValues($items, 'itemid'), 'nodeids' => get_current_nodeid(true), 'output' => API_OUTPUT_SHORTEN, 'preservekeys' => true, 'filter' => array('flags' => null)));
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/audit.inc.php';
require_once dirname(__FILE__) . '/include/actions.inc.php';
require_once dirname(__FILE__) . '/include/users.inc.php';
$page['title'] = _('Audit logs');
$page['file'] = 'auditlogs.php';
$page['hist_arg'] = array();
$page['scripts'] = array('class.calendar.js', 'gtlc.js');
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
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 | P_NZERO, DB_ID, null), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS | P_NZERO, DB_ID, null), 'action' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(-1, 6), null), 'resourcetype' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(-1, 31), null), 'filter_rst' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null), 'filter_set' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'alias' => array(T_ZBX_STR, O_OPT, P_SYS, null, 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), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, null, null), 'favref' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})&&("filter"=={favobj})'), 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})&&("filter"=={favobj})'), 'favid' => array(T_ZBX_INT, O_OPT, P_ACT, null, null));
check_fields($fields);
/*
 * Ajax
 */
if (isset($_REQUEST['favobj'])) {
    if ($_REQUEST['favobj'] == 'filter') {
        CProfile::update('web.auditlogs.filter.state', $_REQUEST['favstate'], PROFILE_TYPE_INT);
    }
    // saving fixed/dynamic setting to profile
    if ($_REQUEST['favobj'] == 'timelinefixedperiod') {
        if (isset($_REQUEST['favid'])) {
            CProfile::update('web.auditlogs.timelinefixed', $_REQUEST['favid'], PROFILE_TYPE_INT);
        }
    }
}
Exemplo n.º 5
0
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/graphs.inc.php';
$page['file'] = 'chart7.php';
$page['title'] = "S_CHART";
$page['type'] = PAGE_TYPE_IMAGE;
include_once 'include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('period' => array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD, ZBX_MAX_PERIOD), null), 'from' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'stime' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'border' => array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null), 'name' => array(T_ZBX_STR, O_OPT, NULL, null, null), 'width' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 65535), null), 'height' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 65535), null), 'graphtype' => array(T_ZBX_INT, O_OPT, NULL, IN('2,3'), null), 'graph3d' => array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null), 'legend' => array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null), 'items' => array(T_ZBX_STR, O_OPT, NULL, null, null));
check_fields($fields);
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY, get_current_nodeid(true));
$items = get_request('items', array());
asort_by_key($items, 'sortorder');
foreach ($items as $gitem) {
    if (!($host = DBfetch(DBselect('SELECT h.* FROM hosts h,items i WHERE h.hostid=i.hostid AND i.itemid=' . $gitem['itemid'])))) {
        fatal_error(S_NO_ITEM_DEFINED);
    }
    if (!isset($available_hosts[$host['hostid']])) {
        access_deny();
    }
}
$effectiveperiod = navigation_bar_calc();
if (count($items) == 1) {
    $_REQUEST['period'] = get_request('period', get_profile('web.item.graph.period', ZBX_PERIOD_DEFAULT, null, $items['itemid']));
** (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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['title'] = _('Configuration of trigger displaying options');
$page['file'] = 'adm.triggerdisplayoptions.php';
require_once dirname(__FILE__) . '/include/page_header.php';
$fields = ['problem_unack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Unacknowledged PROBLEM events')], 'problem_ack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Acknowledged PROBLEM events')], 'ok_unack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Unacknowledged OK events')], 'ok_ack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Acknowledged OK events')], 'problem_unack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'problem_ack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'ok_unack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'ok_ack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'ok_period' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 999999), 'isset({update})', _('Display OK triggers for')], 'blink_period' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 999999), 'isset({update})', _('On status change triggers blink for')], 'update' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null]];
check_fields($fields);
/*
 * Actions
 */
if (hasRequest('update')) {
    DBstart();
    $result = update_config(['problem_unack_color' => getRequest('problem_unack_color'), 'problem_ack_color' => getRequest('problem_ack_color'), 'ok_unack_color' => getRequest('ok_unack_color'), 'ok_ack_color' => getRequest('ok_ack_color'), 'problem_unack_style' => getRequest('problem_unack_style', 0), 'problem_ack_style' => getRequest('problem_ack_style', 0), 'ok_unack_style' => getRequest('ok_unack_style', 0), 'ok_ack_style' => getRequest('ok_ack_style', 0), 'ok_period' => getRequest('ok_period'), 'blink_period' => getRequest('blink_period')]);
    $result = DBend($result);
    show_messages($result, _('Configuration updated'), _('Cannot update configuration'));
}
/*
 * Display
 */
$config = select_config();
// form has been submitted
Exemplo n.º 7
0
**
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['file'] = 'chart.php';
$page['type'] = PAGE_TYPE_IMAGE;
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('itemid' => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null), 'screenid' => array(T_ZBX_STR, O_OPT, null, null, null), 'period' => array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD, ZBX_MAX_PERIOD), null), 'stime' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'profileIdx' => array(T_ZBX_STR, O_OPT, null, null, null), 'profileIdx2' => array(T_ZBX_STR, O_OPT, null, null, null), 'updateProfile' => array(T_ZBX_STR, O_OPT, null, null, null), 'from' => array(T_ZBX_INT, O_OPT, null, '{}>=0', null), 'width' => array(T_ZBX_INT, O_OPT, null, '{}>0', null), 'height' => array(T_ZBX_INT, O_OPT, null, '{}>0', null), 'border' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null));
check_fields($fields);
/*
 * Permissions
 */
if (!DBfetch(DBselect('SELECT i.itemid FROM items i WHERE i.itemid=' . $_REQUEST['itemid']))) {
    show_error_message(_('No items defined.'));
}
$dbItems = API::Item()->get(array('itemids' => $_REQUEST['itemid'], 'webitems' => true, 'nodeids' => get_current_nodeid(true), 'filter' => array('flags' => null)));
if (empty($dbItems)) {
    access_deny();
}
/*
 * Display
 */
$timeline = CScreenBase::calculateTime(array('profileIdx' => get_request('profileIdx', 'web.screens'), 'profileIdx2' => get_request('profileIdx2'), 'updateProfile' => get_request('updateProfile', true), 'period' => get_request('period'), 'stime' => get_request('stime')));
Exemplo n.º 8
0
require_once 'include/forms.inc.php';
$page['title'] = 'S_MAINTENANCE';
$page['file'] = 'maintenance.php';
$page['hist_arg'] = array('groupid', 'hostid');
$page['scripts'] = array('menu_scripts.js', 'calendar.js');
include_once 'include/page_header.php';
$available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_WRITE);
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_WRITE);
if (isset($_REQUEST['groupid']) && $_REQUEST['groupid'] > 0 && !isset($available_groups[$_REQUEST['groupid']])) {
    access_deny();
}
if (isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0 && !isset($available_hosts[$_REQUEST['hostid']])) {
    access_deny();
}
//		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), 'hostids' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'groupids' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'maintenanceid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form})&&({form}=="update")'), 'maintenanceids' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'mname' => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({save})'), 'maintenance_type' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'description' => array(T_ZBX_STR, O_OPT, NULL, null, 'isset({save})'), 'active_since' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, time() * 2), 'isset({save})'), 'active_till' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, time() * 2), 'isset({save})'), 'new_timeperiod' => array(T_ZBX_STR, O_OPT, null, null, 'isset({add_timeperiod})'), 'timeperiods' => array(T_ZBX_STR, O_OPT, null, null, null), 'g_timeperiodid' => array(null, O_OPT, null, null, null), 'edit_timeperiodid' => array(null, O_OPT, P_ACT, DB_ID, null), 'go' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'add_timeperiod' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'del_timeperiod' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'cancel_new_timeperiod' => 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), 'delete' => 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));
check_fields($fields);
validate_sort_and_sortorder('h.host', ZBX_SORT_UP);
$_REQUEST['go'] = get_request('go', 'none');
/************ MAINTENANCE ****************/
if (inarr_isset(array('clone', 'maintenanceid'))) {
    unset($_REQUEST['maintenanceid']);
    $_REQUEST['form'] = 'clone';
} else {
    if (isset($_REQUEST['cancel_new_timeperiod'])) {
        unset($_REQUEST['new_timeperiod']);
    } else {
        if (isset($_REQUEST['save'])) {
            if (!count(get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY))) {
                access_deny();
            }
Exemplo n.º 9
0
**
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/triggers.inc.php';
require_once 'include/js.inc.php';
$dstfrm = get_request('dstfrm', 0);
// destination form
$page['title'] = "S_GRAPH_ITEM";
$page['file'] = 'popup_bitem.php';
define('ZBX_PAGE_NO_MENU', 1);
include_once 'include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('dstfrm' => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null), 'config' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1,2,3'), NULL), 'gid' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 65535), null), 'list_name' => array(T_ZBX_STR, O_OPT, P_SYS, NOT_EMPTY, 'isset({save})&&isset({gid})'), 'caption' => array(T_ZBX_STR, O_OPT, null, null, null), 'itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID . '({}!=0)', 'isset({save})'), 'color' => array(T_ZBX_CLR, O_OPT, null, null, 'isset({save})'), 'calc_fnc' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2,4,7,9'), 'isset({save})'), 'axisside' => array(T_ZBX_INT, O_OPT, null, IN(GRAPH_YAXIS_SIDE_LEFT . ',' . GRAPH_YAXIS_SIDE_RIGHT), null), 'add' => 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), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_STR, O_OPT, null, null, null));
check_fields($fields);
$_REQUEST['caption'] = get_request('caption', '');
$_REQUEST['axisside'] = get_request('axisside', GRAPH_YAXIS_SIDE_LEFT);
if (zbx_empty($_REQUEST['caption']) && isset($_REQUEST['itemid']) && $_REQUEST['itemid'] > 0) {
    $_REQUEST['caption'] = item_description(get_item_by_itemid($_REQUEST['itemid']));
}
insert_js_function('add_bitem');
insert_js_function('update_bitem');
if (isset($_REQUEST['save']) && !isset($_REQUEST['gid'])) {
    insert_js("add_bitem('" . $_REQUEST['dstfrm'] . "'," . zbx_jsvalue($_REQUEST['caption']) . ",'" . $_REQUEST['itemid'] . "','" . $_REQUEST['color'] . "'," . $_REQUEST['calc_fnc'] . "," . $_REQUEST['axisside'] . ");\n");
}
if (isset($_REQUEST['save']) && isset($_REQUEST['gid'])) {
    insert_js("update_bitem('" . $_REQUEST['dstfrm'] . "','" . $_REQUEST['list_name'] . "','" . $_REQUEST['gid'] . "'," . zbx_jsvalue($_REQUEST['caption']) . ",'" . $_REQUEST['itemid'] . "','" . $_REQUEST['color'] . "'," . $_REQUEST['calc_fnc'] . "," . $_REQUEST['axisside'] . ");\n");
} else {
    echo SBR;
Exemplo n.º 10
0
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['title'] = _('Configuration of housekeeping');
$page['file'] = 'adm.housekeeper.php';
$page['hist_arg'] = array();
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('hk_events_mode' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'hk_events_trigger' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(1, 99999), null, _('Trigger event and alert data storage period')), 'hk_events_internal' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(1, 99999), null, _('Internal event and alert data storage period')), 'hk_events_discovery' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(1, 99999), null, _('Network discovery event and alert data storage period')), 'hk_events_autoreg' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(1, 99999), null, _('Auto-registration event and alert data storage period')), 'hk_services_mode' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'hk_services' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(1, 99999), null, _('IT service data storage period')), 'hk_audit_mode' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'hk_audit' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(1, 99999), null, _('Audit data storage period')), 'hk_sessions_mode' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'hk_sessions' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(1, 99999), null, _('User session data storage period')), 'hk_history_mode' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'hk_history_global' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'hk_history' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(0, 99999), null, _('History data storage period')), 'hk_trends_mode' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'hk_trends_global' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'hk_trends' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(0, 99999), null, _('Trend data storage period')), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null));
check_fields($fields);
$data['config'] = select_config();
/*
 * Actions
 */
if (isset($_REQUEST['save'])) {
    DBstart();
    $configs = array('hk_events_mode' => getRequest('hk_events_mode', 0), 'hk_events_trigger' => getRequest('hk_events_trigger'), 'hk_events_internal' => getRequest('hk_events_internal'), 'hk_events_discovery' => getRequest('hk_events_discovery'), 'hk_events_autoreg' => getRequest('hk_events_autoreg'), 'hk_services_mode' => getRequest('hk_services_mode', 0), 'hk_services' => getRequest('hk_services'), 'hk_audit_mode' => getRequest('hk_audit_mode', 0), 'hk_audit' => getRequest('hk_audit'), 'hk_sessions_mode' => getRequest('hk_sessions_mode', 0), 'hk_sessions' => getRequest('hk_sessions'), 'hk_history_mode' => getRequest('hk_history_mode', 0), 'hk_history_global' => getRequest('hk_history_global', 0), 'hk_history' => getRequest('hk_history'), 'hk_trends_mode' => getRequest('hk_trends_mode', 0), 'hk_trends_global' => getRequest('hk_trends_global', 0), 'hk_trends' => getRequest('hk_trends'));
    $result = update_config($configs);
    show_messages($result, _('Configuration updated'), _('Cannot update configuration'));
    if ($result) {
        $msg = array();
        $msg[] = _s('Trigger event and alert data storage period (in days) "%1$s".', getRequest('hk_events_trigger'));
        $msg[] = _s('Internal event and alert data storage period (in days) "%1$s".', getRequest('hk_events_internal'));
        $msg[] = _s('Network discovery event and alert data storage period (in days) "%1$s".', getRequest('hk_events_discovery'));
Exemplo n.º 11
0
** (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., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
define('ZBX_PAGE_NO_AUTHERIZATION', 1);
require_once "include/config.inc.php";
$page['file'] = 'vtext.php';
$page['type'] = PAGE_TYPE_IMAGE;
include_once "include/page_header.php";
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array("text" => array(T_ZBX_STR, O_OPT, P_SYS, null, null), "font" => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 5), null));
check_fields($fields);
$text = get_request("text", ' ');
$font = get_request("font", 3);
$width = ImageFontWidth($font) * strlen($text);
$height = ImageFontHeight($font);
$im = imagecreate($height, $width);
$backgroud_color = ImageColorAllocate($im, 255, 255, 255);
$text_color = ImageColorAllocate($im, 0, 0, 0);
ImageStringUp($im, $font, 0, $width - 1, $text, $text_color);
imagecolortransparent($im, $backgroud_color);
ImageOut($im);
ImageDestroy($im);
include_once "include/page_footer.php";
Exemplo n.º 12
0
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/items.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('Configuration of discovery rules');
$page['file'] = 'host_discovery.php';
$page['scripts'] = ['class.cviewswitcher.js', 'items.js'];
require_once dirname(__FILE__) . '/include/page_header.php';
$paramsFieldName = getParamFieldNameByType(getRequest('type', 0));
// supported eval types
$evalTypes = [CONDITION_EVAL_TYPE_AND_OR, CONDITION_EVAL_TYPE_AND, CONDITION_EVAL_TYPE_OR, CONDITION_EVAL_TYPE_EXPRESSION];
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = ['hostid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, '!isset({form})'], 'itemid' => [T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form}) && ({form} == "update"))'], 'interfaceid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null, _('Interface')], 'name' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Name')], 'description' => [T_ZBX_STR, O_OPT, null, null, 'isset({add}) || isset({update})'], 'key' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Key')], 'delay' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, SEC_PER_DAY), '(isset({add}) || isset({update})) && isset({type}) && {type} != ' . ITEM_TYPE_TRAPPER . ' && {type} != ' . ITEM_TYPE_SNMPTRAP, _('Update interval (in sec)')], 'delay_flex' => [T_ZBX_STR, O_OPT, null, null, null], 'status' => [T_ZBX_INT, O_OPT, null, IN(ITEM_STATUS_ACTIVE), null], 'type' => [T_ZBX_INT, O_OPT, null, IN([-1, ITEM_TYPE_ZABBIX, ITEM_TYPE_SNMPV1, ITEM_TYPE_TRAPPER, ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV2C, ITEM_TYPE_INTERNAL, ITEM_TYPE_SNMPV3, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_EXTERNAL, ITEM_TYPE_DB_MONITOR, ITEM_TYPE_IPMI, ITEM_TYPE_SSH, ITEM_TYPE_TELNET, ITEM_TYPE_JMX]), 'isset({add}) || isset({update})'], 'authtype' => [T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHTYPE_PASSWORD . ',' . ITEM_AUTHTYPE_PUBLICKEY), '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_SSH], 'username' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_TELNET, 'type'), _('User name')], 'password' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_TELNET, 'type')], 'publickey' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_SSH . ' && {authtype} == ' . ITEM_AUTHTYPE_PUBLICKEY], 'privatekey' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_SSH . ' && {authtype} == ' . ITEM_AUTHTYPE_PUBLICKEY], $paramsFieldName => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_DB_MONITOR . ',' . ITEM_TYPE_TELNET . ',' . ITEM_TYPE_CALCULATED, 'type'), getParamFieldLabelByType(getRequest('type', 0))], 'snmp_community' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C, 'type'), _('SNMP community')], 'snmp_oid' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C . ',' . ITEM_TYPE_SNMPV3, 'type'), _('SNMP OID')], 'port' => [T_ZBX_STR, O_OPT, null, BETWEEN(0, 65535), '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C . ',' . ITEM_TYPE_SNMPV3, 'type'), _('Port')], 'snmpv3_contextname' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_SNMPV3], 'snmpv3_securitylevel' => [T_ZBX_INT, O_OPT, null, IN('0,1,2'), '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_SNMPV3], 'snmpv3_securityname' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_SNMPV3], 'snmpv3_authprotocol' => [T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHPROTOCOL_MD5 . ',' . ITEM_AUTHPROTOCOL_SHA), '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_SNMPV3 . ' && ({snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . ' || {snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV . ')'], 'snmpv3_authpassphrase' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_SNMPV3 . ' && ({snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . ' || {snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV . ')'], 'snmpv3_privprotocol' => [T_ZBX_INT, O_OPT, null, IN(ITEM_PRIVPROTOCOL_DES . ',' . ITEM_PRIVPROTOCOL_AES), '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_SNMPV3 . ' && {snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV], 'snmpv3_privpassphrase' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_SNMPV3 . ' && {snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV], 'ipmi_sensor' => [T_ZBX_STR, O_OPT, P_NO_TRIM, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type}) && {type} == ' . ITEM_TYPE_IPMI, _('IPMI sensor')], 'trapper_hosts' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && {type} == 2'], 'lifetime' => [T_ZBX_STR, O_OPT, null, null, 'isset({add}) || isset({update})'], 'evaltype' => [T_ZBX_INT, O_OPT, null, IN($evalTypes), 'isset({add}) || isset({update})'], 'formula' => [T_ZBX_STR, O_OPT, null, null, 'isset({add}) || isset({update})'], 'conditions' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'action' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, IN('"discoveryrule.massdelete","discoveryrule.massdisable","discoveryrule.massenable"'), null], 'g_hostdruleid' => [T_ZBX_INT, O_OPT, null, DB_ID, null], 'add' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'update' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'clone' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'delete' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'cancel' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'form' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null], 'sort' => [T_ZBX_STR, O_OPT, P_SYS, IN('"delay","key_","name","status","type"'), null], 'sortorder' => [T_ZBX_STR, O_OPT, P_SYS, IN('"' . ZBX_SORT_DOWN . '","' . ZBX_SORT_UP . '"'), null]];
check_fields($fields);
$_REQUEST['params'] = getRequest($paramsFieldName, '');
unset($_REQUEST[$paramsFieldName]);
/*
 * Permissions
 */
if (getRequest('itemid', false)) {
    $item = API::DiscoveryRule()->get(['itemids' => $_REQUEST['itemid'], 'output' => API_OUTPUT_EXTEND, 'selectHosts' => ['status', 'flags'], 'selectFilter' => ['formula', 'evaltype', 'conditions'], 'editable' => true]);
    $item = reset($item);
    if (!$item) {
        access_deny();
    }
    $_REQUEST['hostid'] = $item['hostid'];
    $host = reset($item['hosts']);
} else {
Exemplo n.º 13
0
**
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
require_once dirname(__FILE__) . '/include/actions.inc.php';
require_once dirname(__FILE__) . '/include/triggers.inc.php';
$page['title'] = _('Configuration of actions');
$page['file'] = 'actionconf.php';
$page['scripts'] = array('multiselect.js');
$page['hist_arg'] = array();
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('actionid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form})&&{form}=="update"'), 'name' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Name')), 'eventsource' => array(T_ZBX_INT, O_OPT, null, IN(array(EVENT_SOURCE_TRIGGERS, EVENT_SOURCE_DISCOVERY, EVENT_SOURCE_AUTO_REGISTRATION, EVENT_SOURCE_INTERNAL)), null), 'evaltype' => array(T_ZBX_INT, O_OPT, null, IN(array(ACTION_EVAL_TYPE_AND_OR, ACTION_EVAL_TYPE_AND, ACTION_EVAL_TYPE_OR)), 'isset({save})'), 'esc_period' => array(T_ZBX_INT, O_OPT, null, BETWEEN(60, 999999), null, _('Default operation step duration')), 'status' => array(T_ZBX_INT, O_OPT, null, IN(array(ACTION_STATUS_ENABLED, ACTION_STATUS_DISABLED)), null), 'def_shortdata' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'def_longdata' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'recovery_msg' => array(T_ZBX_INT, O_OPT, null, null, null), 'r_shortdata' => array(T_ZBX_STR, O_OPT, null, null, 'isset({recovery_msg})&&isset({save})', _('Recovery subject')), 'r_longdata' => array(T_ZBX_STR, O_OPT, null, null, 'isset({recovery_msg})&&isset({save})', _('Recovery message')), 'g_actionid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'conditions' => array(null, O_OPT, null, null, null), 'new_condition' => array(null, O_OPT, null, null, 'isset({add_condition})'), 'operations' => array(null, O_OPT, null, null, 'isset({save})'), 'edit_operationid' => array(T_ZBX_STR, O_OPT, P_ACT, null, null), 'new_operation' => array(null, O_OPT, null, null, 'isset({add_operation})'), 'opconditions' => array(null, O_OPT, null, null, null), 'new_opcondition' => array(null, O_OPT, null, null, 'isset({add_opcondition})'), 'go' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'add_condition' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'cancel_new_condition' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'add_operation' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'cancel_new_operation' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'add_opcondition' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'cancel_new_opcondition' => 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), 'delete' => 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_INT, 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})'), 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})&&"filter"=={favobj}'));
$dataValid = check_fields($fields);
if ($dataValid && hasRequest('eventsource') && !hasRequest('form')) {
    CProfile::update('web.actionconf.eventsource', getRequest('eventsource'), PROFILE_TYPE_INT);
}
validate_sort_and_sortorder('name', ZBX_SORT_UP);
$_REQUEST['go'] = getRequest('go', 'none');
/*
 * Ajax
 */
if (isset($_REQUEST['favobj'])) {
    if ($_REQUEST['favobj'] == 'filter') {
        CProfile::update('web.audit.filter.state', $_REQUEST['favstate'], PROFILE_TYPE_INT);
    }
}
if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) {
Exemplo n.º 14
0
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['title'] = _('Other configuration parameters');
$page['file'] = 'adm.other.php';
$page['hist_arg'] = array();
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('refresh_unsupported' => array(T_ZBX_INT, O_NO, null, BETWEEN(0, 65535), 'isset({update})', _('Refresh unsupported items (in sec)')), 'alert_usrgrpid' => array(T_ZBX_INT, O_NO, null, DB_ID, 'isset({update})'), 'discovery_groupid' => array(T_ZBX_INT, O_NO, null, DB_ID, 'isset({update})'), 'snmptrap_logging' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'update' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null));
check_fields($fields);
/*
 * Actions
 */
if (hasRequest('update')) {
    DBstart();
    $orig_config = select_config(false);
    $configs = array('refresh_unsupported' => getRequest('refresh_unsupported'), 'alert_usrgrpid' => getRequest('alert_usrgrpid'), 'discovery_groupid' => getRequest('discovery_groupid'), 'snmptrap_logging' => getRequest('snmptrap_logging') ? 1 : 0);
    $result = update_config($configs);
    if ($result) {
        $audit = array(_s('Refresh unsupported items (in sec) "%1$s".', getRequest('refresh_unsupported')));
        if (hasRequest('discovery_groupid')) {
            $hostGroup = API::HostGroup()->get(array('groupids' => getRequest('discovery_groupid'), 'editable' => true, 'output' => array('groupid', 'name')));
            if ($hostGroup) {
                $hostGroup = reset($hostGroup);
Exemplo n.º 15
0
**
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/items.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('Configuration of item prototypes');
$page['file'] = 'disc_prototypes.php';
$page['scripts'] = ['effects.js', 'class.cviewswitcher.js', 'items.js'];
require_once dirname(__FILE__) . '/include/page_header.php';
$paramsFieldName = getParamFieldNameByType(getRequest('type', 0));
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = ['parent_discoveryid' => [T_ZBX_INT, O_MAND, P_SYS, DB_ID, null], 'itemid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, '(isset({form}) && ({form} == "update"))'], 'interfaceid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null, _('Interface')], 'name' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Name')], 'description' => [T_ZBX_STR, O_OPT, null, null, 'isset({add}) || isset({update})'], 'key' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Key')], 'delay' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, SEC_PER_DAY), '(isset({add}) || isset({update}))' . ' && (isset({type}) && ({type} != ' . ITEM_TYPE_TRAPPER . ' && {type} != ' . ITEM_TYPE_SNMPTRAP . '))', _('Update interval (in sec)')], 'delay_flex' => [T_ZBX_STR, O_OPT, null, null, null], 'status' => [T_ZBX_INT, O_OPT, null, IN(ITEM_STATUS_ACTIVE), null], 'type' => [T_ZBX_INT, O_OPT, null, IN([-1, ITEM_TYPE_ZABBIX, ITEM_TYPE_SNMPV1, ITEM_TYPE_TRAPPER, ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV2C, ITEM_TYPE_INTERNAL, ITEM_TYPE_SNMPV3, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_AGGREGATE, ITEM_TYPE_EXTERNAL, ITEM_TYPE_DB_MONITOR, ITEM_TYPE_IPMI, ITEM_TYPE_SSH, ITEM_TYPE_TELNET, ITEM_TYPE_JMX, ITEM_TYPE_CALCULATED, ITEM_TYPE_SNMPTRAP]), 'isset({add}) || isset({update})'], 'value_type' => [T_ZBX_INT, O_OPT, null, IN('0,1,2,3,4'), 'isset({add}) || isset({update})'], 'data_type' => [T_ZBX_INT, O_OPT, null, IN(ITEM_DATA_TYPE_DECIMAL . ',' . ITEM_DATA_TYPE_OCTAL . ',' . ITEM_DATA_TYPE_HEXADECIMAL . ',' . ITEM_DATA_TYPE_BOOLEAN), '(isset({add}) || isset({update})) && (isset({value_type}) && ({value_type} == ' . ITEM_VALUE_TYPE_UINT64 . '))'], 'valuemapid' => [T_ZBX_INT, O_OPT, null, DB_ID, '(isset({add}) || isset({update})) && isset({value_type})' . ' && ' . IN(ITEM_VALUE_TYPE_FLOAT . ',' . ITEM_VALUE_TYPE_UINT64, 'value_type')], 'authtype' => [T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHTYPE_PASSWORD . ',' . ITEM_AUTHTYPE_PUBLICKEY), '(isset({add}) || isset({update})) && isset({type}) && ({type} == ' . ITEM_TYPE_SSH . ')'], 'username' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_TELNET, 'type'), _('User name')], 'password' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_TELNET, 'type')], 'publickey' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type})' . ' && ({type}) == ' . ITEM_TYPE_SSH . ' && ({authtype}) == ' . ITEM_AUTHTYPE_PUBLICKEY], 'privatekey' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type})' . ' && ({type}) == ' . ITEM_TYPE_SSH . ' && ({authtype}) == ' . ITEM_AUTHTYPE_PUBLICKEY], $paramsFieldName => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type})' . ' && ' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_DB_MONITOR . ',' . ITEM_TYPE_TELNET . ',' . ITEM_TYPE_CALCULATED, 'type'), getParamFieldLabelByType(getRequest('type', 0))], 'snmp_community' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C, 'type'), _('SNMP community')], 'snmp_oid' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type})' . ' && ' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C . ',' . ITEM_TYPE_SNMPV3, 'type'), _('SNMP OID')], 'port' => [T_ZBX_STR, O_OPT, null, BETWEEN(0, 65535), '(isset({add}) || isset({update})) && isset({type})' . ' && ' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C . ',' . ITEM_TYPE_SNMPV3, 'type'), _('Port')], 'snmpv3_securitylevel' => [T_ZBX_INT, O_OPT, null, IN('0,1,2'), '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_SNMPV3 . '))'], 'snmpv3_contextname' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_SNMPV3 . '))'], 'snmpv3_securityname' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_SNMPV3 . '))'], 'snmpv3_authprotocol' => [T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHPROTOCOL_MD5 . ',' . ITEM_AUTHPROTOCOL_SHA), '(isset({add}) || isset({update})) && (isset({type})' . ' && ({type} == ' . ITEM_TYPE_SNMPV3 . ') && ({snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . ' || {snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV . '))'], 'snmpv3_authpassphrase' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && (isset({type})' . ' && ({type} == ' . ITEM_TYPE_SNMPV3 . ') && ({snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . ' || {snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV . '))'], 'snmpv3_privprotocol' => [T_ZBX_INT, O_OPT, null, IN(ITEM_PRIVPROTOCOL_DES . ',' . ITEM_PRIVPROTOCOL_AES), '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_SNMPV3 . ')' . ' && ({snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . '))'], 'snmpv3_privpassphrase' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_SNMPV3 . ')' . ' && ({snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . '))'], 'ipmi_sensor' => [T_ZBX_STR, O_OPT, P_NO_TRIM, NOT_EMPTY, '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_IPMI . '))', _('IPMI sensor')], 'trapper_hosts' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && ({type} == 2)'], 'units' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({value_type})' . ' && ' . IN('0,3', 'value_type') . ' (isset({data_type}) && ({data_type} != ' . ITEM_DATA_TYPE_BOOLEAN . '))'], 'multiplier' => [T_ZBX_INT, O_OPT, null, null, null], 'delta' => [T_ZBX_INT, O_OPT, null, IN('0,1,2'), '(isset({add}) || isset({update})) && isset({value_type})' . ' && ' . IN('0,3', 'value_type') . ' (isset({data_type}) && ({data_type} != ' . ITEM_DATA_TYPE_BOOLEAN . '))'], 'formula' => [T_ZBX_DBL_STR, O_OPT, null, '({value_type} == 0 && {} != 0) || ({value_type} == 3 && {} > 0)', '(isset({add}) || isset({update})) && isset({multiplier}) && {multiplier} == 1', _('Custom multiplier')], 'logtimefmt' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && (isset({value_type}) && ({value_type} == 2))'], 'group_itemid' => [T_ZBX_INT, O_OPT, null, DB_ID, null], 'new_application' => [T_ZBX_STR, O_OPT, null, null, 'isset({add}) || isset({update})'], 'applications' => [T_ZBX_INT, O_OPT, null, DB_ID, null], 'new_application_prototype' => [T_ZBX_STR, O_OPT, null, null, 'isset({parent_discoveryid}) && (isset({add}) || isset({update}))'], 'application_prototypes' => [T_ZBX_STR, O_OPT, null, null, null], 'history' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({add}) || isset({update})', _('History storage period')], 'trends' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), '(isset({add}) || isset({update})) && isset({value_type})' . ' && ' . IN(ITEM_VALUE_TYPE_FLOAT . ',' . ITEM_VALUE_TYPE_UINT64, 'value_type'), _('Trend storage period')], 'action' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, IN('"itemprototype.massdelete","itemprototype.massdisable","itemprototype.massenable"'), null], 'add' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'update' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'clone' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'delete' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'cancel' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'form' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null], 'filter_set' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'sort' => [T_ZBX_STR, O_OPT, P_SYS, IN('"delay","history","key_","name","status","trends","type"'), null], 'sortorder' => [T_ZBX_STR, O_OPT, P_SYS, IN('"' . ZBX_SORT_DOWN . '","' . ZBX_SORT_UP . '"'), null]];
check_fields($fields);
$_REQUEST['params'] = getRequest($paramsFieldName, '');
unset($_REQUEST[$paramsFieldName]);
// permissions
$discoveryRule = API::DiscoveryRule()->get(['output' => ['hostid'], 'itemids' => getRequest('parent_discoveryid'), 'editable' => true]);
$discoveryRule = reset($discoveryRule);
if (!$discoveryRule) {
    access_deny();
}
$itemPrototypeId = getRequest('itemid');
if ($itemPrototypeId && !API::ItemPrototype()->isWritable([$itemPrototypeId])) {
    access_deny();
}
/*
 * Actions
Exemplo n.º 16
0
require_once dirname(__FILE__) . '/include/forms.inc.php';
require_once dirname(__FILE__) . '/include/maps.inc.php';
if (isset($_REQUEST['go']) && $_REQUEST['go'] == 'export' && isset($_REQUEST['screens'])) {
    $isExportData = true;
    $page['type'] = detect_page_type(PAGE_TYPE_XML);
    $page['file'] = 'zbx_export_screens.xml';
} else {
    $isExportData = false;
    $page['type'] = detect_page_type(PAGE_TYPE_HTML);
    $page['title'] = _('Configuration of screens');
    $page['file'] = 'screenconf.php';
    $page['hist_arg'] = array('templateid');
}
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('screens' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'screenid' => array(T_ZBX_INT, O_NO, P_SYS, DB_ID, 'isset({form})&&{form}=="update"'), 'templateid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'name' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Name')), 'hsize' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 100), 'isset({save})', _('Columns')), 'vsize' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 100), 'isset({save})', _('Rows')), 'go' => 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), 'save' => 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), '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_INT, O_OPT, null, null, null), 'rules' => array(T_ZBX_STR, O_OPT, null, DB_ID, null), 'import' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null));
check_fields($fields);
validate_sort_and_sortorder('name', ZBX_SORT_UP);
CProfile::update('web.screenconf.config', get_request('config', 0), PROFILE_TYPE_INT);
$_REQUEST['go'] = get_request('go', 'none');
/*
 * Permissions
 */
if (isset($_REQUEST['screenid'])) {
    $options = array('screenids' => $_REQUEST['screenid'], 'editable' => true, 'output' => API_OUTPUT_EXTEND, 'selectScreenItems' => API_OUTPUT_EXTEND);
    if (isset($_REQUEST['templateid'])) {
        $screens = API::TemplateScreen()->get($options);
    } else {
        $screens = API::Screen()->get($options);
    }
    if (empty($screens)) {
Exemplo n.º 17
0
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['title'] = _('Configuration of authentication');
$page['file'] = 'authentication.php';
$page['hist_arg'] = array('config');
require_once dirname(__FILE__) . '/include/page_header.php';
//	VAR						TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('config' => array(T_ZBX_INT, O_OPT, null, IN(ZBX_AUTH_INTERNAL . ',' . ZBX_AUTH_LDAP . ',' . ZBX_AUTH_HTTP), null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null), 'update' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'test' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'ldap_host' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))', _('LDAP host')), 'ldap_port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))', _('Port')), 'ldap_base_dn' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))', _('Base DN')), 'ldap_bind_dn' => array(T_ZBX_STR, O_OPT, null, null, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))'), 'ldap_bind_password' => array(T_ZBX_STR, O_OPT, null, null, null, _('Bind password')), 'ldap_search_attribute' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))', _('Search attribute')), 'user' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))'), 'user_password' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))', _('User password')), 'change_bind_password' => array(T_ZBX_STR, O_OPT, null, null, null));
check_fields($fields);
$config = select_config();
if (hasRequest('config')) {
    $isAuthenticationTypeChanged = $config['authentication_type'] != getRequest('config');
    $config['authentication_type'] = getRequest('config');
} else {
    $isAuthenticationTypeChanged = false;
}
foreach ($config as $name => $value) {
    if (array_key_exists($name, $_REQUEST)) {
        $config[$name] = $_REQUEST[$name];
    }
}
/*
 * Actions
Exemplo n.º 18
0
**/
require_once 'include/config.inc.php';
require_once 'include/triggers.inc.php';
require_once 'include/media.inc.php';
require_once 'include/users.inc.php';
require_once 'include/forms.inc.php';
require_once 'include/js.inc.php';
$page['title'] = 'S_USERS';
$page['file'] = 'users.php';
$page['hist_arg'] = array('config');
$page['scripts'] = array('menu_scripts.js');
include_once 'include/page_header.php';
$_REQUEST['config'] = get_request('config', get_profile('web.users.config', 0));
update_profile('web.users.config', $_REQUEST['config'], PROFILE_TYPE_INT);
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('config' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'perm_details' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'userid' => array(T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({config})&&({config}==0))&&(isset({form})&&({form}=="update"))'), 'group_userid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'filter_usrgrpid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'alias' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'), 'name' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'), 'surname' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'), 'password1' => array(T_ZBX_STR, O_OPT, null, null, '(isset({config})&&({config}==0))&&isset({save})&&(isset({form})&&({form}!="update"))&&isset({change_password})'), "password2" => array(T_ZBX_STR, O_OPT, null, null, '(isset({config})&&({config}==0))&&isset({save})&&(isset({form})&&({form}!="update"))&&isset({change_password})'), 'user_type' => array(T_ZBX_INT, O_OPT, null, IN('1,2,3'), '(isset({config})&&({config}==0))&&isset({save})'), 'user_groups' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null), 'user_groups_to_del' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'user_medias' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null), 'user_medias_to_del' => array(T_ZBX_STR, O_OPT, null, DB_ID, null), 'new_group' => array(T_ZBX_STR, O_OPT, null, null, null), 'new_media' => array(T_ZBX_STR, O_OPT, null, null, null), 'enable_media' => array(T_ZBX_INT, O_OPT, null, null, null), 'disable_media' => array(T_ZBX_INT, O_OPT, null, null, null), 'lang' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'), 'theme' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'), 'autologin' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'autologout' => array(T_ZBX_INT, O_OPT, null, BETWEEN(90, 10000), null), 'url' => array(T_ZBX_STR, O_OPT, null, null, '(isset({config})&&({config}==0))&&isset({save})'), 'refresh' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 3600), '(isset({config})&&({config}==0))&&isset({save})'), 'right' => array(T_ZBX_STR, O_NO, null, NOT_EMPTY, '(isset({register})&&({register}=="add permission"))&&isset({userid})'), 'permission' => array(T_ZBX_STR, O_NO, null, NOT_EMPTY, '(isset({register})&&({register}=="add permission"))&&isset({userid})'), 'id' => array(T_ZBX_INT, O_NO, null, DB_ID, '(isset({register})&&({register}=="add permission"))&&isset({userid})'), 'rightid' => array(T_ZBX_INT, O_NO, null, DB_ID, '(isset({register})&&({register}=="delete permission"))&&isset({userid})'), 'grpaction' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'usrgrpid' => array(T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({config})&&(({config}==1) || isset({grpaction})))&&(isset({form})&&({form}=="update"))'), 'group_groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'selusrgrp' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'gname' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==1))&&isset({save})'), 'users' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'users_status' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), '(isset({config})&&({config}==1))&&isset({save})'), 'gui_access' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), '(isset({config})&&({config}==1))&&isset({save})'), 'new_right' => array(T_ZBX_STR, O_OPT, null, null, null), 'right_to_del' => array(T_ZBX_STR, O_OPT, null, null, null), 'group_users_to_del' => array(T_ZBX_STR, O_OPT, null, null, null), 'group_users' => array(T_ZBX_STR, O_OPT, null, null, null), 'group_rights' => array(T_ZBX_STR, O_OPT, null, null, null), 'set_users_status' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'set_gui_access' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), null), 'register' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, IN('"add permission","delete permission"'), null), 'save' => 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_selected' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'del_user_group' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'del_user_media' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'del_read_only' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'del_read_write' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'del_deny' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'del_group_user' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'add_read_only' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'add_read_write' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'add_deny' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'change_password' => 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));
check_fields($fields);
validate_sort_and_sortorder('u.alias', ZBX_SORT_UP);
if ($_REQUEST['config'] == 0) {
    if (isset($_REQUEST['new_group'])) {
        $_REQUEST['user_groups'] = get_request('user_groups', array());
        foreach ($_REQUEST['new_group'] as $id => $val) {
            $_REQUEST['user_groups'][$id] = $val;
        }
    } else {
        if (isset($_REQUEST['new_media'])) {
            $_REQUEST['user_medias'] = get_request('user_medias', array());
            array_push($_REQUEST['user_medias'], $_REQUEST['new_media']);
        } else {
            if (isset($_REQUEST['user_medias']) && isset($_REQUEST['enable_media'])) {
                if (isset($_REQUEST['user_medias'][$_REQUEST['enable_media']])) {
Exemplo n.º 19
0
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/graphs.inc.php';
require_once dirname(__FILE__) . '/include/screens.inc.php';
require_once dirname(__FILE__) . '/include/blocks.inc.php';
$page['title'] = _('Custom screens');
$page['file'] = 'screens.php';
$page['hist_arg'] = array('elementid', 'screenname');
$page['scripts'] = array('class.calendar.js', 'gtlc.js', 'flickerfreescreen.js');
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
define('ZBX_PAGE_DO_JS_REFRESH', 1);
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), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'tr_groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'tr_hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'elementid' => array(T_ZBX_INT, O_OPT, P_SYS | P_NZERO, DB_ID, null), 'screenname' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'step' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 65535), null), 'period' => array(T_ZBX_INT, O_OPT, P_SYS, null, null), 'stime' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'reset' => array(T_ZBX_STR, O_OPT, P_SYS, IN("'reset'"), null), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('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, null), 'favid' => array(T_ZBX_INT, O_OPT, P_ACT, null, null), 'favaction' => array(T_ZBX_STR, O_OPT, P_ACT, IN("'add','remove','flop'"), null), 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, null));
check_fields($fields);
/*
 * Permissions
 */
// validate group IDs
$validateGroupIds = array_filter(array(get_request('groupid'), get_request('tr_groupid')));
if ($validateGroupIds && !API::HostGroup()->isReadable($validateGroupIds)) {
    access_deny();
}
// validate host IDs
$validateHostIds = array_filter(array(get_request('hostid'), get_request('tr_hostid')));
if ($validateHostIds && !API::Host()->isReadable($validateHostIds)) {
    access_deny();
}
if (get_request('elementid')) {
Exemplo n.º 20
0
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/nodes.inc.php';
$page['title'] = _('Configuration of nodes');
$page['file'] = 'nodes.php';
$page['hist_arg'] = array();
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('nodeid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))'), 'new_nodeid' => array(T_ZBX_INT, O_OPT, null, DB_ID . NOT_ZERO, 'isset({save})', _('ID')), 'name' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), 'ip' => array(T_ZBX_IP, O_OPT, null, null, 'isset({save})'), 'nodetype' => array(T_ZBX_INT, O_OPT, null, IN(ZBX_NODE_CHILD . ',' . ZBX_NODE_MASTER . ',' . ZBX_NODE_LOCAL), 'isset({save})&&!isset({nodeid})'), 'masterid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 65535), 'isset({save})', _('Port')), 'save' => 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), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null));
check_fields($fields);
/*
 * Permissions
 */
$available_nodes = get_accessible_nodes_by_user(CWebUser::$data, PERM_READ);
if (count($available_nodes) == 0) {
    access_deny();
}
$node = null;
if (get_request('nodeid')) {
    $node = get_node_by_nodeid($_REQUEST['nodeid']);
    if (!$node) {
        access_deny();
    }
}
Exemplo n.º 21
0
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/hosts.inc.php';
require_once 'include/triggers.inc.php';
require_once 'include/html.inc.php';
$page['title'] = 'S_DASHBOARD_CONFIGURATION';
$page['file'] = 'dashconf.php';
$page['hist_arg'] = array();
$page['scripts'] = array();
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
include_once 'include/page_header.php';
//		VAR				TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('filterEnable' => array(T_ZBX_INT, O_OPT, P_SYS, NULL, NULL), 'del_groups' => array(T_ZBX_INT, O_OPT, P_SYS, NULL, NULL), 'groupids' => array(T_ZBX_INT, O_OPT, P_SYS, NULL, NULL), 'new_right' => array(T_ZBX_STR, O_OPT, null, null, null), 'trgSeverity' => array(T_ZBX_INT, O_OPT, P_SYS, NULL, NULL), 'grpswitch' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 1), NULL), 'maintenance' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 1), NULL), 'extAck' => array(T_ZBX_INT, O_OPT, P_SYS, null, NULL), 'form_refresh' => array(T_ZBX_INT, O_OPT, P_SYS, null, NULL), 'save' => array(T_ZBX_STR, O_OPT, P_SYS, null, NULL), 'delete' => array(T_ZBX_STR, O_OPT, P_SYS, null, NULL));
check_fields($fields);
// ACTION /////////////////////////////////////////////////////////////////////////////
if (isset($_REQUEST['save'])) {
    // FILTER
    $filterEnable = get_request('filterEnable', 0);
    CProfile::update('web.dashconf.filter.enable', $filterEnable, PROFILE_TYPE_INT);
    if ($filterEnable == 1) {
        // GROUPS
        $groupids = get_request('groupids', array());
        CProfile::update('web.dashconf.groups.grpswitch', $_REQUEST['grpswitch'], PROFILE_TYPE_INT);
        if ($_REQUEST['grpswitch'] == 1) {
            $result = rm4favorites('web.dashconf.groups.groupids');
            foreach ($groupids as $gnum => $groupid) {
                $result &= add2favorites('web.dashconf.groups.groupids', $groupid);
            }
Exemplo n.º 22
0
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/httptest.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('Configuration of web monitoring');
$page['file'] = 'httpconf.php';
$page['hist_arg'] = array('groupid', 'hostid');
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('applications' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'applicationid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'close' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'open' => array(T_ZBX_INT, O_OPT, null, IN('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, 'isset({form})||isset({save})'), 'httptestid' => array(T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))'), 'application' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Application')), 'name' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Name')), 'delay' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, SEC_PER_DAY), 'isset({save})', _('Update interval (in sec)')), 'status' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), 'isset({save})'), 'agent' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'macros' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'steps' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})', _('Steps')), 'authentication' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), 'isset({save})'), 'http_user' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({authentication})&&({authentication}==' . HTTPTEST_AUTH_BASIC . '||{authentication}==' . HTTPTEST_AUTH_NTLM . ')', _('User')), 'http_password' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({authentication})&&({authentication}==' . HTTPTEST_AUTH_BASIC . '||{authentication}==' . HTTPTEST_AUTH_NTLM . ')', _('Password')), 'new_httpstep' => array(T_ZBX_STR, O_OPT, null, null, null), 'move_up' => array(T_ZBX_INT, O_OPT, P_ACT, BETWEEN(0, 65534), null), 'move_down' => array(T_ZBX_INT, O_OPT, P_ACT, BETWEEN(0, 65534), null), 'sel_step' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65534), null), 'group_httptestid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'showdisabled' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null), 'go' => 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), 'save' => 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), '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_INT, O_OPT, null, null, null));
$_REQUEST['showdisabled'] = get_request('showdisabled', CProfile::get('web.httpconf.showdisabled', 1));
$_REQUEST['status'] = isset($_REQUEST['status']) ? 0 : 1;
check_fields($fields);
validate_sort_and_sortorder('name', ZBX_SORT_UP);
$showDisabled = get_request('showdisabled', 1);
CProfile::update('web.httpconf.showdisabled', $showDisabled, PROFILE_TYPE_STR);
if (!empty($_REQUEST['steps'])) {
    order_result($_REQUEST['steps'], 'no');
}
/*
 * Permissions
 */
if (isset($_REQUEST['httptestid'])) {
    $dbHttpTest = DBfetch(DBselect('SELECT wt.*,a.name AS application' . ' FROM httptest wt,applications a' . ' WHERE a.applicationid=wt.applicationid' . ' AND wt.httptestid=' . get_request('httptestid')));
    if (empty($dbHttpTest)) {
Exemplo n.º 23
0
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/items.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('Configuration of discovery rules');
$page['file'] = 'host_discovery.php';
$page['scripts'] = array('class.cviewswitcher.js');
$page['hist_arg'] = array('hostid');
require_once dirname(__FILE__) . '/include/page_header.php';
$paramsFieldName = getParamFieldNameByType(get_request('type', 0));
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '!isset({form})'), 'itemid' => array(T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))'), 'interfaceid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null, _('Interface')), 'name' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Name')), 'description' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'filter_macro' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'filter_value' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'key' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Key')), 'delay' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, SEC_PER_DAY), 'isset({save})&&(isset({type})&&({type}!=' . ITEM_TYPE_TRAPPER . '&&{type}!=' . ITEM_TYPE_SNMPTRAP . '))', _('Update interval (in sec)')), 'delay_flex' => array(T_ZBX_STR, O_OPT, null, '', null), 'add_delay_flex' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'new_delay_flex' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add_delay_flex})&&(isset({type})&&({type}!=2))', _('New flexible interval')), 'status' => array(T_ZBX_INT, O_OPT, null, IN(ITEM_STATUS_ACTIVE), null), 'type' => array(T_ZBX_INT, O_OPT, null, IN(array(-1, ITEM_TYPE_ZABBIX, ITEM_TYPE_SNMPV1, ITEM_TYPE_TRAPPER, ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV2C, ITEM_TYPE_INTERNAL, ITEM_TYPE_SNMPV3, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_EXTERNAL, ITEM_TYPE_DB_MONITOR, ITEM_TYPE_IPMI, ITEM_TYPE_SSH, ITEM_TYPE_TELNET, ITEM_TYPE_JMX)), 'isset({save})'), 'authtype' => array(T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHTYPE_PASSWORD . ',' . ITEM_AUTHTYPE_PUBLICKEY), 'isset({save})&&isset({type})&&({type}==' . ITEM_TYPE_SSH . ')'), 'username' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_TELNET, 'type'), _('User name')), 'password' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_TELNET, 'type')), 'publickey' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({type})&&({type})==' . ITEM_TYPE_SSH . '&&({authtype})==' . ITEM_AUTHTYPE_PUBLICKEY), 'privatekey' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({type})&&({type})==' . ITEM_TYPE_SSH . '&&({authtype})==' . ITEM_AUTHTYPE_PUBLICKEY), $paramsFieldName => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_DB_MONITOR . ',' . ITEM_TYPE_TELNET . ',' . ITEM_TYPE_CALCULATED, 'type'), getParamFieldLabelByType(get_request('type', 0))), 'snmp_community' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C, 'type'), _('SNMP community')), 'snmp_oid' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C . ',' . ITEM_TYPE_SNMPV3, 'type'), _('SNMP OID')), 'port' => array(T_ZBX_STR, O_OPT, null, BETWEEN(0, 65535), 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C . ',' . ITEM_TYPE_SNMPV3, 'type'), _('Port')), 'snmpv3_contextname' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . '))'), 'snmpv3_securitylevel' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . '))'), 'snmpv3_securityname' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . '))'), 'snmpv3_authprotocol' => array(T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHPROTOCOL_MD5 . ',' . ITEM_AUTHPROTOCOL_SHA), 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . ')&&({snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . '||{snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV . '))'), 'snmpv3_authpassphrase' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . ')&&({snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . '||{snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV . '))'), 'snmpv3_privprotocol' => array(T_ZBX_INT, O_OPT, null, IN(ITEM_PRIVPROTOCOL_DES . ',' . ITEM_PRIVPROTOCOL_AES), 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . ')&&({snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . '))'), 'snmpv3_privpassphrase' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . ')&&({snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . '))'), 'ipmi_sensor' => array(T_ZBX_STR, O_OPT, NO_TRIM, NOT_EMPTY, 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_IPMI . '))', _('IPMI sensor')), 'trapper_hosts' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({type})&&({type}==2)'), 'lifetime' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'go' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'g_hostdruleid' => array(T_ZBX_INT, O_OPT, null, DB_ID, 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), 'update' => 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), '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_INT, 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})'), 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})&&("filter"=={favobj})'));
check_fields($fields);
validate_sort_and_sortorder('name', ZBX_SORT_UP);
$_REQUEST['go'] = get_request('go', 'none');
$_REQUEST['params'] = get_request($paramsFieldName, '');
unset($_REQUEST[$paramsFieldName]);
/*
 * Permissions
 */
if (get_request('itemid', false)) {
    $item = API::DiscoveryRule()->get(array('itemids' => $_REQUEST['itemid'], 'output' => API_OUTPUT_EXTEND, 'selectHosts' => array('status', 'flags'), 'editable' => true));
    $item = reset($item);
    if (!$item) {
        access_deny();
    }
    $_REQUEST['hostid'] = $item['hostid'];
Exemplo n.º 24
0
require_once dirname(__FILE__) . '/include/users.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
require_once dirname(__FILE__) . '/include/media.inc.php';
$page['title'] = _('User profile');
$page['file'] = 'profile.php';
$page['hist_arg'] = array();
$page['scripts'] = array('class.cviewswitcher.js');
ob_start();
require_once dirname(__FILE__) . '/include/page_header.php';
if (CWebUser::$data['alias'] == ZBX_GUEST_USER) {
    access_deny();
}
$themes = array_keys(Z::getThemes());
$themes[] = THEME_DEFAULT;
//	VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('password1' => array(T_ZBX_STR, O_OPT, null, null, 'isset({update}) && isset({form}) && ({form} != "update") && isset({change_password})'), 'password2' => array(T_ZBX_STR, O_OPT, null, null, 'isset({update}) && isset({form}) && ({form} != "update") && isset({change_password})'), 'lang' => array(T_ZBX_STR, O_OPT, null, null, null), 'theme' => array(T_ZBX_STR, O_OPT, null, IN('"' . implode('","', $themes) . '"'), 'isset({update})'), 'autologin' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'autologout' => array(T_ZBX_INT, O_OPT, null, BETWEEN(90, 10000), null, _('Auto-logout (min 90 seconds)')), 'autologout_visible' => array(T_ZBX_STR, O_OPT, null, IN('1'), null), 'url' => array(T_ZBX_STR, O_OPT, null, null, 'isset({update})'), 'refresh' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, SEC_PER_HOUR), 'isset({update})', _('Refresh (in seconds)')), 'rows_per_page' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 999999), 'isset({update})', _('Rows per page')), 'change_password' => array(T_ZBX_STR, O_OPT, null, null, null), 'user_medias' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null), 'user_medias_to_del' => array(T_ZBX_STR, O_OPT, null, DB_ID, null), 'new_media' => array(T_ZBX_STR, O_OPT, null, null, null), 'enable_media' => array(T_ZBX_INT, O_OPT, null, null, null), 'disable_media' => array(T_ZBX_INT, O_OPT, null, null, null), 'messages' => array(T_ZBX_STR, O_OPT, null, null, null), 'update' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'del_user_media' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null));
check_fields($fields);
$_REQUEST['autologin'] = getRequest('autologin', 0);
// secondary actions
if (isset($_REQUEST['new_media'])) {
    $_REQUEST['user_medias'] = getRequest('user_medias', array());
    array_push($_REQUEST['user_medias'], $_REQUEST['new_media']);
} elseif (isset($_REQUEST['user_medias']) && isset($_REQUEST['enable_media'])) {
    if (isset($_REQUEST['user_medias'][$_REQUEST['enable_media']])) {
        $_REQUEST['user_medias'][$_REQUEST['enable_media']]['active'] = 0;
    }
} elseif (isset($_REQUEST['user_medias']) && isset($_REQUEST['disable_media'])) {
    if (isset($_REQUEST['user_medias'][$_REQUEST['disable_media']])) {
        $_REQUEST['user_medias'][$_REQUEST['disable_media']]['active'] = 1;
    }
} elseif (isset($_REQUEST['del_user_media'])) {
Exemplo n.º 25
0
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/graphs.inc.php';
require_once dirname(__FILE__) . '/include/screens.inc.php';
require_once dirname(__FILE__) . '/include/blocks.inc.php';
$page['title'] = _('Host screens');
$page['file'] = 'screens.php';
$page['hist_arg'] = array('elementid');
$page['scripts'] = array('effects.js', 'dragdrop.js', 'class.calendar.js', 'gtlc.js', 'flickerfreescreen.js');
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
define('ZBX_PAGE_DO_JS_REFRESH', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'tr_groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'tr_hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'screenid' => array(T_ZBX_INT, O_OPT, P_SYS | P_NZERO, DB_ID, null), 'step' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 65535), null), 'period' => array(T_ZBX_INT, O_OPT, P_SYS, null, null), 'stime' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'reset' => array(T_ZBX_STR, O_OPT, P_SYS, IN('"reset"'), null), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null), 'filterState' => array(T_ZBX_INT, O_OPT, P_ACT, null, null), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, null, null), 'favid' => array(T_ZBX_INT, O_OPT, P_ACT, null, null), 'favaction' => array(T_ZBX_STR, O_OPT, P_ACT, IN('"add","remove"'), null));
check_fields($fields);
/*
 * Ajax
 */
if (hasRequest('filterState')) {
    CProfile::update('web.hostscreen.filter.state', getRequest('filterState'), PROFILE_TYPE_INT);
}
if (getRequest('favobj') === 'timeline' && hasRequest('elementid') && hasRequest('period')) {
    navigation_bar_calc('web.hostscreen', getRequest('elementid'), true);
}
if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) {
    require_once dirname(__FILE__) . '/include/page_footer.php';
    exit;
}
/*
Exemplo n.º 26
0
**
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/setup.inc.php';
$page['title'] = _('Installation');
$page['file'] = 'setup.php';
if (!defined('PAGE_HEADER_LOADED') && !defined('ZBX_PAGE_NO_MENU')) {
    define('ZBX_PAGE_NO_MENU', 1);
}
define('ZBX_PAGE_NO_THEME', true);
// don't load any themes for this page
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('distributed' => array(T_ZBX_STR, O_OPT, null, null, null), 'trouble' => array(T_ZBX_STR, O_OPT, null, null, null), 'type' => array(T_ZBX_STR, O_OPT, null, IN('"' . ZBX_DB_MYSQL . '","' . ZBX_DB_POSTGRESQL . '","' . ZBX_DB_ORACLE . '","' . ZBX_DB_DB2 . '","' . ZBX_DB_SQLITE3 . '"'), null), 'server' => array(T_ZBX_STR, O_OPT, null, null, null), 'port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Port')), 'database' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null, _('Database name')), 'user' => array(T_ZBX_STR, O_OPT, null, null, null), 'password' => array(T_ZBX_STR, O_OPT, null, null, null), 'schema' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server_name' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server_port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Port')), 'message' => array(T_ZBX_STR, O_OPT, null, null, null), 'nodename' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null), 'nodeid' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 999), null), 'save_config' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'retry' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'finish' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'next' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'back' => 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_INT, O_OPT, null, null, null));
check_fields($fields, false);
global $ZBX_CONFIG;
if (isset($_REQUEST['cancel']) || isset($_REQUEST['finish'])) {
    zbx_unsetcookie('ZBX_CONFIG');
    redirect('index.php');
}
$ZBX_CONFIG = get_cookie('ZBX_CONFIG', null);
$ZBX_CONFIG = isset($ZBX_CONFIG) ? unserialize($ZBX_CONFIG) : array();
if (!isset($ZBX_CONFIG['step'])) {
    $ZBX_CONFIG['step'] = 0;
}
if (!isset($ZBX_CONFIG['agree'])) {
    $ZBX_CONFIG['agree'] = false;
}
$ZBX_CONFIG['allowed_db'] = array();
Exemplo n.º 27
0
**
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/audit.inc.php';
require_once dirname(__FILE__) . '/include/actions.inc.php';
require_once dirname(__FILE__) . '/include/users.inc.php';
$page['title'] = _('Audit log');
$page['file'] = 'auditlogs.php';
$page['scripts'] = ['class.calendar.js', 'gtlc.js'];
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = ['action' => [T_ZBX_INT, O_OPT, P_SYS, BETWEEN(-1, 6), null], 'resourcetype' => [T_ZBX_INT, O_OPT, P_SYS, BETWEEN(-1, 31), null], 'filter_rst' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'filter_set' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'alias' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'period' => [T_ZBX_INT, O_OPT, null, null, null], 'stime' => [T_ZBX_STR, O_OPT, null, 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);
/*
 * Ajax
 */
if (isset($_REQUEST['favobj'])) {
    // saving fixed/dynamic setting to profile
    if ($_REQUEST['favobj'] == 'timelinefixedperiod') {
        if (isset($_REQUEST['favid'])) {
            CProfile::update('web.auditlogs.timelinefixed', $_REQUEST['favid'], PROFILE_TYPE_INT);
        }
    }
}
if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) {
    require_once dirname(__FILE__) . '/include/page_footer.php';
    exit;
Exemplo n.º 28
0
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/maps.inc.php';
require_once 'include/forms.inc.php';
$page['title'] = 'S_NETWORK_MAPS';
$page['file'] = 'sysmaps.php';
$page['hist_arg'] = array();
include_once 'include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('maps' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'sysmapid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'name' => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({save})'), 'width' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 65535), 'isset({save})'), 'height' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 65535), 'isset({save})'), 'backgroundid' => array(T_ZBX_INT, O_OPT, NULL, DB_ID, 'isset({save})'), 'label_type' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 4), 'isset({save})'), 'label_location' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 3), 'isset({save})'), 'save' => 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), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'go' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'form_refresh' => array(T_ZBX_INT, O_OPT, NULL, NULL, NULL));
check_fields($fields);
validate_sort_and_sortorder('sm.name', ZBX_SORT_UP);
if (isset($_REQUEST['sysmapid'])) {
    if (!sysmap_accessible($_REQUEST['sysmapid'], PERM_READ_WRITE)) {
        access_deny();
    }
    $sysmap = DBfetch(DBselect('select * from sysmaps where sysmapid=' . $_REQUEST['sysmapid']));
}
$_REQUEST['go'] = get_request('go', 'none');
if (isset($_REQUEST["save"])) {
    if (isset($_REQUEST["sysmapid"])) {
        // TODO check permission by new value.
        DBstart();
        update_sysmap($_REQUEST["sysmapid"], $_REQUEST["name"], $_REQUEST["width"], $_REQUEST["height"], $_REQUEST["backgroundid"], $_REQUEST["label_type"], $_REQUEST["label_location"]);
        $result = DBend();
Exemplo n.º 29
0
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/triggers.inc.php';
require_once 'include/js.inc.php';
$dstfrm = get_request('dstfrm', 0);
// destination form
$page['title'] = "S_GRAPH_ITEM";
$page['file'] = 'popup_gitem.php';
$page['scripts'] = array();
define('ZBX_PAGE_NO_MENU', 1);
include_once 'include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('dstfrm' => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null), 'graphid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'gid' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 65535), null), 'graphtype' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2,3'), 'isset({save})'), 'list_name' => array(T_ZBX_STR, O_OPT, P_SYS, NOT_EMPTY, 'isset({save})&&isset({gid})'), 'itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID . '({}!=0)', 'isset({save})'), 'color' => array(T_ZBX_CLR, O_OPT, null, null, 'isset({save})'), 'drawtype' => array(T_ZBX_INT, O_OPT, null, IN(graph_item_drawtypes()), 'isset({save})&&(({graphtype} == 0) || ({graphtype} == 1))'), 'sortorder' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({save})&&(({graphtype} == 0) || ({graphtype} == 1))'), 'yaxisside' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), 'isset({save})&&(({graphtype} == 0) || ({graphtype} == 1))'), 'calc_fnc' => array(T_ZBX_INT, O_OPT, null, IN('1,2,4,7,9'), 'isset({save})'), 'type' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), 'isset({save})'), 'periods_cnt' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 360), 'isset({save})'), 'only_hostid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'monitored_hosts' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'add' => 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), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_STR, O_OPT, null, null, null));
check_fields($fields);
insert_js_function('add_graph_item');
insert_js_function('update_graph_item');
$_REQUEST['drawtype'] = get_request('drawtype', 0);
$_REQUEST['yaxisside'] = get_request('yaxisside', 0);
$_REQUEST['sortorder'] = get_request('sortorder', 0);
$graphid = get_request('graphid', false);
if (isset($_REQUEST['type']) && $_REQUEST['type'] == GRAPH_ITEM_SUM && $graphid !== false) {
    $sql = 'SELECT COUNT(itemid) as items' . ' FROM graphs_items ' . ' WHERE type=' . GRAPH_ITEM_SUM . ' AND graphid=' . $graphid . ' AND itemid<>' . $_REQUEST['itemid'];
    $res = DBselect($sql);
    while ($rows = DBfetch($res)) {
        if (isset($rows['items']) && $rows['items'] > 0) {
            show_messages(false, null, S_ANOTHER_ITEM_SUM);
            if (isset($_REQUEST['save'])) {
                unset($_REQUEST['save']);
Exemplo n.º 30
0
** 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.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/items.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('Configuration of items');
$page['file'] = 'items.php';
$page['scripts'] = array('class.cviewswitcher.js');
$page['hist_arg'] = array();
require_once dirname(__FILE__) . '/include/page_header.php';
$paramsFieldName = getParamFieldNameByType(get_request('type', 0));
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('description_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'type_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'interface_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'community_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'securityname_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'securitylevel_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'authpassphrase_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'privpassphras_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'port_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'authtype_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'username_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'publickey_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'privatekey_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'password_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'value_type_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'data_type_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'units_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'formula_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'delay_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'delay_flex_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'history_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'trends_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'status_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'logtimefmt_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'delta_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'valuemapid_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'trapper_hosts_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'applications_visible' => array(T_ZBX_STR, O_OPT, null, null, null), 'groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'hostid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'form_hostid' => array(T_ZBX_INT, O_OPT, null, DB_ID . NOT_ZERO, 'isset({save})', _('Host')), 'interfaceid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null, _('Interface')), 'copy_type' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), 'isset({copy})'), 'copy_mode' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0'), null), 'itemid' => array(T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))'), 'name' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Name')), 'description' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'key' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Key')), 'delay' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, SEC_PER_DAY), 'isset({save})&&(isset({type})&&({type}!=' . ITEM_TYPE_TRAPPER . '&&{type}!=' . ITEM_TYPE_SNMPTRAP . '))', _('Update interval (in sec)')), 'new_delay_flex' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add_delay_flex})&&(isset({type})&&({type}!=2))', _('New flexible interval')), 'delay_flex' => array(T_ZBX_STR, O_OPT, null, '', null), 'history' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({save})', _('Keep history (in days)')), 'status' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({save})'), 'type' => array(T_ZBX_INT, O_OPT, null, IN(array(-1, ITEM_TYPE_ZABBIX, ITEM_TYPE_SNMPV1, ITEM_TYPE_TRAPPER, ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV2C, ITEM_TYPE_INTERNAL, ITEM_TYPE_SNMPV3, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_AGGREGATE, ITEM_TYPE_EXTERNAL, ITEM_TYPE_DB_MONITOR, ITEM_TYPE_IPMI, ITEM_TYPE_SSH, ITEM_TYPE_TELNET, ITEM_TYPE_JMX, ITEM_TYPE_CALCULATED, ITEM_TYPE_SNMPTRAP)), 'isset({save})'), 'trends' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({save})&&isset({value_type})&&' . IN(ITEM_VALUE_TYPE_FLOAT . ',' . ITEM_VALUE_TYPE_UINT64, 'value_type'), _('Keep trends (in days)')), 'value_type' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2,3,4'), 'isset({save})'), 'data_type' => array(T_ZBX_INT, O_OPT, null, IN(ITEM_DATA_TYPE_DECIMAL . ',' . ITEM_DATA_TYPE_OCTAL . ',' . ITEM_DATA_TYPE_HEXADECIMAL . ',' . ITEM_DATA_TYPE_BOOLEAN), 'isset({save})&&(isset({value_type})&&({value_type}==' . ITEM_VALUE_TYPE_UINT64 . '))'), 'valuemapid' => array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({save})&&isset({value_type})&&' . IN(ITEM_VALUE_TYPE_FLOAT . ',' . ITEM_VALUE_TYPE_UINT64, 'value_type')), 'authtype' => array(T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHTYPE_PASSWORD . ',' . ITEM_AUTHTYPE_PUBLICKEY), 'isset({save})&&isset({type})&&({type}==' . ITEM_TYPE_SSH . ')'), 'username' => array(T_ZBX_STR, O_OPT, null, '{type}==' . ITEM_TYPE_JMX . '||' . NOT_EMPTY, 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_TELNET . ',' . ITEM_TYPE_JMX, 'type')), 'password' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_TELNET . ',' . ITEM_TYPE_JMX, 'type')), 'publickey' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&({type})==' . ITEM_TYPE_SSH . '&&({authtype})==' . ITEM_AUTHTYPE_PUBLICKEY), 'privatekey' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&({type})==' . ITEM_TYPE_SSH . '&&({authtype})==' . ITEM_AUTHTYPE_PUBLICKEY), $paramsFieldName => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_DB_MONITOR . ',' . ITEM_TYPE_TELNET . ',' . ITEM_TYPE_CALCULATED, 'type'), getParamFieldLabelByType(get_request('type', 0))), 'inventory_link' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({save})&&{value_type}!=' . ITEM_VALUE_TYPE_LOG), 'snmp_community' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C, 'type'), _('SNMP community')), 'snmp_oid' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C . ',' . ITEM_TYPE_SNMPV3, 'type'), _('SNMP OID')), 'port' => array(T_ZBX_STR, O_OPT, null, BETWEEN(0, 65535), 'isset({save})&&isset({type})&&' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C . ',' . ITEM_TYPE_SNMPV3, 'type'), _('Port')), 'snmpv3_securitylevel' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . '))'), 'snmpv3_securityname' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . '))'), 'snmpv3_authpassphrase' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . ')&&({snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . '||{snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV . '))'), 'snmpv3_privpassphrase' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_SNMPV3 . ')&&({snmpv3_securitylevel}==' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . '))'), 'ipmi_sensor' => array(T_ZBX_STR, O_OPT, NO_TRIM, NOT_EMPTY, 'isset({save})&&(isset({type})&&({type}==' . ITEM_TYPE_IPMI . '))', _('IPMI sensor')), 'trapper_hosts' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({type})&&({type}==2)'), 'units' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({value_type})&&' . IN('0,3', 'value_type') . '(isset({data_type})&&({data_type}!=' . ITEM_DATA_TYPE_BOOLEAN . '))'), 'multiplier' => array(T_ZBX_INT, O_OPT, null, null, null), 'delta' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), 'isset({save})&&isset({value_type})&&' . IN('0,3', 'value_type') . '(isset({data_type})&&({data_type}!=' . ITEM_DATA_TYPE_BOOLEAN . '))'), 'formula' => array(T_ZBX_DBL, O_OPT, P_UNSET_EMPTY, '({value_type}==0&&{}!=0)||({value_type}==3&&{}>0)', 'isset({save})&&isset({multiplier})&&({multiplier}==1)', _('Custom multiplier')), 'logtimefmt' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({value_type})&&({value_type}==2))'), 'group_itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'copy_targetid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'copy_groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({copy})&&(isset({copy_type})&&({copy_type}==0))'), 'new_application' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'applications' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'del_history' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'add_delay_flex' => 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), '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), 'update' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'copy' => 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), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'massupdate' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null), 'filter_set' => array(T_ZBX_STR, O_OPT, P_ACT, null, null), 'filter_group' => array(T_ZBX_STR, O_OPT, null, null, null), 'filter_hostname' => array(T_ZBX_STR, O_OPT, null, null, null), 'filter_hostid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'filter_application' => array(T_ZBX_STR, O_OPT, null, null, null), 'filter_name' => array(T_ZBX_STR, O_OPT, null, null, null), 'filter_type' => array(T_ZBX_INT, O_OPT, null, IN(array(-1, ITEM_TYPE_ZABBIX, ITEM_TYPE_SNMPV1, ITEM_TYPE_TRAPPER, ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV2C, ITEM_TYPE_INTERNAL, ITEM_TYPE_SNMPV3, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_AGGREGATE, ITEM_TYPE_EXTERNAL, ITEM_TYPE_DB_MONITOR, ITEM_TYPE_IPMI, ITEM_TYPE_SSH, ITEM_TYPE_TELNET, ITEM_TYPE_JMX, ITEM_TYPE_CALCULATED, ITEM_TYPE_SNMPTRAP)), null), 'filter_key' => array(T_ZBX_STR, O_OPT, null, null, null), 'filter_snmp_community' => array(T_ZBX_STR, O_OPT, null, null, null), 'filter_snmpv3_securityname' => array(T_ZBX_STR, O_OPT, null, null, null), 'filter_snmp_oid' => array(T_ZBX_STR, O_OPT, null, null, null), 'filter_port' => array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0, 65535), null, _('Port')), 'filter_value_type' => array(T_ZBX_INT, O_OPT, null, IN('-1,0,1,2,3,4'), null), 'filter_data_type' => array(T_ZBX_INT, O_OPT, null, BETWEEN(-1, ITEM_DATA_TYPE_BOOLEAN), null), 'filter_delay' => array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0, SEC_PER_DAY), null, _('Update interval')), 'filter_history' => array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0, 65535), null, _('Keep history (in days)')), 'filter_trends' => array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0, 65535), null, _('Keep trends (in days)')), 'filter_status' => array(T_ZBX_INT, O_OPT, null, IN('-1,0,1,3'), null), 'filter_templated_items' => array(T_ZBX_INT, O_OPT, null, IN('-1,0,1'), null), 'filter_with_triggers' => array(T_ZBX_INT, O_OPT, null, IN('-1,0,1'), null), 'filter_ipmi_sensor' => array(T_ZBX_STR, O_OPT, null, null, null), 'subfilter_apps' => array(T_ZBX_STR, O_OPT, null, null, null), 'subfilter_types' => array(T_ZBX_INT, O_OPT, null, null, null), 'subfilter_value_types' => array(T_ZBX_INT, O_OPT, null, null, null), 'subfilter_status' => array(T_ZBX_INT, O_OPT, null, null, null), 'subfilter_templated_items' => array(T_ZBX_INT, O_OPT, null, null, null), 'subfilter_with_triggers' => array(T_ZBX_INT, O_OPT, null, null, null), 'subfilter_hosts' => array(T_ZBX_INT, O_OPT, null, null, null), 'subfilter_interval' => array(T_ZBX_INT, O_OPT, null, null, null), 'subfilter_history' => array(T_ZBX_INT, O_OPT, null, null, null), 'subfilter_trends' => array(T_ZBX_INT, 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})'), 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})&&("filter"=={favobj})'));
check_fields($fields);
validate_sort_and_sortorder('name', ZBX_SORT_UP);
$_REQUEST['go'] = get_request('go', 'none');
$_REQUEST['params'] = get_request($paramsFieldName, '');
unset($_REQUEST[$paramsFieldName]);
// permissions
if (get_request('itemid', false)) {
    $item = API::Item()->get(array('itemids' => $_REQUEST['itemid'], 'filter' => array('flags' => array(ZBX_FLAG_DISCOVERY_NORMAL)), 'output' => API_OUTPUT_SHORTEN, 'editable' => true, 'preservekeys' => true));
    if (empty($item)) {
        access_deny();
    }
} elseif (get_request('hostid', 0) > 0) {
    $hosts = API::Host()->get(array('hostids' => $_REQUEST['hostid'], 'output' => API_OUTPUT_EXTEND, 'templated_hosts' => true, 'editable' => true));
    if (empty($hosts)) {
        access_deny();