require_once dirname(__FILE__).'/include/config.inc.php';
require_once dirname(__FILE__).'/include/hosts.inc.php';
require_once dirname(__FILE__).'/include/forms.inc.php';
$page['title'] = _('Host inventory');
$page['file'] = 'hostinventories.php';
$hostId = getRequest('hostid', 0);
require_once dirname(__FILE__).'/include/page_header.php';
'hostid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null],
'filter_set' => [T_ZBX_STR, O_OPT, P_SYS, null, null],
'filter_rst' => [T_ZBX_STR, O_OPT, P_SYS, null, null],
'filter_field' => [T_ZBX_STR, O_OPT, null, null, null],
'filter_field_value' => [T_ZBX_STR, O_OPT, null, null, null],
'filter_exact' => [T_ZBX_INT, O_OPT, null, 'IN(0,1)', null],
'filter_groups' => [T_ZBX_INT, O_OPT, P_ONLY_ARRAY, DB_ID, null],
'cancel' => [T_ZBX_STR, O_OPT, P_SYS, null, null],
'sort' => [T_ZBX_STR, O_OPT, P_SYS,
IN('"name","pr_macaddress_a","pr_name","pr_os","pr_serialno_a","pr_tag","pr_type"'),
'sortorder' => [T_ZBX_STR, O_OPT, P_SYS, IN('"'.ZBX_SORT_DOWN.'","'.ZBX_SORT_UP.'"'), null]
if (getRequest('hostid') && !isReadableHosts([getRequest('hostid')])) {
$sortField = getRequest('sort', CProfile::get('web.'.$page['file'].'.sort', 'name'));
$sortOrder = getRequest('sortorder', CProfile::get('web.'.$page['file'].'.sortorder', ZBX_SORT_UP));
CProfile::update('web.'.$page['file'].'.sort', $sortField, PROFILE_TYPE_STR);
CProfile::update('web.'.$page['file'].'.sortorder', $sortOrder, PROFILE_TYPE_STR);
'allowed_ui_hosts' => CWebUser::checkAccess(CRoleHelper::UI_MONITORING_HOSTS),
'allowed_ui_problems' => CWebUser::checkAccess(CRoleHelper::UI_MONITORING_PROBLEMS),
'allowed_ui_latest_data' => CWebUser::checkAccess(CRoleHelper::UI_MONITORING_LATEST_DATA),
'allowed_ui_conf_hosts' => CWebUser::checkAccess(CRoleHelper::UI_CONFIGURATION_HOSTS)
$data['tableTitles'] = getHostInventories();
$data['tableTitles'] = zbx_toHash($data['tableTitles'], 'db_field');
$inventoryFields = array_keys($data['tableTitles']);
$data['host'] = API::Host()->get([
'output' => ['hostid', 'host', 'name', 'maintenance_status', 'maintenanceid', 'maintenance_type', 'description'],
'selectInterfaces' => API_OUTPUT_EXTEND,
'selectItems' => API_OUTPUT_COUNT,
'selectTriggers' => API_OUTPUT_COUNT,
'selectInventory' => $inventoryFields,
'selectGraphs' => API_OUTPUT_COUNT,
'selectDiscoveries' => API_OUTPUT_COUNT,