Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <pre>
- /*******************************************
- * Author : Diego Cordoba / @d1cor *
- * Contact : d1cor.com.ar *
- *******************************************/
- </pre>
- <?php
- $target_ip=$_GET['ip'];
- $community=$_GET['c'];
- $arreglo = snmprealwalk($target_ip, $community, "dsk");
- foreach($arreglo as $clave => $valor){
- $variableSnmp=explode("::",$clave);
- $valorSnmp=explode(": ",$valor);
- $var=explode(".",$variableSnmp[1]);
- $arregloDisk[$var[0]][$var[1]]=$valorSnmp[1];
- }
- echo "<h2>Remote FS query via snmp protocol</h2>";
- echo "<table border=1><tr><th>FileSystem</th><th>Size</th><th>Used</th><th>Avail</th><th>Percent</th><th>MounPoint \n</th></tr>";
- foreach($arregloDisk['dskDevice'] as $disco => $valor){
- echo "<tr><td align=left>".$arregloDisk["dskDevice"][$disco]."</td>";
- echo "<td>".tamanio($arregloDisk["dskTotal"][$disco])."</td>";
- echo "<td>".tamanio($arregloDisk["dskUsed"][$disco])."</td>";
- echo "<td>".tamanio($arregloDisk["dskAvail"][$disco])."</td>";
- echo "<td>".$arregloDisk["dskPercent"][$disco]." %</th>";
- echo "<td align=left>".$arregloDisk["dskPath"][$disco]."\n</td></tr>";
- }
- function tamanio($valor){
- $giga=1024*1024;
- if($valor>$giga)
- return round($valor/$giga,1)." GB";
- else
- return round($valor/1024,1)." MB";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement