Ejemplo n.º 1
0
<th>
Device
<select size="1" name="dev" onchange="document.stree.vln.value=''">
<option value=""><?= $sellbl ?> ->
<?php
$link	= DbConnect($dbhost,$dbuser,$dbpass,$dbname);
$query	= GenQuery('devices','s','device,devip,services,snmpversion,readcomm,location,contact,cliport,icon','device','',array('services & 2','snmpversion'),array('=','!='),array('2','0'),array('AND') );
$res	= DbQuery($query,$link);
if($res){
	while( ($d = DbFetchRow($res)) ){
		echo "<option value=\"$d[0]\" ";
		if($dev == $d[0]){
			echo "selected";
			$ud	= urlencode($d[0]);
			$ip	= long2ip($d[1]);
			$sv	= Syssrv($d[2]);
			$rv	= $d[3] & 3;
			$rc	= $d[4];
			$loc	= $d[5];
			$con	= $d[6];
			$cli	= $d[7];
			$img	= $d[8];
		}
		echo " >$d[0]\n";
	}
	DbFreeResult($res);
}else{
	print DbError($link);
}
echo "</select>";
if ($dev) {
Ejemplo n.º 2
0
        if ($nho == $dst or $currtr == $netif[$nho]) {
            // We either reached the destination or an unkown device
            break;
        } else {
            $path .= "-> ";
        }
        $lnet = $nho;
        $currtr = $netif[$nho];
    }
    ?>
</table>
<?php 
    echo "</table><table bgcolor=#666666 {$tabtag} >\n";
    echo "<tr bgcolor=#{$bg2}><td>{$row} hops ({$path})</td></tr></table>\n";
} elseif ($rtr) {
    $sv = Syssrv($devsrv[$rtr]);
    ?>
<h2><?php 
    echo $rtr;
    ?>
 Routing Table</h2>
<table bgcolor=#666666 <?php 
    echo $tabtag;
    ?>
 >
<tr bgcolor=#<?php 
    echo $bg2;
    ?>
>
<th colspan=2><img src=img/32/nglb.png><br>Destination</th>
<th><img src=img/32/neti.png ><br>Next Hop</th>
Ejemplo n.º 3
0
    @DbFreeResult($res);
    $query = GenQuery('networks', 's', '*', '', '', array('device'), array('='), array($shd));
    $res = @DbQuery($query, $link);
    while ($n = @DbFetchRow($res)) {
        $net[$n[1]][$n[2]] = ip2long(long2ip($n[3]));
        // thanks again PHP (for increased grey hair count to fix netmask)!
    }
    @DbFreeResult($res);
    $ud = rawurlencode($dev[0]);
    $ip = $dev[1] ? long2ip($dev[1]) : 0;
    $oi = $dev[19] ? long2ip($dev[19]) : 0;
    $img = $dev[18];
    list($fc, $lc) = Agecol($dev[4], $dev[5], 0);
    $fs = date($datfmt, $dev[4]);
    $ls = date($datfmt, $dev[5]);
    $sv = Syssrv($dev[6]);
    $os = $dev[8];
    $comm = $dev[15];
    $ver = $dev[14] & 127;
    ?>
<table cellspacing=10 width=100%>
<tr><td width=50% valign=top>
<h2>General Info</h2><p>
<table bgcolor=#666666 <?php 
    echo $tabtag;
    ?>
 >
<tr>
<th bgcolor=#<?php 
    echo $bia;
    ?>
Ejemplo n.º 4
0
$res = DbQuery($query, $link);
if ($res) {
    while ($r = DbFetchRow($res)) {
        $netif[long2ip($r[2])] = $r[0];
    }
    DbFreeResult($res);
} else {
    print DbError($link);
}
$query = GenQuery('devices', 's', 'device,devip,type,services,readcomm,snmpversion,location,contact,cliport,icon', 'device', '', array('services', 'snmpversion'), array('>', '!='), array('3', '0'), array('AND'));
$res = DbQuery($query, $link);
if ($res) {
    while ($d = DbFetchRow($res)) {
        $devip[$d[0]] = long2ip($d[1]);
        $devtyp[$d[0]] = $d[2];
        $devsrv[$d[0]] = Syssrv($d[3]);
        $devcom[$d[0]] = $d[4];
        $devver[$d[0]] = $d[5] & 3;
        # TODO force ver1 for broken devices (my c2610)?
        $devloc[$d[0]] = $d[6];
        $devcon[$d[0]] = $d[7];
        $devcli[$d[0]] = $d[8];
        $devimg[$d[0]] = $d[9];
    }
    DbFreeResult($res);
} else {
    print DbError($link);
}
?>
<h1><?php 
echo $mtitl[0];
Ejemplo n.º 5
0
</tr>
<?}?>
<tr>

