[mrtg] GRE Tunnel mrtg traffic
Jan Ferré
Jan.Ferre at uni-c.dk
Mon Nov 2 12:03:58 CET 2009
Mohamed Sangey wrote:
> Hi,
>
> Router has 4 switch ports 0,1,2,3 and WAN port int fa 4 which shows as port 5 when I fire mrtg for that. This is router cisco 871.
>
I use this script (requires snmp-tools) to see which interfaces are
available:
#!/bin/bash
# Generates a list of interfaces on a Cisco router
ROUTER=$1
COM=$2
COM=${COM:-public}
snmpwalk -v1 -c $COM $ROUTER IF-MIB::ifIndex | \
cut -d " " -f4 | \
while read index
do
speed=`snmpget -v1 -c $COM $ROUTER IF-MIB::ifSpeed.$index | cut
-d " " -f4`
name="`snmpget -v1 -c $COM $ROUTER IF-MIB::ifAlias.$index | cut
-d " " -f4-10`"
name=${name:-"Without name"}
desc="`snmpget -v1 -c $COM $ROUTER IF-MIB::ifDescr.$index | cut
-d " " -f4`"
echo $ROUTER $desc: $name, $speed - snmpindex $index
done
exit 0
This basicly makes a list of all possible interfaces (the snmpwalk
command) and for each interface gets speed, name and description.
This may give a reply like:
130.226.255.17 Vlan1: Forskerparken Symbion (Kontakt IT Afdelingen),
1000000000 - snmpindex 1
130.226.255.17 Vlan2: Uden navn, 1000000000 - snmpindex 2
130.226.255.17 GigabitEthernet0/1: Forskerparken Symbion (Kontakt IT
Afdelingen), 1000000000 - snmpindex 10101
130.226.255.17 GigabitEthernet0/2: Forskerparken Symbion (Kontakt IT
Afdelingen), 10000000 - snmpindex 10102
130.226.255.17 GigabitEthernet0/3: FSKNET SYMBION-DPU, 1000000000 -
snmpindex 10103
130.226.255.17 GigabitEthernet0/4: FSKNET SYMBION-VER Fiber, 1000000000
- snmpindex 10104
130.226.255.17 Null0: Uden navn, 4294967295 - snmpindex 10501
130.226.255.17 FastEthernet0: Uden navn, 100000000 - snmpindex 10502
130.226.255.17 Loopback1: ID, 4294967295 - snmpindex 20567
Please note the 'weird' snmpindexes - and those are the ones to be used
in mrtg.
Jan Ferré
--
Jan Ferré - UNI-C Netdrift - DTU Bygning 304, DK-2800 Lyngby
tlf. +45 3587 8935, cell. +45 2160 8012, fax. +45 3587 8990
EAN-no.: 5798000555198
More information about the mrtg
mailing list