switches |
Subversion Repositories: |
Rev 7 | Rev 9 | |
---|---|---|
Line 3... | Line 3... | |
# |
# | |
# Petr Simandl, www.simandl.cz |
# Petr Simandl, www.simandl.cz | |
|
| |
my $snmpwalk = "/usr/bin/snmpwalk"; |
my $snmpwalk = "/usr/bin/snmpwalk"; | |
|
| |
my %map = ( |
my %map = do("/etc/switches_definitions.conf"); | |
"edimax_es-3116p" => [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], |
||
], |
||
"repotec_g3224x" => [[1,2,3,4,5,6,7,8,9,10,11,12,0,0], |
||
[13,14,15,16,17,18,19,20,21,22,23,24,25,26], |
||
], |
||
"repotec_RP-6326I" => [[1,2,3,4,5,6,7,8,9,10,11,12,0,0], |
||
[13,14,15,16,17,18,19,20,21,22,23,24,25,26], |
||
], |
||
"repotec_RP-G2402I"=> [[1,2,3,4,5,6,7,8,9,10,11,12], |
||
[13,14,15,16,17,18,19,20,21,22,23,24], |
||
], |
||
"repotec_GEL2-SW8" => [[1,2,3,4,5,6,7,8], |
||
], |
||
"repotec_10G" => [[1,2,3,4,5,6,7,8,9,10], |
||
], |
||
"linksys_SRW224G4" => [[1,2,3,4,5,6,7,8,9,10,11,12,25,27], |
||
[13,14,15,16,17,18,19,20,21,22,23,24,26,28], |
||
], |
||
"SMCGS24C" => [[1,2,3,4,5,6,7,8,9,10,11,12], |
||
|
||
[13,14,15,16,17,18,19,20,21,22,23,24,21,22,23,24], |
||
|
||
], |
||
"tplink_SG5426" => [[1,3,5,7,9,11,13,15,17,19,21,23,25,26,0,0], |
||
[2,4,6,8,10,12,14,16,18,20,22,24,21,22,23,24], |
||
], |
||
"TL-SL3452" => [[1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,0,0], |
||
[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,51,52], |
||
], |
||
"TL-SL3428" => [[1,3,5,7,9,11,13,15,17,19,21,23,25,0,0], |
||
[2,4,6,8,10,12,14,16,18,20,22,24,26,27,28], |
||
], |
||
"TL-SG3424" => [[2,4,6,8,10,12,14,16,18,20,22,24], |
||
[1,3,5,7,9,11,13,15,17,19,21,23], |
||
], |
||
"NetGear" => [[1,2,3,4,5,6,7,8,9,10,11,12], |
||
], |
||
"HuaS5624P" => [[4227625,4227641,4227657,4227673,4227689,4227705,4227721,4227737,4227753,4227769,4227785,4227801,0,0,0,0], |
||
[4227633,4227649,4227665,4227681,4227697,4227713,4227729,4227745,4227761,4227777,4227793,4227809,4227817,4227825,4227833,4227841], |
||
], |
||
"C4900MNFX1" => [[63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,54,90,121,0], |
||
[132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,55,56,57,58,59,60,61,62], |
||
], |
||
"C4900MNFX2" => [[60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,51,87,123,0], |
||
[133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,52,53,54,55,56,57,58,59], |
||
], |
||
); |
||
|
| |
my @ports = (); |
my @ports = (); | |
my @sw = (); |
my @sw = (); | |
my %sw_d = (); |
my %sw_d = (); | |
|
| |
Line 145... | Line 98... | |
my $enab = ""; |
my $enab = ""; | |
my $mod = ""; |
my $mod = ""; | |
my $stat = ""; |
my $stat = ""; | |
my $link = ""; |
my $link = ""; | |
my $flow = ""; |
my $flow = ""; | |
my $port = 0; |
my $port = ""; | |
my $portlink = ""; | ||
my @row = (); |
my @row = (); | |
my @pole = (); |
my @pole = (); | |
|
| |
my $porty=`sudo $bin $mac\@$if show int | grep ^$if | sed 's/://g' | sed 's/$if\\///g'`; |
my $porty=`sudo $bin $mac\@$if show int | grep ^$if | sed 's/://g' | sed 's/$if\\///g'`; | |
print "<b>$desc</b> $mac"; |
print "<b>$desc</b> $mac"; | |
Line 313... | Line 267... | |
if ($enab =~ /^up/) {$e = "E";} else {$e = "D";} |
if ($enab =~ /^up/) {$e = "E";} else {$e = "D";} | |
if (defined($sw_d->{$myip}[$port])) {$label = $sw_d->{$myip}[$port];} |
if (defined($sw_d->{$myip}[$port])) {$label = $sw_d->{$myip}[$port];} | |
else { $label = ""; } |
else { $label = ""; } | |
$hip = $myip; |
$hip = $myip; | |
$hip =~ s/\./_/g; |
$hip =~ s/\./_/g; | |
print_port_graph("10.33.0.23","${hip}_${port}.html","${hip}_${port}-day.png","$myip port $port $label","$port $label"); |
my $portln = $port; | |
$portln =~ s/\//-/g; | ||
print_port_graph("10.33.0.23","${hip}_${portln}.html","${hip}_${portln}-day.png","$myip port $port $label","$port $label"); | ||
print "<br />$e $stat<br />\n"; |
print "<br />$e $stat<br />\n"; | |
print "<pre>"; |
print "<pre>"; | |
foreach $mac (@{ $mactab{$port} }) { |
foreach $mac (@{ $mactab{$port} }) { | |
if (exists $pole_dhcpdhosts{$mac}) { |
if (exists $pole_dhcpdhosts{$mac}) { | |
$barva = "black"; |
$barva = "black"; |