diff --git a/pandora_console/include/class/SnmpConsole.class.php b/pandora_console/include/class/SnmpConsole.class.php
index eb515f7d3d..455ddd45ce 100644
--- a/pandora_console/include/class/SnmpConsole.class.php
+++ b/pandora_console/include/class/SnmpConsole.class.php
@@ -106,46 +106,116 @@ class SnmpConsole extends HTML
ui_require_css_file('wizard');
ui_require_css_file('discovery');
- $statistics['text'] = ''.html_print_image(
- 'images/op_reporting.png',
- true,
- [
- 'title' => __('Statistics'),
- 'class' => 'invert_filter',
- ]
- ).'';
- $list['text'] = ''.html_print_image(
- 'images/op_snmp.png',
- true,
- [
- 'title' => __('List'),
- 'class' => 'invert_filter',
- ]
- ).'';
- $list['active'] = true;
+ if (!isset($config['pure']) || $config['pure'] === false) {
+ $statistics['text'] = ''.html_print_image(
+ 'images/op_reporting.png',
+ true,
+ [
+ 'title' => __('Statistics'),
+ 'class' => 'invert_filter',
+ ]
+ ).'';
+ $list['text'] = ''.html_print_image(
+ 'images/op_snmp.png',
+ true,
+ [
+ 'title' => __('List'),
+ 'class' => 'invert_filter',
+ ]
+ ).'';
+ $list['active'] = true;
- // Header.
- ui_print_standard_header(
- __('SNMP Console'),
- 'images/op_snmp.png',
- false,
- 'snmp_console',
- false,
- [
- $list,
- $statistics,
- ],
- [
+ $screen['text'] = ''.html_print_image(
+ 'images/full_screen.png',
+ true,
[
- 'link' => '',
- 'label' => __('Monitoring'),
+ 'title' => __('List'),
+ 'class' => 'invert_filter',
+ ]
+ ).'';
+
+ // Header.
+ ui_print_standard_header(
+ __('SNMP Console'),
+ 'images/op_snmp.png',
+ false,
+ 'snmp_console',
+ false,
+ [
+ $screen,
+ $list,
+ $statistics,
],
[
- 'link' => '',
- 'label' => __('SNMP'),
- ],
- ]
- );
+ [
+ 'link' => '',
+ 'label' => __('Monitoring'),
+ ],
+ [
+ 'link' => '',
+ 'label' => __('SNMP'),
+ ],
+ ]
+ );
+ } else {
+ echo '
';
+
+ echo '';
+
+ ui_require_css_file('pandora_enterprise', ENTERPRISE_DIR.'/include/styles/');
+ ui_require_css_file('pandora_dashboard', ENTERPRISE_DIR.'/include/styles/');
+ ui_require_css_file('cluetip', 'include/styles/js/');
+
+ ui_require_jquery_file('countdown');
+ ui_require_javascript_file('pandora_dashboard', ENTERPRISE_DIR.'/include/javascript/');
+ ui_require_javascript_file('wz_jsgraphics');
+ ui_require_javascript_file('pandora_visual_console');
+ }
// Datatables list.
try {
@@ -257,6 +327,12 @@ class SnmpConsole extends HTML
'search_button_class' => 'sub filter float-right',
'no_sortable_columns' => [
0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
7,
8,
9,
@@ -961,7 +1037,35 @@ class SnmpConsole extends HTML
global $config;
$id_trap = get_parameter('id', 0);
- echo json_encode($id_trap);
+ $group_by = get_parameter('group_by', 0);
+
+ $trap = db_get_row('ttrap', 'id_trap', $id_trap);
+
+ if ($group_by) {
+ $sql = "SELECT * FROM ttrap WHERE 1=1
+ AND oid='".$trap['oid']."'
+ AND source='".$trap['source']."'";
+ $group_traps = db_get_all_rows_sql($sql);
+ $count_group_traps = count($group_traps);
+
+ $sql = "SELECT timestamp FROM ttrap WHERE 1=1
+ AND oid='".$trap['oid']."'
+ AND source='".$trap['source']."'
+ ORDER BY `timestamp` DESC";
+ $last_trap = db_get_value_sql($sql);
+
+ $sql = "SELECT timestamp FROM ttrap WHERE 1=1
+ AND oid='".$trap['oid']."'
+ AND source='".$trap['source']."'
+ ORDER BY `timestamp` ASC";
+ $first_trap = db_get_value_sql($sql);
+
+ $trap['count'] = $count_group_traps;
+ $trap['first'] = $first_trap;
+ $trap['last'] = $last_trap;
+ }
+
+ echo json_encode($trap);
return;
}
@@ -1035,6 +1139,7 @@ class SnmpConsole extends HTML
* Show more information
*/
function toggleVisibleExtendedInfo(id, position) {
+ $('tr[id^=show_]').remove()
$.ajax({
method: 'get',
url: '',
@@ -1042,13 +1147,98 @@ class SnmpConsole extends HTML
page: 'operation/snmpconsole/snmp_view',
method: 'showInfo',
id: id,
+ group_by : $('#filter_group_by').val(),
},
datatype: "json",
success: function(data) {
- console.log(data);
- $('#test').remove();
+ let trap = JSON.parse(data);
var tr = $('#snmp_console tr').eq(position+1);
- tr.after('
HOLAAAAAAAA | ADIOSSSSS |
');
+
+ // Count.
+ if ($('#filter_group_by').val() == 1) {
+ let labelCount = '
| ';
+ let variableCount = `
${trap['count']}${trap['first']}${trap['last']} | `;
+
+ tr.after(`
${labelCount}${variableCount}
`);
+ }
+
+ // Type.
+ desc_trap_type = "";
+ switch (trap['type']) {
+ case -1:
+ desc_trap_type = "";
+ break;
+
+ case 0:
+ desc_trap_type = "";
+ break;
+
+ case 1:
+ desc_trap_type = "";
+ break;
+
+ case 2:
+ desc_trap_type = "";
+ break;
+
+ case 3:
+ desc_trap_type = "";
+ break;
+
+ case 4:
+ desc_trap_type = "";
+ break;
+
+ default:
+ desc_trap_type = "";
+ break;
+ }
+
+ let labelType = '
| ';
+ let variableType = `
${desc_trap_type} | `;
+
+ tr.after(`
${labelType}${variableType}
`);
+
+ // Description.
+ if (trap['description']) {
+ let labelDesc = '
| ';
+ let variableDesc = `
${trap['description']} | `;
+
+ tr.after(`
${labelDesc}${variableDesc}
`);
+ }
+
+ // Enterprise String.
+ let labelOid = '
| ';
+ let variableOId = `
${trap['oid']} | `;
+
+ tr.after(`
${labelOid}${variableOId}
`);
+
+ // Variable bindings.
+ let labelBindings = '';
+ let variableBindings = '';
+ if ($('#filter_group_by').val() == 1) {
+ labelBindings = '
| ';
+
+ let new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view';
+ new_url += '&filter_severity='+$('#filter_severity').val();
+ new_url += '&filter_status='+$('#filter_status').val();
+ new_url += '&filter_alert='+$('#filter_alert').val();
+ new_url += '&group_by=0';
+
+ const string = '
';
+
+ variableBindings = `
${string} | `;
+ } else {
+ labelBindings = '
| ';
+ const binding_vars = trap['oid_custom'].split("\t");
+ let string = '';
+ binding_vars.forEach(function(oid) {
+ string += oid+'
';
+ });
+ variableBindings = `
${string} | `;
+ }
+
+ tr.after(`
${labelBindings}${variableBindings}
`);
},
error: function(e) {
console.error(e);