Mise jour du comptage pour mrtg

--
Fred

darcs-hash:20031208002347-41617-45bce0836fb9173c00e0f05cd7f92f49f05fb9f5.gz
This commit is contained in:
pauget 2003-12-08 01:23:47 +01:00
parent d976df6857
commit f8f65a3212

View file

@ -1,16 +1,17 @@
#!/bin/sh
############################################################################
# Script de requette snmp pour le monitoring des ports du switch Backbone #
# Modèle D-Link DES-5220 #
# Script de requette snmp pour le monitoring des ports des switchs #
# #
# Nicolas Stransky, juin 2k1 #
# Mise à jour pour switchs HP en snmpv3, Fred décembre 2003 #
############################################################################
. /root/snmp-community-names
HOSTNAME=backbone
COMMUNITY=$BACKBONE_COMMUNITY
HOSTNAME=microrep
COMMUNITY=$OLD_BACKBONE_COMMUNITY
USERNAME=$BACKBONE_USER
MIBFILE=/usr/scripts/snmp/Des5200.mib
test -f $MIBFILE || exit 0
@ -30,19 +31,24 @@ GETINVALUE() {
snmpget -m $MIBFILE $HOSTNAME $COMMUNITY interfaces.ifTable.ifEntry.ifInOctets.$1 | awk '{print $4}'
}
case "$1" in
bata)
GETVALUES $1 5
;;
batb)
# 4 uplinks du B (trunk)
echo " $(GETOUTVALUE 9) + $(GETOUTVALUE 10) + $(GETOUTVALUE 11) + $(GETOUTVALUE 12) " | bc
echo " $(GETINVALUE 9) + $(GETINVALUE 10) + $(GETINVALUE 11) + $(GETINVALUE 12)" | bc
# La même chose en snmpv3
GETVALUES3() {
snmpget -v 3 $2 -u $USERNAME interfaces.ifTable.ifEntry.ifOutOctets.$3 | awk '{print $4}'
snmpget -v 3 $2 -u $USERNAME interfaces.ifTable.ifEntry.ifInOctets.$3 | awk '{print $4}'
echo ""
echo "$1"
}
case "$1" in
bata)
GETVALUES3 $1 backbone 79
;;
batb)
GETVALUES3 $1 backbone 80
;;
batc)
GETVALUES $1 20
GETVALUES3 $1 backbone 81
;;
batg)
# 2 uplinks du G
@ -50,30 +56,28 @@ case "$1" in
echo " $(GETINVALUE 13) + $(GETINVALUE 14) " | bc
echo ""
echo "$1"
# GETVALUES $1 13
;;
batp)
GETVALUES $1 6
GETVALUES3 $1 multiprise 24
;;
batm)
echo " $(GETOUTVALUE 15) + $(GETOUTVALUE 16) " | bc
echo " $(GETINVALUE 15) + $(GETINVALUE 16) " | bc
echo ""
echo "$1"
# GETVALUES $1 16
;;
bath)
GETVALUES $1 17
;;
bati)
GETVALUES $1 18
GETVALUES3 $1 multiprise 14
;;
batj)
GETVALUES $1 19
;;
*)
echo "Monitoring du switch backbone par snmp. Voir /etc/mrtg.cfg"
echo "Monitoring des switchs par snmp. Voir /etc/mrtg.cfg"
echo "Usage : /usr/scripts/snmp/bat.sh bata|batb|batc|batg|bath|bati|batj|batm|batp">&2
exit 1
;;