mirror of
https://github.com/pstadler/metrics.sh.git
synced 2025-02-28 13:59:12 -05:00
minor code cleanup
This commit is contained in:
parent
916cabc8ec
commit
9312c27c9c
@ -8,7 +8,7 @@ if [ -z $NETWORK_IO_INTERFACE ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -r __network_io_divisor=$(($INTERVAL*1024))
|
||||
declare -r __network_io_divisor=$[$INTERVAL * 1024]
|
||||
__network_io_sample=(0 0)
|
||||
|
||||
__network_io_calc_kBps() {
|
||||
@ -23,7 +23,8 @@ if is_osx; then
|
||||
}
|
||||
else
|
||||
__network_io_collect () {
|
||||
echo TODO
|
||||
cat /proc/net/dev | awk -v iface_regex="$NETWORK_IO_INTERFACE:" \
|
||||
'$0 ~ iface_regex {print $2" "$10}'
|
||||
}
|
||||
fi
|
||||
|
||||
@ -38,4 +39,5 @@ collect () {
|
||||
|
||||
docs () {
|
||||
echo "Network traffic in kB/s."
|
||||
echo "\$NETWORK_IO_INTERFACE=$NETWORK_IO_INTERFACE"
|
||||
}
|
@ -56,13 +56,6 @@ for metric in ${__METRICS[@]}; do
|
||||
echo
|
||||
done
|
||||
|
||||
# collect metrics
|
||||
while true; do
|
||||
for metric in ${__METRICS[@]}; do
|
||||
if ! is_function __m_${metric}_collect; then
|
||||
continue
|
||||
fi
|
||||
|
||||
report () {
|
||||
local result
|
||||
if [ -z $2 ]; then
|
||||
@ -75,6 +68,13 @@ while true; do
|
||||
__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
|
||||
done
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user