add cli option for interval

This commit is contained in:
Patrick Stadler 2015-03-14 14:46:17 +01:00
parent ffea7022ea
commit f4d464e276
2 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# config # config
INTERVAL=1 INTERVAL=5
REPORTER=stdout # TODO: handle multiple reporters REPORTER=stdout # TODO: handle multiple reporters
# env # env
@ -10,12 +10,12 @@ LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8 LANGUAGE=en_US.UTF-8
# handle opts # handle opts
opts_spec=":dhvr:" opts_spec=":dhvri:"
opt_docs=false opt_docs=false
opt_verbose=false opt_verbose=false
usage () { usage () {
echo "usage: $0 [-d] [-h] [-v] [-r]" echo "Usage: $0 [-d] [-h] [-v] [-r] [-i]"
} }
help () { help () {
@ -37,6 +37,9 @@ while getopts "$opts_spec" opt; do
r) r)
REPORTER=$OPTARG REPORTER=$OPTARG
;; ;;
i)
INTERVAL=$OPTARG
;;
*) *)
usage usage
exit 1 exit 1

View File

@ -10,7 +10,8 @@ init () {
report () { report () {
local METRIC=$1 local METRIC=$1
local VALUE=$2 local VALUE=$2
curl -X POST -d "[{\"name\":\"$METRIC\",\"columns\":[\"value\"],\"points\":[[$VALUE]]}]" $INFLUXDB_API_ENDPOINT curl -X POST $INFLUXDB_API_ENDPOINT \
-d "[{\"name\":\"$METRIC\",\"columns\":[\"value\"],\"points\":[[$VALUE]]}]"
} }
docs () { docs () {