2015-03-08 20:37:56 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
init () {
|
|
|
|
if [ -z $FILE_LOCATION ]; then
|
2015-03-14 21:44:06 +01:00
|
|
|
echo "Error: file reporter requires \$FILE_LOCATION to be specified"
|
2015-03-14 14:59:17 +01:00
|
|
|
exit 1
|
2015-03-08 20:37:56 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f $FILE_LOCATION ]; then
|
|
|
|
touch $FILE_LOCATION
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-03-14 13:32:26 +01:00
|
|
|
report () {
|
2015-03-14 21:44:06 +01:00
|
|
|
local metric=$1
|
|
|
|
local value=$2
|
|
|
|
local datetime=$(iso_date)
|
|
|
|
echo "$datetime $metric: $value" >> $FILE_LOCATION
|
2015-03-14 13:32:26 +01:00
|
|
|
}
|
|
|
|
|
2015-03-08 20:37:56 +01:00
|
|
|
docs () {
|
|
|
|
echo "Write to a file or named pipe."
|
2015-03-15 10:01:41 +01:00
|
|
|
echo "\$FILE_LOCATION="
|
2015-03-08 20:37:56 +01:00
|
|
|
}
|