#! /bin/bash declare -r GMETRIC=/usr/bin/gmetric declare -r GMETRIC_TYPE="ip_conntrack" declare -r IPCONNMAX5="/proc/sys/net/ipv4/ip_conntrack_max" declare -r IPCONNMAX6="/proc/sys/net/netfilter/nf_conntrack_max" declare -r IPCONN5="/proc/sys/net/ipv4/netfilter/ip_conntrack_count" declare -r IPCONN6="/proc/sys/net/netfilter/nf_conntrack_count" if [ -e ${IPCONNMAX5} ]; then IPCONNMAX=`cat ${IPCONNMAX5}` IPCONN=`cat ${IPCONN5}` else IPCONNMAX=`cat ${IPCONNMAX6}` IPCONN=`cat ${IPCONN6}` fi IPCONNRATE=`echo "scale=5; $IPCONN/$IPCONNMAX*100" | bc` #echo "ip_conntrack_max="${IPCONNMAX} #echo "ip_conntrack="${IPCONN} #echo "RATE="${IPCONNRATE} $GMETRIC -g ${GMETRIC_TYPE} -n "ip_conntrack" -v ${IPCONN} -t float -u "cnt" $GMETRIC -g ${GMETRIC_TYPE} -n "ip_conntrack_rate" -v ${IPCONNRATE} -t float -u "%"