Exemple #1
0
         $where_case[] = 'i.logtimefmt=' . zbx_dbstr($_REQUEST['filter_logtimefmt']);
     }
     if (isset($_REQUEST['filter_delta']) && $_REQUEST['filter_delta'] != -1) {
         $where_case[] = 'i.delta=' . $_REQUEST['filter_delta'];
     }
     if (isset($_REQUEST['filter_trapper_hosts'])) {
         $where_case[] = 'i.trapper_hosts like ' . zbx_dbstr('%' . $_REQUEST['filter_trapper_hosts'] . '%');
     }
     $show_applications = 0;
 }
 //--------------------------
 // TABLE
 $form = new CForm();
 $form->setName('items');
 $table = new CTableInfo();
 $table->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $form->GetName() . "','all_items','group_itemid');"), $show_host ? make_sorting_link(S_HOST, 'h.host') : null, make_sorting_link(S_DESCRIPTION, 'i.description'), make_sorting_link(S_KEY, 'i.key_'), make_sorting_link(S_INTERVAL, 'i.delay'), make_sorting_link(S_HISTORY, 'i.history'), make_sorting_link(S_TRENDS, 'i.trends'), make_sorting_link(S_TYPE, 'i.type'), make_sorting_link(S_STATUS, 'i.status'), $show_applications ? S_APPLICATIONS : null, S_ERROR));
 $from_tables['i'] = 'items i';
 /* NOTE: must be added as last element to use left join */
 /*
 		$sql = 'SELECT DISTINCT th.host as template_host,th.hostid as template_hostid, h.host, h.hostid, hgg.groupid, i.* '.
 				' FROM '.implode(',', $from_tables).
 					' LEFT JOIN hosts_groups hgg ON hgg.hostid=i.hostid '.
 					' LEFT JOIN items ti ON i.templateid=ti.itemid '.
 					' LEFT JOIN hosts th ON ti.hostid=th.hostid '.
 				' WHERE '.implode(' AND ', $where_case).
 				order_by('h.host,i.description,i.key_,i.delay,i.history,i.trends,i.type,i.status','i.itemid');
 //*/
 //*
 $sql = 'SELECT DISTINCT th.host as template_host,th.hostid as template_hostid, h.host, h.hostid, i.* ' . ' FROM ' . implode(',', $from_tables) . ' LEFT JOIN items ti ON i.templateid=ti.itemid ' . ' LEFT JOIN hosts th ON ti.hostid=th.hostid ' . ' WHERE ' . implode(' and ', $where_case) . order_by('h.host,i.description,i.key_,i.delay,i.history,i.trends,i.type,i.status', 'i.itemid');
 //*/
 $db_items = DBselect($sql);
Exemple #2
0
/* limit opened application count */
while (count($_REQUEST['applications']) > 25) {
    array_shift($_REQUEST['applications']);
}
update_profile('web.latest.applications', $_REQUEST['applications'], PROFILE_TYPE_ARRAY_ID);
if (isset($show_all_apps)) {
    $url = '?close=1' . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select');
    $link = new CLink(new CImg('images/general/opened.gif'), $url);
    //		$link = new CLink(new CImg('images/general/opened.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');");
} else {
    $url = '?open=1' . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select');
    $link = new CLink(new CImg('images/general/closed.gif'), $url);
    //		$link = new CLink(new CImg('images/general/closed.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');");
}
$table = new CTableInfo();
$table->SetHeader(array(is_show_subnodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, $_REQUEST['hostid'] == 0 ? make_sorting_link(S_HOST, 'h.host') : NULL, array($link, SPACE, make_sorting_link(S_DESCRIPTION, 'i.description')), make_sorting_link(S_LAST_CHECK, 'i.lastclock'), S_LAST_VALUE, S_CHANGE, S_HISTORY));
//	$table->ShowStart();
$db_apps = array();
$db_appids = array();
$sql_where .= $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] : '';
$sql = 'SELECT DISTINCT h.host,h.hostid, a.* ' . ' FROM applications a, hosts h ' . $sql_from . ' WHERE a.hostid=h.hostid' . $sql_where . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND h.status=' . HOST_STATUS_MONITORED . order_by('h.host,h.hostid', 'a.name,a.applicationid');
//SDI($sql);
$db_app_res = DBselect($sql);
while ($db_app = DBfetch($db_app_res)) {
    $db_app['item_cnt'] = 0;
    $db_apps[$db_app['applicationid']] = $db_app;
    $db_appids[$db_app['applicationid']] = $db_app['applicationid'];
}
$tab_rows = array();
$sql = 'SELECT DISTINCT i.*, ia.applicationid ' . ' FROM items i,items_applications ia' . ' WHERE ' . DBcondition('ia.applicationid', $db_appids) . ' AND i.itemid=ia.itemid AND i.lastvalue IS NOT NULL' . ' AND (i.status=' . ITEM_STATUS_ACTIVE . ' OR i.status=' . ITEM_STATUS_NOTSUPPORTED . ')' . order_by('i.description,i.itemid,i.lastclock');
//SDI($sql);
Exemple #3
0
$form = new CForm();
$form->SetMethod('get');
$form->AddItem(new CButton("form", S_CREATE_MAP));
show_table_header(S_CONFIGURATION_OF_NETWORK_MAPS, $form);
echo SBR;
if (isset($_REQUEST["form"])) {
    insert_map_form();
} else {
    $form = new CForm();
    $form->setName('frm_maps');
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_MAPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_MAPS_DEFINED);
    $table->SetHeader(array(new CCheckBox('all_maps', NULL, "checkAll('" . $form->getName() . "','all_maps','maps');"), make_sorting_link(S_NAME, 'sm.name'), make_sorting_link(S_WIDTH, 'sm.width'), make_sorting_link(S_HEIGHT, 'sm.height'), S_MAP));
    $result = DBselect('SELECT sm.sysmapid,sm.name,sm.width,sm.height ' . ' FROM sysmaps sm' . ' WHERE ' . DBin_node('sm.sysmapid') . order_by('sm.name,sm.width,sm.height', 'sm.sysmapid'));
    while ($row = DBfetch($result)) {
        if (!sysmap_accessible($row["sysmapid"], PERM_READ_WRITE)) {
            continue;
        }
        $table->AddRow(array(new CCheckBox('maps[' . $row['sysmapid'] . ']', NULL, NULL, $row['sysmapid']), new CLink($row["name"], "sysmaps.php?form=update" . "&sysmapid=" . $row["sysmapid"] . "#form", 'action'), $row["width"], $row["height"], new CLink(S_EDIT, "sysmap.php?sysmapid=" . $row["sysmapid"])));
    }
    //----- GO ------
    $goBox = new CComboBox('go');
    $goBox->addItem('delete', S_DELETE_SELECTED);
    // goButton name is necessary!!!
    $goButton = new CButton('goButton', S_GO . ' (0)');
    $goButton->setAttribute('id', 'goButton');
    zbx_add_post_js('chkbxRange.pageGoName = "maps";');
    $table->setFooter(new CCol(array($goBox, $goButton)));
