} /************************* FILTER **************************/ /***********************************************************/ $prev = 'Prev 100'; $next = 'Next 100'; if ($_REQUEST['start'] > 0) { $prev = new Clink('Prev ' . PAGE_SIZE, 'audit.php?prev=1' . url_param('start') . url_param('config'), 'styled'); } if ($table->GetNumRows() >= PAGE_SIZE) { $next = new Clink('Next ' . PAGE_SIZE, 'audit.php?next=1' . url_param('start') . url_param('config'), 'styled'); } $filterForm = new CFormTable(S_FILTER); //,'events.php?filter_set=1','POST',null,'sform'); $filterForm->addOption('name', 'zbx_filter'); $filterForm->addOption('id', 'zbx_filter'); $filterForm->setMethod('get'); $script = new CScript("javascript: if(CLNDR['audit_since'].clndr.setSDateFromOuterObj()){" . "\$('filter_timesince').value = parseInt(CLNDR['audit_since'].clndr.sdt.getTime()/1000);}" . "if(CLNDR['audit_till'].clndr.setSDateFromOuterObj()){" . "\$('filter_timetill').value = parseInt(CLNDR['audit_till'].clndr.sdt.getTime()/1000);}"); $filterForm->addAction('onsubmit', $script); $filterForm->addVar('filter_timesince', $_REQUEST['filter_timesince'] > 0 ? $_REQUEST['filter_timesince'] : ''); $filterForm->addVar('filter_timetill', $_REQUEST['filter_timetill'] > 0 ? $_REQUEST['filter_timetill'] : ''); $filterForm->addVar('config', $_REQUEST['config']); $filterForm->addVar('userid', $_REQUEST['userid']); if (isset($_REQUEST['userid']) && $_REQUEST['userid'] > 0) { $user = get_user_by_userid($_REQUEST['userid']); } else { $user['alias'] = ''; } $row = new CRow(array(new CCol($config == 1 ? S_RECIPIENT : S_USER, 'form_row_l'), new CCol(array(new CTextBox("user", $user['alias'], 32, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->GetName() . "&dstfld1=userid&dstfld2=user" . "&srctbl=users&srcfld1=userid&srcfld2=alias&real_hosts=1');", 'T')), 'form_row_r'))); $filterForm->addRow($row); if ($config == 0) { $cmbAction = new CComboBox('action', $_REQUEST['action']);
$fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';")); $mute_icon = new CDiv(SPACE, $mute ? 'iconmute' : 'iconsound'); $mute_icon->setAttribute('title', S_SOUND . ' ' . S_ON . '/' . S_OFF); $mute_icon->addAction('onclick', new CScript("javascript: switch_mute(this);")); $tr_numrows = new CSpan(null, 'info'); $tr_numrows->setAttribute('name', 'tr_numrows'); $tr_info = array(S_TRIGGERS, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $tr_numrows, SPACE . SPACE . SPACE . S_UPDATED . ': ', new CSpan(date(S_DATE_FORMAT_YMDHMS), 'info')); $trigg_wdgt->addHeader(S_STATUS_OF_TRIGGERS_BIG, array($mute_icon, $fs_icon)); $trigg_wdgt->addHeader($tr_info, $r_form); /************************* FILTER **************************/ /***********************************************************/ $filterForm = new CFormTable(); //,'tr_status.php?filter_set=1','POST',null,'sform'); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter'); $filterForm->setMethod('post'); $filterForm->addVar('fullscreen', $_REQUEST['fullscreen']); $filterForm->addVar('groupid', $_REQUEST['groupid']); $filterForm->addVar('hostid', $_REQUEST['hostid']); $tr_select = new CComboBox('show_triggers', $show_triggers, 'javasctipt: submit();'); if (TRIGGERS_OPTION_ONLYTRUE) { $tr_select->additem(TRIGGERS_OPTION_ONLYTRUE, S_SHOW_ONLY_PROBLEMS); } if (TRIGGERS_OPTION_ALL) { $tr_select->addItem(TRIGGERS_OPTION_ALL, S_SHOW_ALL); } if (TRIGGERS_OPTION_NOFALSEFORB && $config['event_ack_enable']) { $tr_select->addItem(TRIGGERS_OPTION_NOFALSEFORB, S_SHOW_NOFALSEFORB); } $ev_select = new CComboBox('show_events', $show_events, 'javasctipt: submit();'); if (EVENTS_OPTION_NOEVENT) {
function get_item_filter_form() { $selection_mode = $_REQUEST['selection_mode']; $filter_node = $_REQUEST['filter_node']; $filter_group = $_REQUEST['filter_group']; $filter_host = $_REQUEST['filter_host']; $filter_application = $_REQUEST['filter_application']; $filter_description = $_REQUEST['filter_description']; $filter_type = $_REQUEST['filter_type']; $filter_key = $_REQUEST['filter_key']; $filter_snmp_community = $_REQUEST['filter_snmp_community']; $filter_snmp_oid = $_REQUEST['filter_snmp_oid']; $filter_snmp_port = $_REQUEST['filter_snmp_port']; $filter_snmpv3_securityname = $_REQUEST['filter_snmpv3_securityname']; $filter_snmpv3_securitylevel = $_REQUEST['filter_snmpv3_securitylevel']; $filter_snmpv3_authpassphrase = $_REQUEST['filter_snmpv3_authpassphrase']; $filter_snmpv3_privpassphrase = $_REQUEST['filter_snmpv3_privpassphrase']; $filter_value_type = $_REQUEST['filter_value_type']; $filter_data_type = $_REQUEST['filter_data_type']; $filter_units = $_REQUEST['filter_units']; $filter_formula = $_REQUEST['filter_formula']; $filter_delay = $_REQUEST['filter_delay']; $filter_history = $_REQUEST['filter_history']; $filter_trends = $_REQUEST['filter_trends']; $filter_status = $_REQUEST['filter_status']; $filter_logtimefmt = $_REQUEST['filter_logtimefmt']; $filter_delta = $_REQUEST['filter_delta']; $filter_trapper_hosts = $_REQUEST['filter_trapper_hosts']; $form = new CFormTable(); $form->setAttribute('name', 'zbx_filter'); $form->setAttribute('id', 'zbx_filter'); $form->setMethod('get'); $form->addAction('onsubmit', "javascript: if(empty_form(this)) return Confirm('Filter is empty! All items will be selected. Proceed?');"); $form->addVar('filter_hostid', get_request('filter_hostid', get_request('hostid'))); $form->addVar('selection_mode', $selection_mode); $modeLink = new CSpan($selection_mode == 0 ? S_ADVANCED : S_SIMPLE, 'link'); $modeLink->addAction('onclick', "javascript: create_var('" . $form->GetName() . "','selection_mode'," . ($selection_mode == 0 ? 1 : 0) . ',true);'); $form->addRow(S_SELECTION_MODE, $modeLink); if (ZBX_DISTRIBUTED && $selection_mode) { $form->addRow(array('from ', bold(S_NODE), ' like'), array(new CTextBox('filter_node', $filter_node, 32), new CButton('btn_node', S_SELECT, "return PopUp('popup.php?dstfrm=" . $form->GetName() . "&dstfld1=filter_node&srctbl=nodes&srcfld1=name',450,450);", "G"))); } if ($selection_mode) { $form->addRow(array('from ', bold(S_HOST_GROUP), ' like'), array(new CTextBox('filter_group', $filter_group, 32), new CButton("btn_group", S_SELECT, "return PopUp('popup.php?dstfrm=" . $form->GetName() . "&dstfld1=filter_group&srctbl=host_group&srcfld1=name',450,450);", "G"))); } $form->addRow(array('from ', bold(S_HOST), ' like'), array(new CTextBox('filter_host', $filter_host, 32), new CButton("btn_host", S_SELECT, "return PopUp('popup.php?dstfrm=" . $form->GetName() . "&dstfld1=filter_host&dstfld2=filter_hostid&srctbl=hosts&srcfld1=host&srcfld2=hostid',450,450);", 'H'))); if ($selection_mode) { $form->addRow(array('from ', bold(S_APPLICATION), ' like'), array(new CTextBox('filter_application', $filter_application, 32), new CButton('btn_app', S_SELECT, 'return PopUp("popup.php?dstfrm=' . $form->GetName() . '&dstfld1=filter_application&srctbl=applications' . '&srcfld1=name",400,300,"application");', 'A'))); } $form->addRow(array('with ', bold(S_DESCRIPTION), ' like'), new CTextBox("filter_description", $filter_description, 40)); if ($selection_mode) { $cmbType = new CComboBox("filter_type", $filter_type, "submit()"); $cmbType->addItem(-1, S_ALL_SMALL); foreach (array(ITEM_TYPE_ZABBIX, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV1, ITEM_TYPE_SNMPV2C, ITEM_TYPE_SNMPV3, ITEM_TYPE_TRAPPER, ITEM_TYPE_INTERNAL, ITEM_TYPE_AGGREGATE, ITEM_TYPE_HTTPTEST, ITEM_TYPE_DB_MONITOR, ITEM_TYPE_IPMI) as $it) { $cmbType->addItem($it, item_type2str($it)); } $form->addRow(array('with ', bold(S_TYPE)), $cmbType); } $form->addRow(array('with ', bold(S_KEY), ' like'), array(new CTextBox("filter_key", $filter_key, 40))); if ($selection_mode) { if ($filter_type == ITEM_TYPE_SNMPV1 || $filter_type == ITEM_TYPE_SNMPV2C || $filter_type == ITEM_TYPE_SNMPV3) { $form->addRow(array('with ', bold(S_SNMP_COMMUNITY), ' like'), new CTextBox("filter_snmp_community", $filter_snmp_community, 16)); $form->addRow(array('with ', bold(S_SNMP_OID), ' like'), new CTextBox("filter_snmp_oid", $filter_snmp_oid, 40)); $form->addRow(array('with ', bold(S_SNMP_PORT), ' like'), new CNumericBox("filter_snmp_port", $filter_snmp_port, 5, null, true)); } if ($filter_type == ITEM_TYPE_SNMPV3) { $form->addRow(array('with ', bold(S_SNMPV3_SECURITY_NAME), ' like'), new CTextBox("filter_snmpv3_securityname", $filter_snmpv3_securityname, 64)); $cmbSecLevel = new CComboBox("filter_snmpv3_securitylevel", $filter_snmpv3_securitylevel); $cmbSecLevel->addItem(-1, S_ALL_SMALL); $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV, "NoAuthPriv"); $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV, "AuthNoPriv"); $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV, "AuthPriv"); $form->addRow(array('with ', bold(S_SNMPV3_SECURITY_LEVEL)), $cmbSecLevel); $form->addRow(array('with ', bold(S_SNMPV3_AUTH_PASSPHRASE), ' like'), new CTextBox("filter_snmpv3_authpassphrase", $filter_snmpv3_authpassphrase, 64)); $form->addRow(array('with ', bold(S_SNMPV3_PRIV_PASSPHRASE), ' like'), new CTextBox("filter_snmpv3_privpassphrase", $filter_snmpv3_privpassphrase, 64)); } $cmbValType = new CComboBox("filter_value_type", $filter_value_type, "submit()"); $cmbValType->AddItem(-1, S_ALL_SMALL); $cmbValType->AddItem(ITEM_VALUE_TYPE_UINT64, S_NUMERIC_UNSIGNED); $cmbValType->AddItem(ITEM_VALUE_TYPE_FLOAT, S_NUMERIC_FLOAT); $cmbValType->AddItem(ITEM_VALUE_TYPE_STR, S_CHARACTER); $cmbValType->AddItem(ITEM_VALUE_TYPE_LOG, S_LOG); $cmbValType->AddItem(ITEM_VALUE_TYPE_TEXT, S_TEXT); $form->AddRow(array('with ', bold(S_TYPE_OF_INFORMATION)), $cmbValType); if ($filter_value_type == ITEM_VALUE_TYPE_UINT64) { $cmbDataType = new CComboBox("filter_data_type", $filter_data_type, "submit()"); $cmbDataType->addItem(-1, S_ALL_SMALL); $cmbDataType->addItem(ITEM_DATA_TYPE_DECIMAL, item_data_type2str(ITEM_DATA_TYPE_DECIMAL)); $cmbDataType->addItem(ITEM_DATA_TYPE_OCTAL, item_data_type2str(ITEM_DATA_TYPE_OCTAL)); $cmbDataType->addItem(ITEM_DATA_TYPE_HEXADECIMAL, item_data_type2str(ITEM_DATA_TYPE_HEXADECIMAL)); $form->addRow(array('with ', bold(S_DATA_TYPE)), $cmbDataType); } if ($filter_value_type == ITEM_VALUE_TYPE_FLOAT || $filter_value_type == ITEM_VALUE_TYPE_UINT64) { $form->addRow(array('with ', bold(S_UNITS)), new CTextBox("filter_units", $filter_units, 40)); $form->addRow(array('with ', bold(S_CUSTOM_MULTIPLIER), ' like'), new CTextBox("filter_formula", $filter_formula, 40)); } if ($filter_type != ITEM_TYPE_TRAPPER && $filter_type != ITEM_TYPE_HTTPTEST) { $form->addRow(array('with ', bold(S_UPDATE_INTERVAL_IN_SEC)), new CNumericBox("filter_delay", $filter_delay, 5, null, true)); } $form->addRow(array('with ', bold(S_KEEP_HISTORY_IN_DAYS)), new CNumericBox("filter_history", $filter_history, 8, null, true)); $form->addRow(array('with ', bold(S_KEEP_TRENDS_IN_DAYS)), new CNumericBox("filter_trends", $filter_trends, 8, null, true)); $cmbStatus = new CComboBox("filter_status", $filter_status); $cmbStatus->addItem(-1, S_ALL_SMALL); foreach (array(ITEM_STATUS_ACTIVE, ITEM_STATUS_DISABLED, ITEM_STATUS_NOTSUPPORTED) as $st) { $cmbStatus->addItem($st, item_status2str($st)); } $form->addRow(array('with ', bold(S_STATUS)), $cmbStatus); if ($filter_value_type == ITEM_VALUE_TYPE_LOG) { $form->addRow(array('with ', bold(S_LOG_TIME_FORMAT)), new CTextBox("filter_logtimefmt", $filter_logtimefmt, 16)); } if ($filter_value_type == ITEM_VALUE_TYPE_FLOAT || $filter_value_type == ITEM_VALUE_TYPE_UINT64) { $cmbDelta = new CComboBox("filter_delta", $filter_delta); $cmbDelta->addItem(-1, S_ALL_SMALL); $cmbDelta->addItem(0, S_AS_IS); $cmbDelta->addItem(1, S_DELTA_SPEED_PER_SECOND); $cmbDelta->addItem(2, S_DELTA_SIMPLE_CHANGE); $form->addRow(array('with ', bold(S_STORE_VALUE)), $cmbDelta); } if ($filter_type == ITEM_TYPE_TRAPPER) { $form->addRow(array('with ', bold(S_ALLOWED_HOSTS), ' like'), new CTextBox("filter_trapper_hosts", $filter_trapper_hosts, 40)); } } $reset = new CButton("filter_rst", S_RESET); $reset->SetType('button'); $reset->SetAction('javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();'); $form->addItemToBottomRow(new CButton("filter_set", S_FILTER)); $form->addItemToBottomRow($reset); return $form; }