mirror of
https://github.com/pstadler/metrics.sh.git
synced 2025-11-10 22:10:10 -05:00
structured main routines. implement file reporter
This commit is contained in:
24
reporters/file.sh
Normal file
24
reporters/file.sh
Normal 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"
|
||||
}
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user