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

View File

@ -10,7 +10,8 @@ init () {
report () {
local METRIC=$1
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 () {