3CDSG8
Jump to navigation
Jump to search
Munin plugin supporting the 3COM 3CDSG8 port statistics.
switch_info
This plugin reports 3COM 3CDSG port statistics. The plugin should be saved with a filename 'switch_info___' (triple underscore at the end is intentional and a link can then be generated in the munin plugins directory for each port requiring monitoring:
ln -s /path/switch_info___ /etc/munin/plugins/switch_info_192.168.3.2_101_modem
or:
ln -s /path/switch_info___ /etc/munin/plugins/switch_info_enet-switch_107_ps3
assuming that 'enet-switch' will resolve in your DNS to the IP of the required device.
The three parameters at the end of each link are:
- the name or IP address of your 3CDSG switch
- the port number this entry is referring to (e.g. 101 through 108 for the 3CDSG8)
- the shorthand name for the device connected to this port (no spaces or _ in the name)
#!/bin/sh # # Plugin to report switch port statistics. # # Contributed by Tim Chappell # # Magic markers - optional - used by installation scripts and # munin-config: # #%# family=manual #%# capabilities=autoconf IP_P_ALIAS=${0##*/switch-info_} # echo $IP_P_ALIAS ALIAS=${IP_P_ALIAS##*_} # echo $ALIAS SWITCH=${IP_P_ALIAS%%_[0-9]*_$ALIAS} # echo $SWITCH PORT_ALIAS=${IP_P_ALIAS:(`expr length $SWITCH - length $IP_P_ALIAS + 1`)} PORT=${PORT_ALIAS%%_$ALIAS} # echo $PORT if [ "$1" = "config" ]; then echo 'graph_category switch' echo 'graph_title Switch Port ('$PORT') ['$ALIAS'] I/O' echo 'graph_vlabel Counts per second' # echo 'graph_period minute' echo 'graph_args --base 1024 -l 0 ' echo 'switch_port_'$PORT'_in.label Port input (octets)' echo 'switch_port_'$PORT'_in.draw LINE1' echo 'switch_port_'$PORT'_in.type COUNTER' echo 'switch_port_'$PORT'_in_uni.label Port input unicast (packets)' echo 'switch_port_'$PORT'_in_uni.draw LINE1' echo 'switch_port_'$PORT'_in_uni.type COUNTER' echo 'switch_port_'$PORT'_in_nonuni.label Port input non-unicast (packets)' echo 'switch_port_'$PORT'_in_nonuni.draw LINE1' echo 'switch_port_'$PORT'_in_nonuni.type COUNTER' echo 'switch_port_'$PORT'_in_discards.label Port input discards (octets)' echo 'switch_port_'$PORT'_in_discards.draw LINE1' echo 'switch_port_'$PORT'_in_discards.type COUNTER' echo 'switch_port_'$PORT'_in_errors.label Port input errors (octets)' echo 'switch_port_'$PORT'_in_errors.draw LINE1' echo 'switch_port_'$PORT'_in_errors.type COUNTER' echo 'switch_port_'$PORT'_in_unknown.label Port input unknown protocols (octets)' echo 'switch_port_'$PORT'_in_unknown.draw LINE1' echo 'switch_port_'$PORT'_in_unknown.type COUNTER' echo 'switch_port_'$PORT'_out.label Port output (octets)' echo 'switch_port_'$PORT'_out.draw LINE1' echo 'switch_port_'$PORT'_out.type COUNTER' echo 'switch_port_'$PORT'_out_uni.label Port output unicast (packets)' echo 'switch_port_'$PORT'_out_uni.draw LINE1' echo 'switch_port_'$PORT'_out_uni.type COUNTER' echo 'switch_port_'$PORT'_out_nonuni.label Port output non-unicast (packets)' echo 'switch_port_'$PORT'_out_nonuni.draw LINE1' echo 'switch_port_'$PORT'_out_nonuni.type COUNTER' echo 'switch_port_'$PORT'_out_discards.label Port output discards (octets)' echo 'switch_port_'$PORT'_out_discards.draw LINE1' echo 'switch_port_'$PORT'_out_discards.type COUNTER' echo 'switch_port_'$PORT'_out_errors.label Port output errors (octets)' echo 'switch_port_'$PORT'_out_errors.draw LINE1' echo 'switch_port_'$PORT'_out_errors.type COUNTER' echo 'switch_port_'$PORT'_out_qlen.label Port output queue length (octets)' echo 'switch_port_'$PORT'_out_qlen.draw LINE1' echo 'switch_port_'$PORT'_out_qlen.type COUNTER' exit 0 fi /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifInOctets.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_in.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifInUcastPkts.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_in_uni.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifInNUcastPkts.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_in_nonuni.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifInDiscards.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_in_discards.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifInErrors.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_in_errors.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifInUnknownProtos.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_in_unknown.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifOutOctets.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_out.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifOutUcastPkts.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_out_uni.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifOutNUcastPkts.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_out_nonuni.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifOutDiscards.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_out_discards.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifOutErrors.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_out_errors.value %s\n",$NF}' /usr/bin/snmpget -c public -v 1 $SWITCH "IF-MIB::ifOutQLen.$PORT" | /usr/bin/awk -vp=$PORT '{printf "switch_port_"p"_out_qlen.value %s\n",$NF}'
This website publishes a Privacy Policy (link at the bottom of every page). Continued use of this website implies your consent to the use of data outlined in the policy.