Exemple #4
0
        $frmScr->addItemToBottomRow(SPACE);
    }
    $frmScr->addItemToBottomRow(new CButtonCancel());
    $frmScr->Show();
} else {
    validate_sort_and_sortorder('s.name', ZBX_SORT_UP);
    $form = new CForm();
    $form->setName('scripts');
    $form->setAttribute('id', 'scripts');
    $form->addVar('action', '1');
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_SCRIPTS, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_SCRIPTS_DEFINED);
    $table->setHeader(array(new CCheckBox('all_scripts', null, "checkAll('" . $form->getName() . "','all_scripts','scripts');"), make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_COMMAND, 's.command'), S_USER_GROUP, S_HOST_GROUP, S_HOST_ACCESS));
    $sql = 'SELECT s.* ' . ' FROM scripts s ' . ' WHERE ' . DBin_node('s.scriptid') . order_by('s.name,s.command');
    $scripts = DBselect($sql);
    while ($script = DBfetch($scripts)) {
        $user_group_name = S_ALL_S;
        if ($script['usrgrpid'] > 0) {
            $user_group = get_group_by_usrgrpid($script['usrgrpid']);
            $user_group_name = $user_group['name'];
        }
        $host_group_name = S_ALL_S;
        if ($script['groupid'] > 0) {
            $group = get_hostgroup_by_groupid($script['groupid']);
            $host_group_name = $group['name'];
        }
        $table->addRow(array(new CCheckBox('scripts[' . $script['scriptid'] . ']', 'no', NULL, $script['scriptid']), new CLink($script['name'], 'scripts.php?form=1' . '&scriptid=' . $script['scriptid'] . '#form'), htmlspecialchars($script['command']), $user_group_name, $host_group_name, PERM_READ_WRITE == $script['host_access'] ? S_WRITE : S_READ));
        $row_count++;
Exemple #5
0
 } else {
     if ($config['dropdown_first_entry'] == ZBX_DROPDOWN_FIRST_ALL) {
         $sqls[] = 'SELECT m.* ' . ' FROM maintenances m ' . ' WHERE ' . DBin_node('m.maintenanceid') . ' AND ' . DBcondition('m.maintenanceid', $available_maintenances) . ' ORDER BY m.name';
     }
 }
 foreach ($sqls as $num => $sql) {
     $db_maintenances = DBselect($sql);
     while ($maintenance = DBfetch($db_maintenances)) {
         $maintenances[$maintenance['maintenanceid']] = $maintenance;
         $maintenanceids[$maintenance['maintenanceid']] = $maintenance['maintenanceid'];
     }
 }
 $form = new CForm(null, 'post');
 $form->setName('maintenances');
 $table = new CTableInfo();
 $table->setHeader(array(new CCheckBox('all_maintenances', NULL, "checkAll('" . $form->GetName() . "','all_maintenances','maintenanceids');"), make_sorting_link(S_NAME, 'm.name'), S_TYPE, S_STATUS, S_DESCRIPTION));
 foreach ($maintenances as $maintenanceid => $maintenance) {
     if ($maintenance['active_till'] < time()) {
         $mnt_status = new CSpan(S_EXPIRED, 'red');
     } else {
         $mnt_status = new CSpan(S_ACTIVE, 'green');
     }
     $table->addRow(array(new CCheckBox('maintenanceids[' . $maintenance['maintenanceid'] . ']', NULL, NULL, $maintenance['maintenanceid']), new CLink($maintenance['name'], 'maintenance.php?form=update&maintenanceid=' . $maintenance['maintenanceid'] . '#form'), $maintenance['maintenance_type'] ? S_NO_DATA_PROCESSING : S_NORMAL_PROCESSING, $mnt_status, $maintenance['description']));
     $row_count++;
 }
 //			$table->setFooter(new CCol(new CButtonQMessage('delete_selected',S_DELETE_SELECTED,S_DELETE_SELECTED_USERS_Q)));
 $goBox = new CComboBox('go');
 $goBox->addItem('delete', S_DELETE_SELECTED);
 // goButton name is necessary!!!
 $goButton = new CButton('goButton', S_GO . ' (0)');
 $goButton->setAttribute('id', 'goButton');
