minor code cleanup

This commit is contained in:
Patrick Stadler 2015-03-08 14:02:19 +01:00
parent 916cabc8ec
commit 9312c27c9c
2 changed files with 17 additions and 15 deletions

View File

@ -8,7 +8,7 @@ if [ -z $NETWORK_IO_INTERFACE ]; then
fi fi
fi fi
declare -r __network_io_divisor=$(($INTERVAL*1024)) declare -r __network_io_divisor=$[$INTERVAL * 1024]
__network_io_sample=(0 0) __network_io_sample=(0 0)
__network_io_calc_kBps() { __network_io_calc_kBps() {
@ -23,7 +23,8 @@ if is_osx; then
} }
else else
__network_io_collect () { __network_io_collect () {
echo TODO cat /proc/net/dev | awk -v iface_regex="$NETWORK_IO_INTERFACE:" \
'$0 ~ iface_regex {print $2" "$10}'
} }
fi fi
@ -38,4 +39,5 @@ collect () {
docs () { docs () {
echo "Network traffic in kB/s." echo "Network traffic in kB/s."
echo "\$NETWORK_IO_INTERFACE=$NETWORK_IO_INTERFACE"
} }

View File

@ -56,14 +56,7 @@ for metric in ${__METRICS[@]}; do
echo echo
done done
# collect metrics report () {
while true; do
for metric in ${__METRICS[@]}; do
if ! is_function __m_${metric}_collect; then
continue
fi
report () {
local result local result
if [ -z $2 ]; then if [ -z $2 ]; then
label=$metric label=$metric
@ -73,7 +66,14 @@ while true; do
result="$2" result="$2"
fi fi
__r_${REPORTER}_report $label $result __r_${REPORTER}_report $label $result
} }
# collect metrics
while true; do
for metric in ${__METRICS[@]}; do
if ! is_function __m_${metric}_collect; then
continue
fi
__m_${metric}_collect __m_${metric}_collect
done done