| Server IP : 118.27.122.120 / Your IP : 216.73.216.136 Web Server : Apache System : Linux web0216.sh.tyo1 4.18.0-553.141.2.lve.el7h.x86_64 #1 SMP Wed Jul 8 17:20:31 UTC 2026 x86_64 User : r4834334 ( 11094) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/proc/thread-self/root/lib64/nagios/plugins/ |
Upload File : |
#/bin/bash
SNMPWALK=/bin/snmpwalk
GREP=/bin/GREP
SED=/bin/sed
CHECK_SNMP=/usr/lib64/nagios/plugins/check_snmp
COMMUNITY=nrpen8AD9WWkWaAWde_h
DIRECTION=Out
## getopts
usage_exit() {
echo "Usage: $0 [-C SNMP_community_name] [-ii] -I interface_name" 1>&2
exit 1
}
while getopts C:ioI:h OPT
do
case $OPT in
C) COMMUNITY=$OPTARG
;;
i) DIRECTION=In
;;
o) DIRECTION=Out
;;
I) IFNAME=$OPTARG
;;
h) usage_exit
;;
\?) usage_exit
;;
esac
done
shift $((OPTIND - 1))
[[ -n ${IFNAME} ]] || usage_exit
IFOID=$(${SNMPWALK} -v 2c -c ${COMMUNITY} localhost IF-MIB::ifName |grep ${IFNAME} |sed -e 's/ .*$//' -e 's/^.*\.//')
## main
${CHECK_SNMP} community -H 127.0.0.1 -C ${COMMUNITY} -P 2c -o IF-MIB::ifHC${DIRECTION}Octets.${IFOID} --rate --rate-multiplier 8 -u "bps in."
exit $?