diff options
author | Joachim Tingvold <joachim@tingvold.com> | 2015-03-31 05:09:33 +0200 |
---|---|---|
committer | Joachim Tingvold <joachim@tingvold.com> | 2015-03-31 05:09:33 +0200 |
commit | 381e194162092e6ca6d1da2248a41af8b4f7208d (patch) | |
tree | 224c1f7003a1ff3f9a5f4d844c1bea3c86f88958 /tools | |
parent | 191df1949e2e05eb20b49d5cb31afc7a1f70da91 (diff) | |
parent | e3d7c5cc86fedb458d9b091ca12245c01e7f285d (diff) |
Merge branch 'master' of github.com:tech-server/tgmanage
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/fetch-portlist.sh | 2 | ||||
-rwxr-xr-x | tools/make-switch-placements.pl | 2 | ||||
-rwxr-xr-x | tools/make-switches.pl | 8 |
3 files changed, 7 insertions, 5 deletions
diff --git a/tools/fetch-portlist.sh b/tools/fetch-portlist.sh index 94ca41c..978b590 100755 --- a/tools/fetch-portlist.sh +++ b/tools/fetch-portlist.sh @@ -15,7 +15,7 @@ walk_ports() { FIRST_PORT= LAST_PORT= - for PORT in $( snmpwalk -Os -m IF-MIB -v 2c -c $COMMUNITY $IP ifDescr 2>/dev/null | grep -E 'GigE|Ethernet' | cut -d. -f2 | cut -d" " -f1 ); do + for PORT in $( snmpwalk -Os -m IF-MIB -v 2c -c $COMMUNITY $IP ifDescr 2>/dev/null | grep -E ' ge|et|xe' | cut -d. -f2 | cut -d" " -f1 ); do if ! snmpget -m IF-MIB -v 2c -c $COMMUNITY $IP ifHCInOctets.$PORT 2>/dev/null | grep -q 'No Such Instance'; then if [ "$LAST_PORT" ] && [ `expr $LAST_PORT + 1` = $PORT ]; then LAST_PORT=$PORT diff --git a/tools/make-switch-placements.pl b/tools/make-switch-placements.pl index fe33c73..878b00e 100755 --- a/tools/make-switch-placements.pl +++ b/tools/make-switch-placements.pl @@ -2,7 +2,7 @@ use strict; use warnings; -my $switchtype = "dlink3100"; +my $switchtype = "ex2200"; print "begin;\n"; print "delete from placements where switch in (select switch from switches where switchtype = '$switchtype');\n"; diff --git a/tools/make-switches.pl b/tools/make-switches.pl index a2f5d22..beb4343 100755 --- a/tools/make-switches.pl +++ b/tools/make-switches.pl @@ -2,7 +2,7 @@ use strict; use warnings; -my $switchtype = "dlink3100"; +my $switchtype = "ex2200"; print "begin;\n"; print "delete from temppoll;\n"; @@ -22,8 +22,10 @@ while (<STDIN>) { } my $name = $info[0]; - my $range = $info[3]; - my $ip = $info[4]; + my $range = $info[1]; + my $ip = $info[3]; + $ip =~ s/\/.*$//; + print "insert into switches (ip, sysname, switchtype) values ('$ip', '$name', '$switchtype');\n"; print "insert into dhcp select switch, '$range' from switches where sysname = '$name';\n"; |