2013-02-07 19:21:59 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
|
|
|
|
// Load global vars
|
|
|
|
global $config;
|
|
|
|
require_once($config['homedir'] . "/include/functions_snmp_browser.php");
|
2013-02-22 14:11:47 +01:00
|
|
|
ui_require_javascript_file ('pandora_snmp_browser');
|
2013-02-07 19:21:59 +01:00
|
|
|
|
|
|
|
// AJAX call
|
|
|
|
if (is_ajax()) {
|
|
|
|
|
|
|
|
// Read the action to perform
|
|
|
|
$action = (string) get_parameter ("action", "");
|
|
|
|
$target_ip = (string) get_parameter ("target_ip", '');
|
|
|
|
$community = (string) get_parameter ("community", '');
|
2013-07-22 20:14:09 +02:00
|
|
|
$snmp_version = (string) get_parameter ("snmp_browser_version", '');
|
|
|
|
$snmp3_auth_user = get_parameter('snmp3_browser_auth_user');
|
|
|
|
$snmp3_security_level = get_parameter('snmp3_browser_security_level');
|
|
|
|
$snmp3_auth_method = get_parameter('snmp3_browser_auth_method');
|
|
|
|
$snmp3_auth_pass = get_parameter('snmp3_browser_auth_pass');
|
|
|
|
$snmp3_privacy_method = get_parameter('snmp3_browser_privacy_method');
|
|
|
|
$snmp3_privacy_pass = get_parameter('snmp3_browser_privacy_pass');
|
2013-05-10 14:28:26 +02:00
|
|
|
|
2013-02-07 19:21:59 +01:00
|
|
|
// SNMP browser
|
|
|
|
if ($action == "snmptree") {
|
2013-02-22 14:11:47 +01:00
|
|
|
$starting_oid = (string) get_parameter ("starting_oid", '.');
|
|
|
|
|
2016-01-27 15:58:54 +01:00
|
|
|
$snmp_tree = snmp_browser_get_tree(
|
|
|
|
$target_ip, $community, $starting_oid, $snmp_version,
|
|
|
|
$snmp3_auth_user, $snmp3_security_level, $snmp3_auth_method,
|
|
|
|
$snmp3_auth_pass, $snmp3_privacy_method, $snmp3_privacy_pass);
|
2013-02-07 19:21:59 +01:00
|
|
|
if (! is_array ($snmp_tree)) {
|
|
|
|
echo $snmp_tree;
|
2013-04-23 13:02:18 +02:00
|
|
|
}
|
|
|
|
else {
|
2013-02-07 19:21:59 +01:00
|
|
|
snmp_browser_print_tree ($snmp_tree);
|
2017-06-20 10:31:14 +02:00
|
|
|
echo html_print_submit_button(__('Create network components'),'create_network_component',
|
|
|
|
false, array('style' => 'display: none', 'class' => 'sub add'), true);
|
|
|
|
|
|
|
|
echo '<div id="dialog_error" style="display: none" title="Network components">';
|
|
|
|
echo "<div>";
|
|
|
|
echo "<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='images/icono_error_mr.png'></div>";
|
|
|
|
echo "<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>";
|
2017-06-20 15:32:24 +02:00
|
|
|
echo "<p style='font-family:Verdana; font-size:12pt;margin-bottom: 0px'>".__('Error creating the following modules:')."</p>";
|
|
|
|
echo "<p id='error_text' style='font-family:Verdana; font-size:12pt;'></p>";
|
2017-06-20 10:31:14 +02:00
|
|
|
echo "</div>";
|
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
echo '<div id="dialog_success" style="display: none" title="Network components">';
|
|
|
|
echo "<div>";
|
|
|
|
echo "<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='images/icono_exito_mr.png'></div>";
|
|
|
|
echo "<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>SUCCESS</strong></h3>";
|
|
|
|
echo "<p style='font-family:Verdana; font-size:12pt;'>".__('Modules successfully created')."</p>";
|
|
|
|
echo "</div>";
|
|
|
|
echo '</div>';
|
2013-02-07 19:21:59 +01:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// SNMP get
|
|
|
|
else if ($action == "snmpget") {
|
2013-02-22 14:11:47 +01:00
|
|
|
$target_oid = htmlspecialchars_decode (get_parameter ("oid", ""));
|
|
|
|
$custom_action = get_parameter ("custom_action", "");
|
|
|
|
if ($custom_action != "") {
|
|
|
|
$custom_action = urldecode (base64_decode ($custom_action));
|
|
|
|
}
|
2013-04-23 13:02:18 +02:00
|
|
|
|
2013-07-30 12:25:49 +02:00
|
|
|
$oid = snmp_browser_get_oid ($target_ip, $community,
|
|
|
|
$target_oid, $snmp_version, $snmp3_auth_user,
|
|
|
|
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
|
|
|
|
$snmp3_privacy_method, $snmp3_privacy_pass);
|
2014-04-02 12:19:39 +02:00
|
|
|
snmp_browser_print_oid ($oid, $custom_action, false, $community,
|
|
|
|
$snmp_version);
|
2013-02-07 19:21:59 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check login and ACLs
|
|
|
|
check_login ();
|
|
|
|
if (! check_acl ($config['id_user'], 0, "AR")) {
|
|
|
|
db_pandora_audit("ACL Violation",
|
|
|
|
"Trying to access SNMP Console");
|
|
|
|
require ("general/noaccess.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Header
|
2013-05-10 14:28:26 +02:00
|
|
|
$url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_browser&pure=' . $config["pure"];
|
2013-02-07 19:21:59 +01:00
|
|
|
if ($config["pure"]) {
|
|
|
|
// Windowed
|
2013-04-10 09:57:54 +02:00
|
|
|
$link['text'] = '<a target="_top" href="'.$url.'&pure=0&refr=30">' . html_print_image("images/normal_screen.png", true, array("title" => __('Normal screen'))) . '</a>';
|
2013-04-23 13:02:18 +02:00
|
|
|
}
|
|
|
|
else {
|
2013-02-07 19:21:59 +01:00
|
|
|
// Fullscreen
|
2013-04-10 09:57:54 +02:00
|
|
|
$link['text'] = '<a target="_top" href="'.$url.'&pure=1&refr=0">' . html_print_image("images/full_screen.png", true, array("title" => __('Full screen'))) . '</a>';
|
2013-02-07 19:21:59 +01:00
|
|
|
}
|
2013-04-10 09:57:54 +02:00
|
|
|
ui_print_page_header (__("SNMP Browser"), "images/op_snmp.png", false, "", false, array($link));
|
2013-02-07 19:21:59 +01:00
|
|
|
|
2013-02-22 14:11:47 +01:00
|
|
|
// SNMP tree container
|
|
|
|
snmp_browser_print_container ();
|
2013-02-07 19:21:59 +01:00
|
|
|
|
|
|
|
?>
|