collectd: sqm_collect: tidy interval string handling
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Sun, 7 Jun 2020 15:33:31 +0000 (18:33 +0300)
committerHannu Nyman <hannu.nyman@iki.fi>
Sun, 7 Jun 2020 15:33:31 +0000 (18:33 +0300)
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit c2c91ea99e5fb7d4798116888b31f8fd9117d8ee)

utils/collectd/Makefile
utils/collectd/files/exec-scripts/sqm_collectd.sh

index 20e635ea96c6140dab4ad59e024ef3626693b6c4..7e0eb9f06f0703ca611f6d873ca75c5df1d3c2bb 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=collectd
 PKG_VERSION:=5.11.0
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://collectd.org/files/ \
index f158056e8ff9099007b87f98ada41afd92dae31b..ad84fc762a1b25eeb99c46ab6581a92cd3e17383 100755 (executable)
@@ -3,7 +3,7 @@
 . /usr/share/libubox/jshn.sh
 
 HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
-INTERVAL="${COLLECTD_INTERVAL:-60.000}"
+INTERVAL="${COLLECTD_INTERVAL:-60}"
 
 handle_cake() {
        local ifc ifr tin i
@@ -79,8 +79,7 @@ process_qdisc() {
        local ifc jsn
 
        ifc="$1"
-       jsn=$(tc -s -j qdisc show dev "$ifc")
-       [ $? ] || return
+       jsn=$(tc -s -j qdisc show dev "$ifc") || return
 
        # strip leading & trailing []
        jsn="${jsn#[}" ; jsn="${jsn%]}"
@@ -104,5 +103,5 @@ while true ; do
        for ifc in "$@" ; do
                process_qdisc "$ifc"
        done
-       sleep "${INTERVAL%.000}"
+       sleep "${INTERVAL%%.*}"
 done