<th class="<?= $modgroup[$self] ?>2"><?= $srvlbl ?></th><td class="txta">
<div style="float:right">
<?php  if($dev[6] > 3) { ?>
<a href="Topology-Routes.php?rtr=<?= $ud ?>"><img src="img/16/rout.png" title="Topology-Routes"></a>
<a href="Topology-Multicast.php?dev=<?= $ud ?>"><img src="img/16/cam.png" title="Topology-Multicast <?= $lstlbl ?>"></a>
<?}
if($dev[6] & 2) { ?>
<a href="Topology-Spanningtree.php?dev=<?= $ud ?>"><img src="img/16/traf.png" title="Topology-Spanningtree"></a>
<?}?>
</div>
<?=Syssrv($dev[6]) ?>
</td></tr>

<tr><th class="<?= $modgroup[$self] ?>2"><?= $dsclbl ?></th><th class="txtb">
<span style="border:1px solid black;border-radius: 6px;padding : 0 3px;background-color: #<?= $fc ?>" title="<?= $fislbl ?>"> <?= $fs ?> </span>
<?= Bar( intval(($dev[5]-$dev[4])/86400),0,'mi',$tim[d]) ?>
<span style="border:1px solid black;border-radius: 6px;padding : 0 3px;background-color:#<?= $lc ?>" title="<?= $laslbl ?>"> <?= $ls ?> </span>
</th></tr>

