stdbuf -i0 -o0 -e0 ifstat -n -t -b | stdbuf -i0 -o0 -e0 tail -n+3 | (outsatsecs=0; insatsecs=0; while read ts kbpsin kbpsout ; do if [[ $kbpsout -ge 900000 ]] ; then ((outsatsecs++)); fi if [[ $kbpsin -ge 900000 ]] ; then ((insatsecs++)) ; fi; echo 'nic_saturated_seconds{dir="out"}' ${outsatsecs}'\nnic_saturated_seconds{dir="in"}' $insatsecs | tee >(sponge /var/lib/prometheus/node.d/saturated.prom) ; done)