[Realtime Graphs] Added the hidden type snmp_module

This commit is contained in:
fermin831 2018-05-03 12:57:24 +02:00
parent ab1ca78340
commit 8bc9805288
3 changed files with 34 additions and 14 deletions

View File

@ -69,26 +69,40 @@ function pandora_realtime_graphs () {
$graph = get_parameter('graph', 'cpu_load');
$refresh = get_parameter('refresh', '1000');
$data['graph'] = __('Graph') . '  ' . html_print_select ($graph_fields, 'graph', $graph, '', '', 0, true);
if ($graph != 'snmp_module') {
$data['graph'] = __('Graph') . '  ' . html_print_select ($graph_fields, 'graph', $graph, '', '', 0, true);
}
$refresh_fields[1000] = human_time_description_raw(1, true, 'large');
$refresh_fields[5000] = human_time_description_raw(5, true, 'large');
$refresh_fields[10000] = human_time_description_raw(10, true, 'large');
$refresh_fields[30000] = human_time_description_raw(30, true, 'large');
if ($graph == 'snmp_module') {
$agent_alias = get_parameter('agent_alias', '');
$module_name = get_parameter('module_name', '');
$module_incremental = get_parameter ('incremental', 0);
$data['module_info'] = "$agent_alias: <b>$module_name</b>";
// Append all the hidden in this cell
$data['module_info'] .= html_print_input_hidden ('incremental', $module_incremental, true);
$data['module_info'] .= html_print_select (
array('snmp_module' => '-'), 'graph', 'snmp_module', '', '', 0, true, false, true, '', false, 'display: none;'
);
}
$data['refresh'] = __('Refresh interval') . '&nbsp;&nbsp;' . html_print_select ($refresh_fields, 'refresh', $refresh, '', '', 0, true);
$data['incremental'] = __('Incremental') . '&nbsp;&nbsp;' . html_print_checkbox ('incremental', 1, 0, true);
if ($graph != 'snmp_module') {
$data['incremental'] = __('Incremental') . '&nbsp;&nbsp;' . html_print_checkbox ('incremental', 1, 0, true);
}
$data['reset'] = html_print_button(__('Clear graph'), 'reset', false, 'clearGraph()', 'class="sub delete" style="margin-top:0px;"', true);
$table->data[] = $data;
if ($graph == 'snmp_interface') {
$snmp_address = '';
$snmp_community = '';
$snmp_oid = '';
$snmp_ver = '1';
$snmp_inc = false;
if ($graph == 'snmp_interface' || $graph == 'snmp_module') {
$snmp_address = get_parameter('snmp_address', '');
$snmp_community = get_parameter('snmp_community', '');
$snmp_oid = get_parameter('snmp_oid', '');
$snmp_ver = get_parameter('snmp_ver', '');
$data = array();
$data['snmp_address'] = __('Target IP') . '&nbsp;&nbsp;' . html_print_input_text ('ip_target', $snmp_address, '', 50, 255, true);
@ -111,9 +125,14 @@ function pandora_realtime_graphs () {
$data['snmp_ver'] = __('Version') . '&nbsp;&nbsp;' . html_print_select ($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
$data['snmp_ver'] .= '&nbsp;&nbsp;' . html_print_button (__('SNMP walk'), 'snmp_walk', false, 'snmpBrowserWindow()', 'class="sub next"', true);
$table->colspan[2]['snmp_ver'] = 2;
$table->data[] = $data;
// Hide some options in snmp_module graphs
if ($graph == 'snmp_module') {
$table->rowstyle[1] = "display: none;";
$table->rowstyle[2] = "display: none;";
}
snmp_browser_print_container (false, '100%', '60%', 'none');
}

View File

@ -59,6 +59,7 @@ switch($graph) {
$data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'");
break;
case 'snmp_interface':
case 'snmp_module':
$snmp_address = $_POST['snmp_address'];
$snmp_community = $_POST['snmp_community'];
$snmp_ver = $_POST['snmp_ver'];

View File

@ -37,7 +37,7 @@ var plot = $.plot("#" + id, data, options);
var refresh = parseInt($('#refresh').val());
var incremental = $('#checkbox-incremental').is(':checked');
var incremental = $('#checkbox-incremental').is(':checked') || $('#hidden-incremental').val() == 1;
var incremental_base = 0;
var last_inc = 0;
var to;