Files
scripts-conlxsyslog03/mon_if.sh
conetadm 5718e70f15 init
2024-11-14 21:11:06 +01:00

32 lines
863 B
Bash
Executable File

#!/bin/bash
if [ "$#" -lt "3" ]
then
echo ""
echo "Interfaces auflisten"
echo "mon_if.sh <IP> <community> list"
echo ""
echo "Graphen starten"
echo "mon_if.sh <IP> <community> <Intervall in Sekunden> <Anzeigedauer in Minuten> <Interface Name>"
echo ""
echo ""
exit 1
fi
if [ "$3" == "list" ]
then
echo "$1 Interfaces:"
echo ""
snmpwalk -c$2 -v2c $1 1.3.6.1.2.1.2.2.1.2 | grep -oP "STRING: \K.*"
echo ""
echo ""
exit
fi
IFID=`snmpwalk -c$2 -v2c $1 1.3.6.1.2.1.2.2.1.2 | grep "$5" | grep -oP "\.\K\d*"`
./snmprtg --quiet --title "$1 Input "$5" ($IFID)" --peer $1 --community $2 --interval $3 --window $4 --oid 1.3.6.1.2.1.2.2.1.10.$IFID --log 1 2>&1 >/dev/null &
./snmprtg --quiet --title "$1 Output "$5" ($IFID)" --peer $1 --community $2 --interval $3 --window $4 --oid 1.3.6.1.2.1.2.2.1.16.$IFID --log 1 2>&1 >/dev/null &
echo ""
echo ""
exit