<tr><th class="<?= $modgroup[$self] ?>2">Bootimage</th>	<td class="txta"><a href="Reports-Devices.php?in[]=bootimage&op[]=%3D&st[]=<?= urlencode($dev[9]) ?>&rep[]=sft"><?= $dev[9] ?></a> (<a href="Reports-Devices.php?in[]=devos&op[]=%3D&st[]=<?= urlencode($os) ?>&rep[]=sft"><?= $os ?></a>)</td></tr>
<tr><th class="<?= $modgroup[$self] ?>2"><?= $serlbl ?></th>
<td class="txtb">
<?php
	if($us){
		$query	= GenQuery('stock','s','*','','',array('serial'),array('='),array($dev[2]) );
		$res	= DbQuery($query,$link);
Ejemplo n.º 6
0
function DevType($ina, $opa, $sta, $lim, $ord)
{
    global $link, $modgroup, $self, $typlbl, $srtlbl, $lstlbl, $srvlbl, $qtylbl, $invlbl, $totlbl, $opt;
    ?>
<table class="full fixed"><tr><td class="helper">

<h2>Device <?php 
    echo $typlbl;
    ?>
</h2>

<canvas id="typpie" style="display: block;margin: 0 auto;padding: 10px;" width="400" height="300"></canvas>

<table class="content">
<tr class="<?php 
    echo $modgroup[$self];
    ?>
2">
<th colspan="2" width="33%"><img src="img/16/abc.png"><br><?php 
    echo $typlbl;
    ?>
</th>
<th><img src="img/16/dev.png"><br>Devices</th>
</tr>
<?php 
    if ($ord) {
        $ocol = 'type';
        $srt = "{$srtlbl}: {$typlbl}";
    } else {
        $ocol = ($opt ? 'sum' : 'cnt') . " desc";
        $srt = "{$srtlbl}: {$qtylbl}";
    }
    if ($opt) {
        $rcol = 3;
        $ftlbl = "{$typlbl} (Stacked)";
        $query = GenQuery('devices', 'g', 'type,icon;sum(stack) AS sum', $ocol, $lim, array($ina), array($opa), array($sta));
    } else {
        $rcol = 2;
        $ftlbl = $typlbl;
        $query = GenQuery('devices', 'g', 'type,icon', $ocol, $lim, array($ina), array($opa), array($sta));
    }
    $res = DbQuery($query, $link);
    if ($res) {
        $row = 0;
        $chd = array();
        while ($r = DbFetchRow($res)) {
            if ($row % 2) {
                $bg = "txta";
                $bi = "imga";
            } else {
                $bg = "txtb";
                $bi = "imgb";
            }
            $row++;
            $utyp = urlencode($r[0]);
            $chd[] = array('value' => $r[$rcol], 'color' => GetCol('trf', $row));
            echo "<tr class=\"{$bg}\"><th class=\"{$bi}\" width=\"10%\">\n";
            echo "<img src=\"img/dev/{$r['1']}.png\" title=\"{$r['0']}\"></th><td>{$r['0']}</td>\n";
            echo "<td>" . Bar($r[$rcol], GetCol('trf', $row), 'ls') . " <a href=\"Devices-List.php?in[]=type&op[]==&st[]={$utyp}\" title=\"Device {$lstlbl}\">{$r[$rcol]}</a></td></tr>\n";
        }
        DbFreeResult($res);
    }
    ?>
</table>
<table class="content" >
<tr class="<?php 
    echo $modgroup[$self];
    ?>
2"><td><?php 
    echo $row;
    ?>
 <?php 
    echo $ftlbl;
    ?>
, <?php 
    echo $srt;
    ?>
</td></tr>
</table>

<script language="javascript">
var data = <?php 
    echo json_encode($chd, JSON_NUMERIC_CHECK);
    ?>

var ctx = document.getElementById("typpie").getContext("2d");
var myNewChart = new Chart(ctx).Pie(data);
</script>

</td><td class="helper">

<h2>Device <?php 
    echo $srvlbl;
    ?>
</h2>

<canvas id="srvpie" style="display: block;margin: 0 auto;padding: 10px" width="400" height="300"></canvas>

<table class="content">
<tr class="<?php 
    echo $modgroup[$self];
    ?>
2">
<th><img src="img/16/cog.png"><br><?php 
    echo $srvlbl;
    ?>
</th>
<th><img src="img/16/dev.png"><br>Devices</th>
</tr>
<?php 
    if ($ord) {
        $ocol = 'services';
        $srt = "{$srtlbl}: {$srvlbl}";
    } else {
        $ocol = ($opt ? 'sum' : 'cnt') . " desc";
        $srt = "{$srtlbl}: {$qtylbl}";
    }
    if ($opt) {
        $rcol = 2;
        $ftlbl = "{$srvlbl} (Stacked)";
        $query = GenQuery('devices', 'g', 'services;sum(stack) AS sum', $ocol, $lim, array($ina), array($opa), array($sta));
    } else {
        $rcol = 1;
        $ftlbl = $srvlbl;
        $query = GenQuery('devices', 'g', 'services', $ocol, $lim, array($ina), array($opa), array($sta));
    }
    $res = DbQuery($query, $link);
    if ($res) {
        $row = 0;
        $chd = array();
        while ($r = DbFetchRow($res)) {
            if ($row % 2) {
                $bg = "txta";
                $bi = "imga";
            } else {
                $bg = "txtb";
                $bi = "imgb";
            }
            $row++;
            $o = "=";
            if (!$r[0]) {
                $r[0] = "^\$";
                $o = "~";
            }
            $chd[] = array('value' => $r[$rcol], 'color' => GetCol('152', $row, 1));
            echo "<tr class=\"{$bg}\"><td>" . Syssrv($r[0]) . " ({$r['0']})</td>\n";
            echo "<td>" . Bar($r[$rcol], GetCol('152', $row, 1), 'ls') . " <a href=\"Devices-List.php?in[]=services&op[]={$o}&st[]=" . urlencode($r[0]) . "\">{$r[$rcol]}</a></td></tr>\n";
        }
        DbFreeResult($res);
    }
    ?>
</table>
<table class="content" >
<tr class="<?php 
    echo $modgroup[$self];
    ?>
2"><td><?php 
    echo $row;
    ?>
 <?php 
    echo $ftlbl;
    ?>
, <?php 
    echo $srt;
    ?>
</td></tr>
</table>

<script language="javascript">
var data = <?php 
    echo json_encode($chd, JSON_NUMERIC_CHECK);
    ?>

var ctx = document.getElementById("srvpie").getContext("2d");
var myNewChart = new Chart(ctx).Pie(data);
</script>

</td></tr></table>
<p>
<?php 
}
Ejemplo n.º 7
0
					$dvip = Devcli( $ip, $dev[16] );
					if( !in_array("device",$col) ){$dvip .= " ($dev[0])";}
					TblCell($dvip);
				}
				if(in_array("origip",$col)){
					TblCell( Devcli($oi,$dev[16]) );
				}
				if(in_array("serial",$col)){
					TblCell($dev[2]);
				}
				if(in_array("type",$col)){
					list($vn,$ic) = DevVendor($dev[25],substr($dev[18],2,1) );
					TblCell( $dev[3],"?in[]=type&op[]==&st[]=".urlencode($dev[3]),'',"<a href=\"http://www.google.com/search?q=".urlencode($dev[3])."&btnI=1\" target=\"window\"><img src=\"img/oui/$ic.png\" title=\"$vn\"></a> ");
				}
				if(in_array("services",$col)){
					TblCell( Syssrv($dev[6])." ($dev[6])","?in[]=services&op[]==&st[]=$dev[6]");
				}
				if(in_array("description",$col)){
					TblCell($dev[7]);
				}
				if(in_array("devos",$col)){
					TblCell( $dev[8],"?in[]=devos&op[]==&st[]=".urlencode($dev[8]) );
				}
				if(in_array("bootimage",$col)){
					TblCell( $dev[9],"?in[]=bootimage&op[]==&st[]=".urlencode($dev[9]) );
				}
				if(in_array("location",$col)){
					TblCell( $dev[10],"?in[]=location&op[]==&st[]=".urlencode($dev[10]) );
				}
				if(in_array("contact",$col)){
					TblCell( $dev[11],"?in[]=contact&op[]==&st[]=".urlencode($dev[11]) );
<th>
Switch
<select size=1 name="dev" onchange="document.stree.vln.value=''">
<option value="">---
<?php 
$link = @DbConnect($dbhost, $dbuser, $dbpass, $dbname);
$query = GenQuery('devices', 's', '*', '', '', array('services & 2'), array('='), array('2'));
$res = @DbQuery($query, $link);
if ($res) {
    while ($d = @DbFetchRow($res)) {
        echo "<option value=\"{$d['0']}\" ";
        if ($dev == $d[0]) {
            echo "selected";
            $img = $d[18];
            $ip = long2ip($d[1]);
            $sv = Syssrv($d[6]);
            $comm = $d[15];
        }
        echo " >{$d['0']}\n";
    }
    @DbFreeResult($res);
} else {
    print @DbError($link);
}
echo "</select>";
if ($dev) {
    $query = GenQuery('vlans', 's', '*', '', '', array('device'), array('='), array($dev));
    $res = @DbQuery($query, $link);
    $nvln = @DbNumRows($res);
    if ($res and $nvln) {
        ?>