Exemple #6
0
    $sql_cond .= ' AND a.userid=' . $_REQUEST['userid'] . ' ';
}
if ($_REQUEST['action'] > -1 && $config == 0) {
    $sql_cond .= ' AND a.action=' . $_REQUEST['action'] . ' ';
}
if ($_REQUEST['resourcetype'] > -1 && $config == 0) {
    $sql_cond .= ' AND a.resourcetype=' . $_REQUEST['resourcetype'] . ' ';
}
$sql_cond .= ' AND a.clock>1000000000 AND a.clock<' . $time_end;
if (0 == $config) {
    $count = 0;
    $last_clock = null;
    $actions = array();
    $clock = array();
    $table = new CTableInfo();
    $table->setHeader(array(make_sorting_link(S_TIME, 'clock'), make_sorting_link(S_USER, 'alias'), make_sorting_link(S_IP, 'ip'), make_sorting_link(S_RESOURCE, 'resourcetype'), make_sorting_link(S_ACTION, 'action'), S_ID, S_DESCRIPTION, S_DETAILS));
    $sql = 'SELECT a.auditid,a.clock,u.alias,a.ip,a.resourcetype,a.action,a.resourceid,a.resourcename,a.details ' . ' FROM auditlog a, users u ' . ' WHERE u.userid=a.userid ' . $sql_cond . ' AND ' . DBin_node('u.userid', get_current_nodeid(null, PERM_READ_ONLY)) . ' ORDER BY a.clock DESC';
    $result = DBselect($sql, $limit);
    while ($row = DBfetch($result)) {
        switch ($row['action']) {
            case AUDIT_ACTION_ADD:
                $action = S_ADDED;
                break;
            case AUDIT_ACTION_UPDATE:
                $action = S_UPDATED;
                break;
            case AUDIT_ACTION_DELETE:
                $action = S_DELETED;
                break;
            case AUDIT_ACTION_LOGIN:
                $action = S_LOGIN;
Exemple #7
0
 $form->setMethod('get');
 $cmbSource = new CComboBox('eventsource', $_REQUEST['eventsource'], 'submit()');
 $cmbSource->addItem(EVENT_SOURCE_TRIGGERS, S_TRIGGERS);
 $cmbSource->addItem(EVENT_SOURCE_DISCOVERY, S_DISCOVERY);
 $form->addItem(array(S_EVENT_SOURCE, SPACE, $cmbSource));
 $row_count = 0;
 $numrows = new CSpan(null, 'info');
 $numrows->setAttribute('name', 'numrows');
 $header = get_table_header(array(S_ACTIONS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
 show_table_header($header, $form);
 unset($form, $cmbSource);
 /* table */
 $form = new CForm();
 $form->setName('actions');
 $tblActions = new CTableInfo(S_NO_ACTIONS_DEFINED);
 $tblActions->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $form->getName() . "','all_items','g_actionid');"), make_sorting_link(S_NAME, 'a.name'), S_CONDITIONS, S_OPERATIONS, make_sorting_link(S_STATUS, 'a.status')));
 $db_actions = DBselect('SELECT a.* ' . ' FROM actions a' . ' WHERE a.eventsource=' . $_REQUEST['eventsource'] . ' AND ' . DBin_node('actionid') . order_by('a.name,a.status', 'a.actionid'));
 while ($action_data = DBfetch($db_actions)) {
     if (!action_accessible($action_data['actionid'], PERM_READ_WRITE)) {
         continue;
     }
     $conditions = array();
     $db_conditions = DBselect('select * from conditions where actionid=' . $action_data['actionid'] . ' order by conditiontype,conditionid');
     while ($condition_data = DBfetch($db_conditions)) {
         array_push($conditions, array(get_condition_desc($condition_data['conditiontype'], $condition_data['operator'], $condition_data['value']), BR()));
     }
     unset($db_conditions, $condition_data);
     $operations = array();
     $db_operations = DBselect('select * from operations where actionid=' . $action_data['actionid'] . ' order by operationtype,operationid');
     while ($operation_data = DBfetch($db_operations)) {
         array_push($operations, array(get_operation_desc(SHORT_DESCRITION, $operation_data), BR()));
Exemple #8
0
$frmForm->addItem(SPACE . '|' . SPACE);
$frmForm->addItem($btnNew = new CButton('form', S_CREATE_USER));
show_table_header(S_CONFIGURATION_OF_USERS_AND_USER_GROUPS, $frmForm);
echo SBR;
$row_count = 0;
if (isset($_REQUEST['form'])) {
    insert_user_form(get_request('userid', null));
} else {
    $form = new CForm(null, 'post');
    $form->setName('users');
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_USERS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_USERS_DEFINED);
    $table->setHeader(array(new CCheckBox('all_users', NULL, "checkAll('" . $form->GetName() . "','all_users','group_userid');"), make_sorting_link(S_ALIAS, 'u.alias'), make_sorting_link(S_NAME, 'u.name'), make_sorting_link(S_SURNAME, 'u.surname'), make_sorting_link(S_USER_TYPE, 'u.type'), S_GROUPS, S_IS_ONLINE_Q, S_GUI_ACCESS, S_API_ACCESS, S_DEBUG_MODE, S_STATUS));
    $cond_from = '';
    $cond_where = '';
    if ($_REQUEST['filter_usrgrpid'] > 0) {
        $cond_from = ', users_groups ug, usrgrp ugrp ';
        $cond_where = ' AND ug.userid = u.userid ' . ' AND ug.usrgrpid=' . $_REQUEST['filter_usrgrpid'];
    }
    $users = array();
    $userids = array();
    $db_users = DBselect('SELECT DISTINCT u.userid,u.alias,u.name,u.surname,u.type,u.autologout ' . ' FROM users u ' . $cond_from . ' WHERE ' . DBin_node('u.userid') . $cond_where . order_by('u.alias,u.name,u.surname,u.type', 'u.userid'));
    while ($db_user = DBfetch($db_users)) {
        $users[$db_user['userid']] = $db_user;
        $userids[$db_user['userid']] = $db_user['userid'];
    }
    $users_sessions = array();
    $sql = 'SELECT s.userid, MAX(s.lastaccess) as lastaccess, s.status ' . ' FROM sessions s, users u' . ' WHERE ' . DBcondition('s.userid', $userids) . ' AND s.userid=u.userid ' . ' GROUP BY s.userid,s.status';
Exemple #9
0
    }
} else {
    $table = new CTableInfo();
    if ($prof_type) {
        $table->setHeader(array(is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, make_sorting_link(S_HOST, 'h.host'), $_REQUEST['groupid'] > 0 ? null : make_sorting_link(S_GROUP, 'g.name'), make_sorting_link(S_DEVICE_OS_SHORT, 'hpe.device_os_short'), make_sorting_link(S_DEVICE_HW_ARCH, 'hpe.device_hw_arch'), make_sorting_link(S_DEVICE_TYPE, 'hpe.device_type'), make_sorting_link(S_DEVICE_STATUS, 'hpe.device_status')));
        $sql_where = '';
        if ($_REQUEST['groupid'] > 0) {
            $sql_where = ' AND hg.groupid=' . $_REQUEST['groupid'];
        }
        $sql = 'SELECT DISTINCT g.name, h.hostid,h.host,hpe.device_os_short,hpe.device_hw_arch,hpe.device_type,hpe.device_status' . ' FROM hosts h,hosts_profiles_ext hpe,hosts_groups hg,groups g ' . ' WHERE h.hostid=hpe.hostid ' . ' AND h.hostid=hg.hostid ' . ' AND g.groupid=hg.groupid ' . ' AND ' . DBcondition('h.hostid', $PAGE_HOSTS['hostids']) . $sql_where . order_by('h.host,h.hostid,g.name,hpe.device_os_short,hpe.device_hw_arch,hpe.device_type,hpe.device_status');
        $result = DBselect($sql);
        while ($row = DBfetch($result)) {
            $table->AddRow(array(get_node_name_by_elid($row['hostid']), new CLink($row["host"], "?hostid=" . $row["hostid"] . url_param("groupid") . '&prof_type=' . $prof_type, "action"), $_REQUEST["groupid"] > 0 ? null : $row["name"], $row["device_os_short"], $row["device_hw_arch"], $row["device_type"], $row["device_status"]));
        }
    } else {
        $table->setHeader(array(is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, make_sorting_link(S_HOST, 'h.host'), make_sorting_link(S_NAME, 'p.name'), make_sorting_link(S_OS, 'p.os'), make_sorting_link(S_SERIALNO, 'p.serialno'), make_sorting_link(S_TAG, 'p.tag'), make_sorting_link(S_MACADDRESS, 'p.macaddress')));
        $sql_from = '';
        $sql_where = '';
        if ($_REQUEST['groupid'] > 0) {
            $sql_from = ', hosts_groups hg ';
            $sql_where = ' and h.hostid=hg.hostid AND hg.groupid=' . $_REQUEST['groupid'];
        }
        $sql = 'SELECT h.hostid,h.host,p.name,p.os,p.serialno,p.tag,p.macaddress' . ' FROM hosts h,hosts_profiles p ' . $sql_from . ' WHERE h.hostid=p.hostid' . ' and ' . DBcondition('h.hostid', $PAGE_HOSTS['hostids']) . $sql_where . order_by('h.host,h.hostid,p.name,p.os,p.serialno,p.tag,p.macaddress');
        $result = DBselect($sql);
        while ($row = DBfetch($result)) {
            $table->AddRow(array(get_node_name_by_elid($row['hostid']), new CLink($row["host"], '?hostid=' . $row['hostid'] . url_param('groupid') . '&prof_type=' . $prof_type, "action"), $row["name"], $row["os"], $row["serialno"], $row["tag"], $row["macaddress"]));
        }
    }
    $table->show();
}
include_once "include/page_footer.php";
Exemple #10
0
 foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
     $cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
 }
 $r_form->addItem(array(S_GROUP . SPACE, $cmbGroups));
 $r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
 $row_count = 0;
 $numrows = new CSpan(null, 'info');
 $numrows->addOption('name', 'numrows');
 $header = get_table_header(array(S_GRAPHS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
 show_table_header($header, $r_form);
 /* TABLE */
 $form = new CForm();
 $form->setName('graphs');
 $form->addVar('hostid', $_REQUEST['hostid']);
 $table = new CTableInfo(S_NO_GRAPHS_DEFINED);
 $table->setHeader(array($_REQUEST['hostid'] != 0 ? NULL : S_HOSTS, array(new CCheckBox('all_graphs', NULL, "CheckAll('" . $form->GetName() . "','all_graphs');"), make_sorting_link(S_NAME, 'g.name')), make_sorting_link(S_WIDTH, 'g.width'), make_sorting_link(S_HEIGHT, 'g.height'), make_sorting_link(S_GRAPH_TYPE, 'g.graphtype')));
 $sql_from = '';
 $sql_where = '';
 if ($PAGE_HOSTS['selected'] > 0) {
     $sql_where .= ' AND i.hostid=' . $PAGE_HOSTS['selected'];
 }
 $sql = 'SELECT DISTINCT g.* ' . ' FROM graphs g, graphs_items gi,items i ' . $sql_from . ' WHERE ' . DBcondition('g.graphid', $available_graphs) . ' AND gi.graphid=g.graphid ' . ' AND i.itemid=gi.itemid ' . $sql_where . order_by('g.name,g.width,g.height,g.graphtype', 'g.graphid');
 $result = DBselect($sql);
 while ($row = DBfetch($result)) {
     if ($_REQUEST['hostid'] != 0) {
         $host_list = NULL;
     } else {
         $host_list = array();
         $db_hosts = get_hosts_by_graphid($row['graphid']);
         while ($db_host = DBfetch($db_hosts)) {
             array_push($host_list, $db_host['host']);
Exemple #11
0
$r_form->addItem(array(S_DISCOVERY_RULE . SPACE, $cmbDRules));
$dscvry_wdgt->addHeader(SPACE, $r_form);
//-------------
$services = array();
$sql_where = '';
if ($druleid > 0) {
    $sql_where = ' AND h.druleid=' . $druleid;
}
$sql = 'SELECT s.type,s.port,s.key_ ' . ' FROM dservices s,dhosts h,drules r ' . ' WHERE s.dhostid=h.dhostid' . ' AND h.druleid=r.druleid' . ' AND r.status=' . DRULE_STATUS_ACTIVE . $sql_where . ' AND ' . DBin_node('s.dserviceid');
$db_dservices = DBselect($sql);
while ($dservice = DBfetch($db_dservices)) {
    $service_name = discovery_check_type2str($dservice['type']) . discovery_port2str($dservice['type'], $dservice['port']) . (empty($dservice['key_']) ? '' : ':' . $dservice['key_']);
    $services[$service_name] = 1;
}
ksort($services);
$header = array(is_show_all_nodes() ? new CCol(S_NODE, 'center') : null, new CCol(make_sorting_link(S_DISCOVERED_DEVICE, 'ip'), 'center'), new CCol(S_MONITORED_HOST, 'center'), new CCol(array(S_UPTIME . '/', S_DOWNTIME), 'center'));
foreach ($services as $name => $foo) {
    $header[] = new CImg('vtext.php?text=' . $name);
}
$table = new CTableInfo();
$table->setHeader($header, 'vertical_header');
$sql_where = '';
if ($druleid > 0) {
    $sql_where = ' AND druleid=' . $druleid;
}
$sql = 'SELECT DISTINCT druleid,proxy_hostid,name ' . ' FROM drules ' . ' WHERE ' . DBin_node('druleid') . $sql_where . ' AND status=' . DRULE_STATUS_ACTIVE . ' ORDER BY name';
$db_drules = DBselect($sql);
while ($drule = DBfetch($db_drules)) {
    $discovery_info = array();
    $db_dhosts = DBselect('SELECT dh.dhostid,dh.druleid,dh.ip,dh.status,dh.lastup,dh.lastdown,h.host' . ' FROM dhosts dh' . ' LEFT JOIN hosts h ON h.ip=dh.ip and h.proxy_hostid=' . $drule['proxy_hostid'] . ' WHERE ' . DBin_node('dh.dhostid') . ' AND dh.druleid=' . $drule['druleid'] . order_by('dh.ip', 'dh.dhostid,dh.status'));
    while ($dhost = DBfetch($db_dhosts)) {
Exemple #12
0
 $frmForm->addVar('config', $_REQUEST['config']);
 $cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
 foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
     $cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
 }
 $frmForm->addItem(array(S_GROUP . SPACE, $cmbGroups));
 $numrows = new CSpan(null, 'info');
 $numrows->setAttribute('name', 'numrows');
 $header = get_table_header(array(S_HOSTS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
 show_table_header($header, $frmForm);
 /* table HOSTS */
 $form = new CForm();
 $form->setName('hosts');
 $form->addVar('config', get_request('config', 0));
 $table = new CTableInfo(S_NO_HOSTS_DEFINED);
 $table->setHeader(array(new CCheckBox('all_hosts', NULL, "checkAll('" . $form->GetName() . "','all_hosts','hosts');"), make_sorting_link(S_NAME, 'h.host'), S_ITEMS, S_TRIGGERS, S_GRAPHS, make_sorting_link(S_DNS, 'h.dns'), make_sorting_link(S_IP, 'h.ip'), make_sorting_link(S_PORT, 'h.port'), S_TEMPLATES, make_sorting_link(S_STATUS, 'h.status'), make_sorting_link(S_AVAILABILITY, 'h.available'), S_ERROR));
 $options = array('hostids' => $PAGE_HOSTS['hostids'], 'extendoutput' => 1, 'select_templates' => 1, 'select_items' => 1, 'select_triggers' => 1, 'select_graphs' => 1, 'editable' => 1, 'order' => 'host');
 if ($_REQUEST['groupid'] > 0) {
     $options['groupids'] = $PAGE_GROUPS['selected'];
 }
 $hosts = Chost::get($options);
 foreach ($hosts as $hostid => $row) {
     $description = array();
     $items = array(new CLink(S_ITEMS, 'items.php?groupid=' . $PAGE_GROUPS['selected'] . '&hostid=' . $row['hostid']), ' (' . count($row['itemids']) . ')');
     $triggers = array(new CLink(S_TRIGGERS, 'triggers.php?groupid=' . $PAGE_GROUPS['selected'] . '&hostid=' . $row['hostid']), ' (' . count($row['triggerids']) . ')');
     $graphs = array(new CLink(S_GRAPHS, 'graphs.php?groupid=' . $PAGE_GROUPS['selected'] . '&hostid=' . $row['hostid']), ' (' . count($row['graphids']) . ')');
     if ($row['proxy_hostid']) {
         $proxy = get_host_by_hostid($row['proxy_hostid']);
         array_push($description, $proxy['host'], ':');
     }
     array_push($description, new CLink($row['host'], 'hosts.php?form=update&hostid=' . $row['hostid'] . url_param('groupid')));
Exemple #13
0
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
$httpmon_wdgt->addHeader(SPACE, $r_form);
//	show_table_header(S_STATUS_OF_WEB_MONITORING_BIG, $r_form);
//-----------------
// TABLE
$form = new CForm();
$form->setMethod('get');
$form->setName('scenarios');
$form->addVar('hostid', $_REQUEST['hostid']);
if (isset($show_all_apps)) {
    $link = new CLink(new CImg('images/general/opened.gif'), '?close=1' . url_param('groupid') . url_param('hostid'));
} else {
    $link = new CLink(new CImg('images/general/closed.gif'), '?open=1' . url_param('groupid') . url_param('hostid'));
}
$table = new CTableInfo();
$table->SetHeader(array(is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, $_REQUEST['hostid'] == 0 ? make_sorting_link(S_HOST, 'h.host') : NULL, array($link, SPACE, make_sorting_link(S_NAME, 'wt.name')), S_NUMBER_OF_STEPS, S_STATE, S_LAST_CHECK, S_STATUS));
$any_app_exist = false;
$db_apps = array();
$db_appids = array();
$sql_where = '';
if ($_REQUEST['hostid'] > 0) {
    $sql_where = ' AND h.hostid=' . $_REQUEST['hostid'];
}
$sql = 'SELECT DISTINCT h.host,h.hostid,a.* ' . ' FROM applications a,hosts h ' . ' WHERE a.hostid=h.hostid ' . $sql_where . ' AND ' . DBcondition('h.hostid', $available_hosts) . order_by('a.applicationid,h.host,h.hostid', 'a.name');
//SDI($sql);
$db_app_res = DBselect($sql);
while ($db_app = DBfetch($db_app_res)) {
    $db_app['scenarios_cnt'] = 0;
    $db_apps[$db_app['applicationid']] = $db_app;
    $db_appids[$db_app['applicationid']] = $db_app['applicationid'];
}
Exemple #14
0
    $cmbTimeZone = new CComboBox('timezone', $timezone);
    for ($i = -12; $i <= 13; $i++) {
        $cmbTimeZone->addItem($i, 'GMT' . sprintf('%+03d:00', $i));
    }
    $frmNode->addRow(S_TIME_ZONE, $cmbTimeZone);
    $frmNode->addRow(S_IP, new CTextBox('ip', $ip, 15));
    $frmNode->addRow(S_PORT, new CNumericBox('port', $port, 5));
    $frmNode->addRow(S_DO_NOT_KEEP_HISTORY_OLDER_THAN, new CNumericBox('slave_history', $slave_history, 6));
    $frmNode->addRow(S_DO_NOT_KEEP_TRENDS_OLDER_THAN, new CNumericBox('slave_trends', $slave_trends, 6));
    $frmNode->addItemToBottomRow(new CButton('save', S_SAVE));
    if (isset($_REQUEST['nodeid']) && $node_type != ZBX_NODE_LOCAL) {
        $frmNode->addItemToBottomRow(SPACE);
        $frmNode->addItemToBottomRow(new CButtonDelete('Delete selected node?', url_param('form') . url_param('nodeid')));
    }
    $frmNode->addItemToBottomRow(SPACE);
    $frmNode->addItemToBottomRow(new CButtonCancel(url_param('config')));
    $frmNode->Show();
} else {
    show_table_header(S_NODES_BIG);
    $table = new CTableInfo(S_NO_NODES_DEFINED);
    $table->SetHeader(array(make_sorting_link(S_ID, 'n.nodeid'), make_sorting_link(S_NAME, 'n.name'), make_sorting_link(S_TYPE, 'n.nodetype'), make_sorting_link(S_TIME_ZONE, 'n.timezone'), make_sorting_link(S_IP . ':' . S_PORT, 'n.ip')));
    $sql = 'SELECT n.* ' . ' FROM nodes n' . ' WHERE ' . DBcondition('n.nodeid', $available_nodes) . order_by('n.nodeid,n.name,n.nodetype,n.timezone,n.ip', 'n.masterid');
    $db_nodes = DBselect($sql);
    while ($row = DBfetch($db_nodes)) {
        $node_type = detect_node_type($row);
        $node_type_name = node_type2str($node_type);
        $table->AddRow(array($row['nodeid'], array(get_node_path($row['masterid']), new CLink($row['nodetype'] ? new CSpan($row['name'], 'bold') : $row['name'], '?&form=update&nodeid=' . $row['nodeid'], 'action')), $node_type == ZBX_NODE_LOCAL ? new CSpan($node_type_name, 'bold') : $node_type_name, new CSpan('GMT' . sprintf('%+03d:00', $row['timezone']), $row['nodetype'] ? 'bold' : null), new CSpan($row['ip'] . ':' . $row['port'], $row['nodetype'] ? 'bold' : null)));
    }
    $table->Show();
}
include_once 'include/page_footer.php';
Exemple #15
0
     $rowz['items'] = array();
     $triggers[$rowz['triggerid']] = $rowz;
     $triggerids[$rowz['triggerid']] = $rowz['triggerid'];
 }
 $sql = 'SELECT f.triggerid, i.* ' . ' FROM functions f, items i ' . ' WHERE ' . DBcondition('f.triggerid', $triggerids) . ' AND i.itemid=f.itemid';
 $result = DBselect($sql);
 while ($row = DBfetch($result)) {
     $item['itemid'] = $row['itemid'];
     $item['action'] = str_in_array($row['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues';
     $item['description'] = item_description($row);
     $triggers[$row['triggerid']]['items'][$row['itemid']] = $item;
 }
 $sql_cond = $show_unknown == 0 ? ' AND e.value<>' . TRIGGER_VALUE_UNKNOWN . ' ' : '';
 $sql_cond .= ' AND e.clock<' . $time_end;
 $table = new CTableInfo(S_NO_EVENTS_FOUND);
 $table->setHeader(array(make_sorting_link(S_TIME, 'clock'), is_show_all_nodes() ? S_NODE : null, $_REQUEST['hostid'] == 0 ? S_HOST : null, make_sorting_link(S_DESCRIPTION, 'desc'), make_sorting_link(S_STATUS, 'status'), make_sorting_link(S_SEVERITY, 'priority'), S_DURATION, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
 if (!empty($triggers)) {
     $clock = array();
     $events = array();
     $sql = 'SELECT e.eventid, e.objectid as triggerid, e.clock, e.value, e.acknowledged ' . ' FROM events e ' . ' WHERE ' . DBcondition('e.objectid', $triggerids) . ' AND (e.object+0)=' . EVENT_OBJECT_TRIGGER . $sql_cond . ' ORDER BY e.clock DESC';
     $result = DBselect($sql, 0 == $show_unknown ? $limit * 50 : $limit);
     while (($row = DBfetch($result)) && $col < $limit) {
         $row = array_merge($triggers[$row['triggerid']], $row);
         if (0 == $show_unknown && !event_initial_time($row, $show_unknown)) {
             continue;
         }
         $row['desc'] = expand_trigger_description_by_data($row, ZBX_FLAG_EVENT);
         $row['duration'] = zbx_date2age($row['clock']);
         if ($next_event = get_next_event($row, $show_unknown)) {
             $row['duration'] = zbx_date2age($row['clock'], $next_event['clock']);
         }
Exemple #16
0
                 $available = new CSpan(S_UNKNOWN, 'unknown');
             }
         }
     }
     $tbl_header_host = new CTableInfo();
     $tbl_header_host->addRow(array(new CLink(bold(S_HOST_LIST), 'hosts.php?hostid=' . $header_host['hostid'] . url_param('groupid')), $description, $items, $graphs, array(bold(S_DNS . ': '), $dns), array(bold(S_IP . ': '), $ip), array(bold(S_PORT . ': '), $port), array(bold(S_STATUS . ': '), $status), array(bold(S_AVAILABILITY . ': '), $available)));
     $tbl_header_host->setClass('infobox');
     $tbl_header_host->show();
 }
 // --->>> SELECTED HOST HEADER INFORMATION <<<---
 $form = new CForm('triggers.php');
 $form->setName('triggers');
 $form->setMethod('post');
 $form->addVar('hostid', $_REQUEST['hostid']);
 $table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
 $table->setHeader(array(new CCheckBox('all_triggers', NULL, "checkAll('" . $form->GetName() . "','all_triggers','g_triggerid');"), make_sorting_link(S_SEVERITY, 't.priority'), make_sorting_link(S_STATUS, 't.status'), $_REQUEST['hostid'] > 0 ? NULL : make_sorting_link(S_HOST, 'h.host'), make_sorting_link(S_NAME, 't.description'), S_EXPRESSION, S_ERROR));
 $options = array('select_hosts' => 1, 'editable' => 1, 'extendoutput' => 1);
 if ($showdisabled == 0) {
     $options += array('status' => TRIGGER_STATUS_ENABLED);
 }
 if ($PAGE_HOSTS['selected'] > 0) {
     $options += array('hostids' => $PAGE_HOSTS['selected']);
 } else {
     if ($PAGE_GROUPS['selected'] > 0) {
         $options += array('groupids' => $PAGE_GROUPS['selected']);
     }
 }
 $triggers = CTrigger::get($options);
 foreach ($triggers as $triggerid => $trigger) {
     $description = array();
     if ($trigger['templateid'] > 0) {
Exemple #17
0
 $form->SetMethod('get');
 $cmbSource = new CComboBox('eventsource', $_REQUEST['eventsource'], 'submit()');
 $cmbSource->addItem(EVENT_SOURCE_TRIGGERS, S_TRIGGERS);
 $cmbSource->addItem(EVENT_SOURCE_DISCOVERY, S_DISCOVERY);
 $form->addItem(array(S_EVENT_SOURCE, SPACE, $cmbSource));
 $row_count = 0;
 $numrows = new CSpan(null, 'info');
 $numrows->addOption('name', 'numrows');
 $header = get_table_header(array(S_ACTIONS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
 show_table_header($header, $form);
 unset($form, $cmbSource);
 /* table */
 $form = new CForm();
 $form->SetName('actions');
 $tblActions = new CTableInfo(S_NO_ACTIONS_DEFINED);
 $tblActions->SetHeader(array(array(new CCheckBox('all_items', null, 'CheckAll("' . $form->GetName() . '","all_items");'), make_sorting_link(S_NAME, 'a.name')), S_CONDITIONS, S_OPERATIONS, make_sorting_link(S_STATUS, 'a.status')));
 $db_actions = DBselect('SELECT a.* ' . ' FROM actions a' . ' WHERE a.eventsource=' . $_REQUEST['eventsource'] . ' AND ' . DBin_node('actionid') . order_by('a.name,a.status', 'a.actionid'));
 while ($action_data = DBfetch($db_actions)) {
     if (!action_accessible($action_data['actionid'], PERM_READ_WRITE)) {
         continue;
     }
     $conditions = array();
     $db_conditions = DBselect('select * from conditions where actionid=' . $action_data['actionid'] . ' order by conditiontype,conditionid');
     while ($condition_data = DBfetch($db_conditions)) {
         array_push($conditions, array(get_condition_desc($condition_data['conditiontype'], $condition_data['operator'], $condition_data['value']), BR()));
     }
     unset($db_conditions, $condition_data);
     $operations = array();
     $db_operations = DBselect('select * from operations where actionid=' . $action_data['actionid'] . ' order by operationtype,operationid');
     while ($operation_data = DBfetch($db_operations)) {
         array_push($operations, array(get_operation_desc(SHORT_DESCRITION, $operation_data), BR()));
Exemple #18
0
 }
 $form->addItem(array(S_GROUP . SPACE, $cmbGroups));
 $form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
 show_table_header(S_SCENARIOS_BIG, $form);
 // TABLE
 $form = new CForm();
 $form->setMethod('get');
 $form->setName('scenarios');
 $form->addVar('hostid', $_REQUEST['hostid']);
 if (isset($show_all_apps)) {
     $link = new CLink(new CImg('images/general/opened.gif'), '?close=1' . url_param('groupid') . url_param('hostid'));
 } else {
     $link = new CLink(new CImg('images/general/closed.gif'), '?open=1' . url_param('groupid') . url_param('hostid'));
 }
 $table = new CTableInfo();
 $table->setHeader(array(new CCheckBox('all_httptests', null, "checkAll('" . $form->getName() . "','all_httptests','group_httptestid');"), is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, $_REQUEST['hostid'] == 0 ? make_sorting_link(S_HOST, 'h.host') : NULL, array($link, SPACE, make_sorting_link(S_NAME, 'wt.name')), S_NUMBER_OF_STEPS, S_UPDATE_INTERVAL, make_sorting_link(S_STATUS, 'wt.status')));
 $any_app_exist = false;
 $db_apps = array();
 $db_appids = array();
 $sql_where = '';
 if ($_REQUEST['hostid'] > 0) {
     $sql_where = ' AND h.hostid=' . $_REQUEST['hostid'];
 }
 $sql = 'SELECT DISTINCT h.host,h.hostid,a.* ' . ' FROM applications a,hosts h ' . ' WHERE a.hostid=h.hostid ' . $sql_where . ' AND ' . DBcondition('h.hostid', $available_hosts) . order_by('a.applicationid,h.host,h.hostid', 'a.name');
 //SDI($sql);
 $db_app_res = DBselect($sql);
 while ($db_app = DBfetch($db_app_res)) {
     $db_app['scenarios_cnt'] = 0;
     $db_apps[$db_app['applicationid']] = $db_app;
     $db_appids[$db_app['applicationid']] = $db_app['applicationid'];
 }
Exemple #19
0
$form->SetMethod('get');
if (!isset($_REQUEST["form"])) {
    $form->AddItem(new CButton('form', S_CREATE_RULE));
}
show_table_header(S_CONFIGURATION_OF_DISCOVERY_BIG, $form);
echo SBR;
if (isset($_REQUEST["form"])) {
    /* form */
    insert_drule_form();
} else {
    show_table_header(S_DISCOVERY_BIG);
    /* table */
    $form = new CForm();
    $form->SetName('frmdrules');
    $tblDiscovery = new CTableInfo(S_NO_DISCOVERY_RULES_DEFINED);
    $tblDiscovery->SetHeader(array(array(new CCheckBox('all_drules', null, "CheckAll('" . $form->GetName() . "','all_drules');"), make_sorting_link(S_NAME, 'd.name')), make_sorting_link(S_IP_RANGE, 'd.iprange'), make_sorting_link(S_DELAY, 'd.delay'), S_CHECKS, S_STATUS));
    $db_rules = DBselect('SELECT d.* ' . ' FROM drules d' . ' WHERE ' . DBin_node('druleid') . order_by('d.name,d.iprange,d.delay', 'd.druleid'));
    while ($rule_data = DBfetch($db_rules)) {
        $cheks = array();
        $db_checks = DBselect("select * from dchecks where druleid=" . $rule_data["druleid"] . " order by type,druleid");
        while ($check_data = DBfetch($db_checks)) {
            $cheks[] = discovery_check_type2str($check_data['type']);
        }
        $status = new CCol(new CLink(discovery_status2str($rule_data["status"]), '?g_druleid%5B%5D=' . $rule_data['druleid'] . ($rule_data["status"] == DRULE_STATUS_ACTIVE ? '&group_disable=1' : '&group_enable=1'), discovery_status2style($rule_data["status"])));
        $description = array();
        if ($rule_data["proxy_hostid"]) {
            $proxy = get_host_by_hostid($rule_data["proxy_hostid"]);
            array_push($description, $proxy["host"], ":");
        }
        array_push($description, new CLink($rule_data['name'], "?form=update&druleid=" . $rule_data['druleid'], 'action'));
        $drule = new CCol(array(new CCheckBox('g_druleid[' . $rule_data["druleid"] . ']', null, null, $rule_data["druleid"]), SPACE, $description));
Exemple #20
0
        $table->setFooter(new CCol(array($goBox, $goButton)));
        $form->addItem($table);
        $form->show();
    }
} else {
    if (isset($_REQUEST["form"])) {
        insert_slideshow_form();
    } else {
        $form = new CForm();
        $form->setName('frm_shows');
        $numrows = new CSpan(null, 'info');
        $numrows->setAttribute('name', 'numrows');
        $header = get_table_header(array(S_SLIDESHOWS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
        show_table_header($header);
        $table = new CTableInfo(S_NO_SLIDESHOWS_DEFINED);
        $table->SetHeader(array(new CCheckBox('all_shows', NULL, "checkAll('" . $form->getName() . "','all_shows','shows');"), make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_DELAY, 's.delay'), make_sorting_link(S_COUNT_OF_SLIDES, 'cnt')));
        $db_slides = DBselect('SELECT s.slideshowid, s.name, s.delay, count(*) as cnt ' . ' FROM slideshows s ' . ' left join slides sl on sl.slideshowid=s.slideshowid ' . ' WHERE ' . DBin_node('s.slideshowid') . ' GROUP BY s.slideshowid,s.name,s.delay ' . order_by('s.name,s.delay,cnt', 's.slideshowid'));
        while ($slide_data = DBfetch($db_slides)) {
            if (!slideshow_accessible($slide_data['slideshowid'], PERM_READ_WRITE)) {
                continue;
            }
            $table->AddRow(array(new CCheckBox('shows[' . $slide_data['slideshowid'] . ']', NULL, NULL, $slide_data['slideshowid']), new CLink($slide_data['name'], '?config=1&form=update&slideshowid=' . $slide_data['slideshowid'], 'action'), $slide_data['delay'], $slide_data['cnt']));
        }
        //----- GO ------
        $goBox = new CComboBox('go');
        $goBox->addItem('delete', S_DELETE_SELECTED);
        // goButton name is necessary!!!
        $goButton = new CButton('goButton', S_GO . ' (0)');
        $goButton->setAttribute('id', 'goButton');
        zbx_add_post_js('chkbxRange.pageGoName = "shows";');
        $table->setFooter(new CCol(array($goBox, $goButton)));
Exemple #21
0
$filterForm->addItemToBottomRow($reset);
$trigg_wdgt->addFlicker($filterForm, get_profile('web.tr_status.filter.state', 0));
/*************** FILTER END ******************/
if ($_REQUEST['fullscreen']) {
    $triggerInfo = new CTriggersInfo();
    $triggerInfo->HideHeader();
    $triggerInfo->show();
}
$m_form = new CForm('acknow.php');
$m_form->setName('tr_status');
$admin_links = $USER_DETAILS['type'] == USER_TYPE_ZABBIX_ADMIN || $USER_DETAILS['type'] == USER_TYPE_SUPER_ADMIN;
$table = new CTableInfo();
$table->showStart();
$header = array();
$show_event_col = $config['event_ack_enable'] && $show_events != EVENTS_OPTION_NOEVENT;
$table->setHeader(array($show_event_col ? new CCheckBox('all_events', false, "checkAll('" . $m_form->GetName() . "','all_events','events');") : NULL, make_sorting_link(S_SEVERITY, 't.priority'), S_STATUS, make_sorting_link(S_LAST_CHANGE, 't.lastchange'), is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, $_REQUEST['hostid'] > 0 ? null : make_sorting_link(S_HOST, 'h.host'), make_sorting_link(S_NAME, 't.description'), $_REQUEST['show_actions'] ? S_ACTIONS : NULL, $show_event_col ? S_ACKNOWLEDGED : NULL, S_COMMENTS));
$cond = $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] . ' ' : '';
switch ($show_triggers) {
    case TRIGGERS_OPTION_ALL:
        $cond .= '';
        break;
    case TRIGGERS_OPTION_NOFALSEFORB:
        $cond .= '';
        break;
    case TRIGGERS_OPTION_ONLYTRUE:
    default:
        $cond .= ' AND ((t.value=' . TRIGGER_VALUE_TRUE . ') OR ((t.value=' . TRIGGER_VALUE_FALSE . ') AND ((' . time() . '-t.lastchange)<' . TRIGGER_FALSE_PERIOD . ')))';
        break;
}
if ($show_severity > -1) {
    $cond .= ' AND t.priority>=' . $show_severity;
Exemple #22
0
                continue;
            }
            $table->AddRow(array(new CLink($row["name"], "?config=0&form=update&screenid=" . $row["screenid"], 'action'), $row["hsize"] . " x " . $row["vsize"], new CLink(S_EDIT, "screenedit.php?screenid=" . $row["screenid"])));
            $row_count++;
        }
        $table->Show();
    }
} else {
    if (isset($_REQUEST["form"])) {
        insert_slideshow_form();
    } else {
        $row_count = 0;
        $numrows = new CSpan(null, 'info');
        $numrows->addOption('name', 'numrows');
        $header = get_table_header(array(S_SLIDESHOWS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
        show_table_header($header);
        $table = new CTableInfo(S_NO_SLIDESHOWS_DEFINED);
        $table->SetHeader(array(make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_DELAY, 's.delay'), make_sorting_link(S_COUNT_OF_SLIDES, 'cnt')));
        $db_slides = DBselect('SELECT s.slideshowid, s.name, s.delay, count(*) as cnt ' . ' FROM slideshows s ' . ' left join slides sl on sl.slideshowid=s.slideshowid ' . ' WHERE ' . DBin_node('s.slideshowid') . ' GROUP BY s.slideshowid,s.name,s.delay ' . order_by('s.name,s.delay,cnt', 's.slideshowid'));
        while ($slide_data = DBfetch($db_slides)) {
            if (!slideshow_accessible($slide_data['slideshowid'], PERM_READ_WRITE)) {
                continue;
            }
            $table->AddRow(array(new CLink($slide_data['name'], '?config=1&form=update&slideshowid=' . $slide_data['slideshowid'], 'action'), $slide_data['delay'], $slide_data['cnt']));
            $row_count++;
        }
        $table->Show();
    }
}
zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");');
include_once "include/page_footer.php";
Exemple #23
0
function get_action_msgs_for_event($eventid)
{
    $hostids = array();
    $sql = 'SELECT DISTINCT i.hostid ' . ' FROM events e, functions f, items i ' . ' WHERE e.eventid=' . $eventid . ' AND e.objectid=' . EVENT_SOURCE_TRIGGERS . ' AND f.triggerid=' . $_REQUEST['triggerid'] . ' AND i.itemid=f.itemid';
    if ($host = DBfetch(DBselect($sql, 1))) {
        $hostids[$host['hostid']] = $host['hostid'];
    }
    $available_triggers = get_accessible_triggers(PERM_READ_ONLY, $hostids);
    $table = new CTableInfo(S_NO_ACTIONS_FOUND);
    $table->SetHeader(array(is_show_subnodes() ? make_sorting_link(S_NODES, 'a.alertid') : null, make_sorting_link(S_TIME, 'a.clock'), make_sorting_link(S_TYPE, 'mt.description'), make_sorting_link(S_STATUS, 'a.status'), make_sorting_link(S_RETRIES_LEFT, 'a.retries'), make_sorting_link(S_RECIPIENTS, 'a.sendto'), S_MESSAGE, S_ERROR));
    $sql = 'SELECT DISTINCT a.alertid,a.clock,a.esc_step, mt.description,a.sendto,a.subject,a.message,a.status,a.retries,a.error ' . ' FROM events e,alerts a' . ' left join media_type mt on mt.mediatypeid=a.mediatypeid' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype=' . ALERT_TYPE_MESSAGE . ' AND e.eventid = a.eventid' . ' AND ' . DBcondition('e.objectid', $available_triggers) . ' AND ' . DBin_node('a.alertid') . order_by('a.clock,a.alertid,mt.description,a.sendto,a.status,a.retries');
    $result = DBselect($sql);
    while ($row = DBfetch($result)) {
        $time = date("Y.M.d H:i:s", $row["clock"]);
        if ($row['esc_step'] > 0) {
            $time = array(bold(S_STEP . ': '), $row["esc_step"], br(), bold(S_TIME . ': '), br(), $time);
        }
        if ($row["status"] == ALERT_STATUS_SENT) {
            $status = new CSpan(S_SENT, "green");
            $retries = new CSpan(SPACE, "green");
        } else {
            if ($row["status"] == ALERT_STATUS_NOT_SENT) {
                $status = new CSpan(S_IN_PROGRESS, "orange");
                $retries = new CSpan(ALERT_MAX_RETRIES - $row["retries"], "orange");
            } else {
                $status = new CSpan(S_NOT_SENT, "red");
                $retries = new CSpan(0, "red");
            }
        }
        $sendto = $row["sendto"];
        $message = array(bold(S_SUBJECT . ':'), br(), $row["subject"], br(), br(), bold(S_MESSAGE . ':'));
        $msg = explode("\n", $row['message']);
        foreach ($msg as $m) {
            array_push($message, BR(), $m);
        }
        if (empty($row["error"])) {
            $error = new CSpan(SPACE, "off");
        } else {
            $error = new CSpan($row["error"], "on");
        }
        $table->addRow(array(get_node_name_by_elid($row['alertid']), new CCol($time, 'top'), new CCol($row["description"], 'top'), new CCol($status, 'top'), new CCol($retries, 'top'), new CCol($sendto, 'top'), new CCol($message, 'wraptext top'), new CCol($error, 'wraptext top')));
    }
    return $table;
}
Exemple #24
0
     $table->setFooter(new CCol($form));
     $table->showEnd();
 } else {
     /* table HOSTS */
     $form = new CForm(null, 'post');
     $form->SetName('hosts');
     $form->AddVar('config', $config);
     $form->AddVar('update', true);
     $cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
     foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
         $cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
     }
     $header = get_table_header(S_HOSTS_BIG, array(S_GROUP . SPACE, $cmbGroups));
     $form->addItem($header);
     $table = new CTableInfo(S_NO_HOSTS_DEFINED);
     $table->setHeader(array(array(new CCheckBox("all_hosts", true, "CheckAll('" . $form->GetName() . "','all_hosts','hosts');"), make_sorting_link(S_NAME, 'h.host')), make_sorting_link(S_DNS, 'h.dns'), make_sorting_link(S_IP, 'h.ip'), make_sorting_link(S_PORT, 'h.port'), make_sorting_link(S_STATUS, 'h.status'), array(new CCheckBox("all_templates", true, "CheckAll('" . $form->GetName() . "','all_templates','templates');"), S_TEMPLATES), array(new CCheckBox("all_items", true, "CheckAll('" . $form->GetName() . "','all_items','items');"), S_ITEMS), array(new CCheckBox("all_triggers", true, "CheckAll('" . $form->GetName() . "','all_triggers','triggers');"), S_TRIGGERS), array(new CCheckBox("all_graphs", true, "CheckAll('" . $form->GetName() . "','all_graphs','graphs');"), S_GRAPHS)));
     $sql_from = '';
     $sql_where = '';
     if ($_REQUEST['groupid'] > 0) {
         $sql_from .= ' ,hosts_groups hg ';
         $sql_where .= ' AND hg.groupid=' . $_REQUEST['groupid'] . ' AND hg.hostid=h.hostid ';
     }
     $hosts = array();
     $hostids = array();
     $sql = 'SELECT DISTINCT h.* ' . ' FROM hosts h ' . $sql_from . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . $sql_where . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ',' . HOST_STATUS_TEMPLATE . ')' . order_by('h.host,h.dns,h.ip,h.port,h.status');
     $result = DBselect($sql);
     while ($host = DBfetch($result)) {
         $hosts[$host['hostid']] = $host;
         $hostids[$host['hostid']] = $host['hostid'];
     }
     // templates
Exemple #25
0
        $jsmenu->InsertJavaScript();
        set_users_jsmenu_array();
    }
} else {
    if ($_REQUEST['config'] == 1) {
        // USER GROUPS
        if (isset($_REQUEST['form'])) {
            insert_usergroups_form();
        } else {
            $numrows = new CSpan(null, 'info');
            $numrows->addOption('name', 'numrows');
            $header = get_table_header(array(S_USER_GROUPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
            show_table_header($header);
            $form = new CForm();
            $table = new CTableInfo(S_NO_USER_GROUPS_DEFINED);
            $table->setHeader(array(S_USERS_STATUS, S_GUI_ACCESS, array(new CCheckBox('all_groups', NULL, "CheckAll('" . $form->GetName() . "','all_groups');"), make_sorting_link(S_NAME, 'ug.name')), S_MEMBERS));
            $result = DBselect('SELECT ug.usrgrpid, ug.name, ug.users_status, ug.gui_access ' . ' FROM usrgrp ug' . ' WHERE ' . DBin_node('ug.usrgrpid') . order_by('ug.name'));
            while ($row = DBfetch($result)) {
                $users = array();
                $users_id = array();
                $db_users = DBselect('SELECT DISTINCT u.alias,u.userid ' . ' FROM users u,users_groups ug ' . ' WHERE u.userid=ug.userid ' . ' AND ug.usrgrpid=' . $row['usrgrpid'] . ' ORDER BY u.alias');
                while ($db_user = DBfetch($db_users)) {
                    if (!empty($users)) {
                        $users[$db_user['userid']][] = ', ';
                    } else {
                        $users[$db_user['userid']] = array();
                    }
                    $users[$db_user['userid']][] = new Clink($db_user['alias'], 'users.php?form=update&config=0&userid=' . $db_user['userid'] . '#form');
                }
                $gui_access = user_auth_type2str($row['gui_access']);
                $users_status = $row['users_status'] == GROUP_STATUS_ENABLED ? S_ENABLED : S_DISABLED;
Exemple #26
0
$sql_cond = $_REQUEST['userid'] ? ' AND a.userid=' . $_REQUEST['userid'] . ' ' : '';
$sql_cond .= $_REQUEST['action'] > -1 && $config == 0 ? ' AND a.action=' . $_REQUEST['action'] . ' ' : '';
$sql_cond .= $_REQUEST['resourcetype'] > -1 && $config == 0 ? ' AND a.resourcetype=' . $_REQUEST['resourcetype'] . ' ' : '';
$sql_cond .= $_REQUEST['filter_timesince'] ? ' AND a.clock>' . $_REQUEST['filter_timesince'] : ' AND a.clock>100';
$sql_cond .= $_REQUEST['filter_timetill'] ? ' AND a.clock<' . $_REQUEST['filter_timetill'] : '';
$frmForm = new CForm();
$frmForm->SetMethod('get');
$cmbConf = new CComboBox('config', $_REQUEST['config'], 'submit()');
$cmbConf->addItem(0, S_AUDIT_LOGS);
$cmbConf->addItem(1, S_AUDIT_ACTIONS);
$frmForm->addItem($cmbConf);
//	show_table_header(S_AUDIT_BIG, $frmForm);
$row_count = 0;
if (0 == $config) {
    $table = new CTableInfo();
    $table->setHeader(array(make_sorting_link(S_TIME, 'a.clock'), make_sorting_link(S_USER, 'u.alias'), S_IP, S_RESOURCE, S_ACTION, S_ID, S_DESCRIPTION, S_DETAILS));
    $sql = 'SELECT a.auditid,a.clock,u.alias,a.ip,a.resourcetype,a.action,a.resourceid,a.resourcename,a.details ' . ' FROM auditlog a, users u ' . ' WHERE u.userid=a.userid ' . $sql_cond . ' AND ' . DBin_node('u.userid', get_current_nodeid(null, PERM_READ_ONLY)) . order_by('a.clock,u.alias');
    $result = DBselect($sql, $_REQUEST['start'] + PAGE_SIZE);
    for ($i = 0; $row = DBfetch($result); $i++) {
        if ($i < $_REQUEST['start']) {
            continue;
        }
        switch ($row['action']) {
            case AUDIT_ACTION_ADD:
                $action = S_ADDED;
                break;
            case AUDIT_ACTION_UPDATE:
                $action = S_UPDATED;
                break;
            case AUDIT_ACTION_DELETE:
                $action = S_DELETED;
Exemple #27
0
        }
        $frmHostG->addItemToBottomRow($dltButton);
    }
    $frmHostG->addItemToBottomRow(SPACE);
    $frmHostG->addItemToBottomRow(new CButtonCancel(url_param('config')));
    $frmHostG->show();
} else {
    $config = select_config();
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_HOST_GROUPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $form = new CForm('hostgroups.php');
    $form->setName('form_groups');
    $table = new CTableInfo(S_NO_HOST_GROUPS_DEFINED);
    $table->setHeader(array(new CCheckBox('all_groups', NULL, "checkAll('" . $form->GetName() . "','all_groups','groups');"), make_sorting_link(S_NAME, 'g.name'), ' # ', S_MEMBERS));
    $groups = CHostGroup::get(array('order' => 'name', 'editable' => 1, 'extendoutput' => 1, 'select_hosts' => 1));
    foreach ($groups as $groupid => $group) {
        $tpl_count = 0;
        $host_count = 0;
        $i = 0;
        $hosts_output = array();
        foreach ($group['hosts'] as $hostid => $host) {
            $i++;
            if ($i > $config['max_in_table']) {
                $hosts_output[] = '...';
                $hosts_output[] = '//empty for array_pop';
                break;
            }
            switch ($host['status']) {
                case HOST_STATUS_NOT_MONITORED:
Exemple #28
0
     $triggers[$rowz['triggerid']] = $rowz;
     $triggerids[$rowz['triggerid']] = $rowz['triggerid'];
 }
 $sql = 'SELECT f.triggerid, i.* ' . ' FROM functions f, items i ' . ' WHERE ' . DBcondition('f.triggerid', $triggerids) . ' AND i.itemid=f.itemid';
 $result = DBselect($sql);
 while ($row = DBfetch($result)) {
     $item['itemid'] = $row['itemid'];
     $item['action'] = str_in_array($row['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues';
     $item['description'] = item_description($row);
     $triggers[$row['triggerid']]['items'][$row['itemid']] = $item;
 }
 $sql_cond = $show_unknown == 0 ? ' AND e.value<>' . TRIGGER_VALUE_UNKNOWN . ' ' : '';
 $sql_cond .= ' AND e.clock>' . $start;
 $sql_cond .= ' AND e.clock<' . $end;
 $table = new CTableInfo(S_NO_EVENTS_FOUND);
 $table->SetHeader(array(make_sorting_link(S_TIME, 'e.clock'), is_show_subnodes() ? S_NODE : null, $_REQUEST['hostid'] == 0 ? S_HOST : null, S_DESCRIPTION, S_STATUS, S_SEVERITY, S_DURATION, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
 if (!empty($triggers)) {
     $col = 0;
     $sql = 'SELECT e.eventid, e.objectid as triggerid, e.clock, e.value, e.acknowledged ' . ' FROM events e ' . ' WHERE ' . DBcondition('e.objectid', $triggerids) . ' AND (e.object+0)=' . EVENT_OBJECT_TRIGGER . $sql_cond . order_by('e.clock');
     //SDI($sql);
     $result = DBselect($sql);
     while ($row = DBfetch($result)) {
         $value = new CCol(trigger_value2str($row['value']), get_trigger_value_style($row['value']));
         $row = array_merge($triggers[$row['triggerid']], $row);
         if (0 == $show_unknown && !event_initial_time($row, $show_unknown)) {
             continue;
         }
         $duration = zbx_date2age($row['clock']);
         if ($next_event = get_next_event($row, $show_unknown)) {
             $duration = zbx_date2age($row['clock'], $next_event['clock']);
         }
Exemple #29
0
    }
}
$form = new CForm();
$form->SetMethod('get');
$form->AddItem(new CButton("form", S_CREATE_MEDIA_TYPE));
$row_count = 0;
$numrows = new CSpan(null, 'info');
$numrows->addOption('name', 'numrows');
$header = get_table_header(array(S_CONFIGURATION_OF_MEDIA_TYPES_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header, $form);
if (isset($_REQUEST["form"])) {
    echo SBR;
    insert_media_type_form();
} else {
    $table = new CTableInfo(S_NO_MEDIA_TYPES_DEFINED);
    $table->setHeader(array(make_sorting_link(S_TYPE, 'mt.type'), make_sorting_link(S_DESCRIPTION, 'mt.description'), S_DETAILS));
    $result = DBselect('SELECT mt.* ' . ' FROM media_type mt' . ' WHERE ' . DBin_node('mt.mediatypeid') . order_by('mt.type,mt.description'));
    while ($row = DBfetch($result)) {
        switch ($row['type']) {
            case MEDIA_TYPE_EMAIL:
                $details = S_SMTP_SERVER . ": '" . $row['smtp_server'] . "', " . S_SMTP_HELO . ": '" . $row['smtp_helo'] . "', " . S_SMTP_EMAIL . ": '" . $row['smtp_email'] . "'";
                break;
            case MEDIA_TYPE_EXEC:
                $details = S_SCRIPT_NAME . ": '" . $row['exec_path'] . "'";
                break;
            case MEDIA_TYPE_SMS:
                $details = S_GSM_MODEM . ": '" . $row['gsm_modem'] . "'";
                break;
            case MEDIA_TYPE_JABBER:
                $details = S_JABBER_IDENTIFIER . ": '" . $row['username'] . "'";
                break;
Exemple #30
0
// Header
$text = array(SPACE);
$url = '?fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1') . '&amp;druleid=' . $druleid;
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->AddOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
$fs_icon->AddAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
$p_elements[] = get_table_header($text, $r_form);
//-------------
$services = array();
$db_dservices = DBselect('SELECT s.type,s.port,s.key_ FROM dservices s,dhosts h' . ' WHERE ' . DBin_node('s.dserviceid') . ' AND s.dhostid=h.dhostid' . ($druleid > 0 ? ' AND h.druleid=' . $druleid : ''));
while ($dservice = DBfetch($db_dservices)) {
    $service_name = discovery_check_type2str($dservice['type']) . discovery_port2str($dservice['type'], $dservice['port']) . (empty($dservice['key_']) ? '' : ':' . $dservice['key_']);
    $services[$service_name] = 1;
}
ksort($services);
$header = array(is_show_subnodes() ? new CCol(S_NODE, 'center') : null, new CCol(make_sorting_link(S_HOST, 'ip'), 'center'), new CCol(array(S_UPTIME . '/', S_DOWNTIME), 'center'));
foreach ($services as $name => $foo) {
    $header[] = new CImg('vtext.php?text=' . $name);
}
$table = new CTableInfo();
$table->SetHeader($header, 'vertical_header');
$db_drules = DBselect('select distinct druleid,name from drules where ' . DBin_node('druleid') . ($druleid > 0 ? ' and druleid=' . $druleid : '') . ' order by name');
while ($drule = DBfetch($db_drules)) {
    $discovery_info = array();
    $db_dhosts = DBselect('SELECT dhostid,druleid,ip,status,lastup,lastdown ' . ' FROM dhosts WHERE ' . DBin_node('dhostid') . ' AND druleid=' . $drule['druleid'] . order_by('ip', 'dhostid,status'));
    while ($dhost = DBfetch($db_dhosts)) {
        $class = 'enabled';
        $time = 'lastup';
        if (DHOST_STATUS_DISABLED == $dhost['status']) {
            $class = 'disabled';
            $time = 'lastdown';