2006-07-20 00:01:47 +02:00
|
|
|
<?php
|
2019-08-06 14:52:43 +02:00
|
|
|
/**
|
|
|
|
* SNMP Console.
|
|
|
|
*
|
|
|
|
* @category SNMP
|
|
|
|
* @package Pandora FMS
|
|
|
|
* @subpackage Community
|
|
|
|
* @version 1.0.0
|
|
|
|
* @license See below
|
|
|
|
*
|
|
|
|
* ______ ___ _______ _______ ________
|
2023-06-08 12:42:10 +02:00
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
2019-08-06 14:52:43 +02:00
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
*
|
|
|
|
* ============================================================================
|
2023-06-08 11:53:13 +02:00
|
|
|
* Copyright (c) 2005-2023 Pandora FMS
|
2023-06-08 13:19:01 +02:00
|
|
|
* Please see https://pandorafms.com/community/ for full contribution list
|
2019-08-06 14:52:43 +02:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation for version 2.
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
2006-07-20 00:01:47 +02:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
// Begin.
|
2010-03-02 20:25:51 +01:00
|
|
|
global $config;
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
require_once $config['homedir'].'/include/class/SnmpConsole.class.php';
|
2020-09-18 15:07:31 +02:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
$ajaxPage = $config['homedir'].'/operation/snmpconsole/snmp_view';
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2022-12-20 10:03:45 +01:00
|
|
|
$filter_alert = get_parameter('filter_alert', -1);
|
|
|
|
$filter_severity = get_parameter('filter_severity', -1);
|
|
|
|
$filter_free_search = get_parameter('filter_free_search', '');
|
|
|
|
$filter_status = get_parameter('filter_status', 0);
|
|
|
|
$filter_group_by = get_parameter('filter_group_by', 0);
|
|
|
|
$filter_hours_ago = get_parameter('filter_hours_ago', 8);
|
|
|
|
$filter_trap_type = get_parameter('filter_trap_type', -1);
|
|
|
|
$refr = get_parameter('refr', 300);
|
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
// Control call flow.
|
|
|
|
try {
|
|
|
|
// User access and validation is being processed on class constructor.
|
2022-12-20 10:03:45 +01:00
|
|
|
$controller = new SnmpConsole(
|
|
|
|
$ajaxPage,
|
|
|
|
$filter_alert,
|
|
|
|
$filter_severity,
|
|
|
|
$filter_free_search,
|
|
|
|
$filter_status,
|
|
|
|
$filter_group_by,
|
|
|
|
$filter_hours_ago,
|
|
|
|
$filter_trap_type,
|
|
|
|
$refr
|
|
|
|
);
|
2022-11-14 17:43:35 +01:00
|
|
|
} catch (Exception $e) {
|
|
|
|
if ((bool) is_ajax() === true) {
|
|
|
|
echo json_encode(['error' => '[SnmpConsole]'.$e->getMessage() ]);
|
|
|
|
exit;
|
2019-01-30 16:18:44 +01:00
|
|
|
} else {
|
2022-11-14 17:43:35 +01:00
|
|
|
echo '[SnmpConsole]'.$e->getMessage();
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
// Stop this execution, but continue 'globally'.
|
2019-01-30 16:18:44 +01:00
|
|
|
return;
|
2014-09-23 18:05:44 +02:00
|
|
|
}
|
2008-10-22 17:05:15 +02:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
// AJAX controller.
|
|
|
|
if ((bool) is_ajax() === true) {
|
|
|
|
$method = get_parameter('method');
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
if (method_exists($controller, $method) === true) {
|
|
|
|
if ($controller->ajaxMethod($method) === true) {
|
|
|
|
$controller->{$method}();
|
2019-01-30 16:18:44 +01:00
|
|
|
} else {
|
2022-11-14 17:43:35 +01:00
|
|
|
$controller->error('Unavailable method.');
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
2022-11-14 17:43:35 +01:00
|
|
|
} else {
|
|
|
|
$controller->error('Method not found. ['.$method.']');
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
2014-06-10 17:21:58 +02:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
// Stop any execution.
|
|
|
|
exit;
|
2019-01-30 16:18:44 +01:00
|
|
|
} else {
|
2022-11-14 17:43:35 +01:00
|
|
|
// Run.
|
|
|
|
$controller->run();
|
2008-11-20 22:26:59 +01:00
|
|
|
}
|