diff --git a/netisr_ b/netisr_ index fa60c19..15ed699 100755 --- a/netisr_ +++ b/netisr_ @@ -42,15 +42,23 @@ ${NETSTAT} -Q > ${STATFILE} 2>/dev/null if [ $# -lt 1 ]; then - if [ x${STAT_TYPE} == x ]; then + if [ -z ${STAT_TYPE} ]; then + echo "Should run from symlink" exit 1 fi - cat ${STATFILE} | awk ' / ('${STAT_TYPE}') /{print "t"$2 "_"$3"_queued.value "$9 "\nt"$2 "_"$3"_handled.value "$10 "\nt"$2 "_"$3"_dropped.value "$8 "\nt"$2 "_"$3"_hdispatched.value "$7 "\nt"$2 "_"$3"_dispatched.value "$6}' + awk ' +/ ('${STAT_TYPE}') / { + print "t"$2 "_"$3"_queued.value "$9; + print "t"$2 "_"$3"_handled.value "$10; + print "t"$2 "_"$3"_dropped.value "$8; + print "t"$2 "_"$3"_hdispatched.value "$7; + print "t"$2 "_"$3"_dispatched.value "$6; +} ' ${STATFILE} elif [ "$1" == "suggest" ]; then - cat ${STATFILE} | awk '/---/{print $1}' + awk '/---/{print $1}' ${STATFILE} elif [ "$1" == "autoconf" ]; then ${NETSTAT} -Q >/dev/null 2>&1 && echo yes || echo no @@ -64,14 +72,28 @@ elif [ "$1" == "config" ]; then echo "graph_title netisr dispatcher statistics for ${STAT_TYPE}" echo "graph_args -X 0 --lower-limit 0 --base 1000" - echo "graph_vlabel packets / second" + echo "graph_vlabel PPS" echo "graph_category isr" - cat ${STATFILE} | awk ' / ('${STAT_TYPE}') /{print "t"$2 "_"$3"_queued.label Thread "$2 " Queued\nt"$2 "_"$3"_handled.label Thread "$2 " Handled\nt"$2 "_"$3"_dropped.label Thread "$2 " Dropped\nt"$2 "_"$3"_hdispatched.label Thread "$2 " Hybrid-Dispatched\nt"$2 "_"$3"_dispatched.label Thread "$2" Dispatched"}' - cat ${STATFILE} | awk ' / ('${STAT_TYPE}') /{print "t"$2 "_"$3"_queued.type DERIVE\nt"$2 "_"$3"_handled.type DERIVE\nt"$2 "_"$3"_dropped.type DERIVE\nt"$2 "_"$3"_hdispatched.type DERIVE\nt"$2 "_"$3"_dispatched.type DERIVE"}' - cat ${STATFILE} | awk ' / ('${STAT_TYPE}') /{print "t"$2 "_"$3"_queued.min 0\nt"$2 "_"$3"_handled.min 0\nt"$2 "_"$3"_dropped.min 0\nt"$2 "_"$3"_hdispatched.min 0\nt"$2 "_"$3"_dispatched.min 0"}' - + awk ' +/ ('${STAT_TYPE}') / { + print "t"$2 "_"$3"_queued.label Thread "$2 " Queued"; + print "t"$2 "_"$3"_handled.label Thread "$2 " Handled"; + print "t"$2 "_"$3"_dropped.label Thread "$2 " Dropped"; + print "t"$2 "_"$3"_hdispatched.label Thread "$2 " Hybrid-Dispatched"; + print "t"$2 "_"$3"_dispatched.label Thread "$2" Dispatched"; + print "t"$2 "_"$3"_queued.type DERIVE"; + print "t"$2 "_"$3"_handled.type DERIVE"; + print "t"$2 "_"$3"_dropped.type DERIVE"; + print "t"$2 "_"$3"_hdispatched.type DERIVE"; + print "t"$2 "_"$3"_dispatched.type DERIVE"; + print "t"$2 "_"$3"_queued.min 0"; + print "t"$2 "_"$3"_handled.min 0"; + print "t"$2 "_"$3"_dropped.min 0"; + print "t"$2 "_"$3"_hdispatched.min 0"; + print "t"$2 "_"$3"_dispatched.min 0"; +}' ${STATFILE} + fi rm ${STATFILE} -