mirror of
https://github.com/pstadler/metrics.sh.git
synced 2025-02-28 13:59:12 -05:00
add cli option for interval
This commit is contained in:
parent
ffea7022ea
commit
f4d464e276
@ -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
|
||||
|
@ -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 () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user