2011-06-20 Sancho Lerena <slerena@artica.es>

* net_tools
        net_tools/nettool.png: Nettools extension. Allow from interface
        several operations like ping the host, do a traceroute, get
        whois /dig information, get SNMP device information and interface
        status




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4472 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2011-06-20 16:25:57 +00:00
parent 3f429642fc
commit a78c83b485
3 changed files with 118 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2011-06-20 Sancho Lerena <slerena@artica.es>
* net_tools
net_tools/nettool.png: Nettools extension. Allow from interface
several operations like ping the host, do a traceroute, get whois
/dig information, get SNMP device information and interface status
2011-06-20 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_modules.php: Added initialization variable

View File

@ -0,0 +1,111 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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; 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.
extensions_add_opemode_tab_agent ('network_tools','Network Tools','extensions/net_tools/nettool.png',"main_net_tools");
function main_net_tools () {
$id_agente = get_parameter ("id_agente");
$ip = db_get_sql ("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
echo "<div>";
echo "<form name='actionbox' method='post'>";
echo "<table class=databox width=650>";
echo "<tr><td>";
echo __("Operation");
echo "<td>";
echo "<select name='operation'>";
echo "<option value=1>".__("Traceroute");
echo "<option value=2>".__("Ping host & Latency");
echo "<option value=3>".__("SNMP Interface status");
echo "<option value=4>".__("Basic TCP Port Scan");
echo "<option value=5>".__("DiG/Whois Lookup");
echo "</select>";
echo "<td>";
echo __("SNMP Community");
echo "<td>";
echo "<input name=community type=text value='public'>";
echo "<td>";
echo "<input name=submit type=submit class='sub next' value='".__('Execute')."'>";
echo "</tr></table>";
echo "</form>";
$operation = get_parameter ("operation",0);
$community = get_parameter ("community","public");
switch($operation){
case 1: echo "<h3>".__("Traceroute to "). $ip. "</h3>";
echo "<pre>";
echo system ("/usr/sbin/traceroute $ip");
echo "</pre>";
break;
case 2: echo "<h3>".__("Ping to "). $ip. "</h3>";
echo "<pre>";
echo system ("ping -c 5 $ip");
echo "</pre>";
break;
case 4: echo "<h3>".__("Basic TCP Scan on "). $ip. "</h3>";
echo "<pre>";
echo system ("nmap -F $ip");
echo "</pre>";
break;
case 5: echo "<h3>".__("Domain and IP information for "). $ip. "</h3>";
echo "<pre>";
echo system ("dig $ip");
echo system ("whois $ip");
echo "</pre>";
break;
case 3: echo "<h3>".__("SNMP information for "). $ip. "</h3>";
echo "<h4>Uptime</h4>";
echo "<pre>";
echo exec ("snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
echo "</pre>";
echo "<h4>Device info</h4>";
echo "<pre>";
echo system ("snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
echo "</pre>";
echo "<h4>Interface Information</h4>";
echo "<table class=databox>";
echo "<tr><th>".__("Interface");
echo "<th>".__("Status");
$int_max = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
for ($ax=0; $ax < $int_max; $ax++){
$interface = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax ");
$estado = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax ");
echo "<tr><td>$interface<td>$estado";
}
echo "</table>";
break;
}
echo "</div>";
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B