structured main routines. implement file reporter

This commit is contained in:
Patrick Stadler
2015-03-08 20:37:56 +01:00
parent c54c9d73b7
commit 9858beb329
12 changed files with 213 additions and 138 deletions

24
reporters/file.sh Normal file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
report () {
local METRIC=$1
local VALUE=$2
local DATE=$(iso_date)
echo $DATE $METRIC: $VALUE >> $FILE_LOCATION
}
init () {
if [ -z $FILE_LOCATION ]; then
echo "Missing configuration: \$FILE_LOCATION"
return 1
fi
if [ ! -f $FILE_LOCATION ]; then
touch $FILE_LOCATION
fi
}
docs () {
echo "Write to a file or named pipe."
echo "\$FILE_LOCATION=$FILE_LOCATION"
}

View File

@@ -3,7 +3,7 @@
report () {
METRIC=$1
VALUE=$2
curl -d "stat=$METRIC&ezkey=$API_KEY&value=$VALUE" http://api.stathat.com/ez
curl -d "stat=$METRIC&ezkey=$STATHAT_API_KEY&value=$VALUE" http://api.stathat.com/ez
}
docs () {