Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pstadler/metrics.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
pstadler committed Nov 16, 2015
2 parents 129ece3 + 817a19d commit b21a7c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
4 changes: 2 additions & 2 deletions lib/utils/os.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ esac)

is_solaris () { [ $OS_TYPE = 'solaris' ]; }
is_osx () { [ $OS_TYPE = 'osx' ]; }
is_linux () { [ $OS_TYPE = 'solaris' ]; }
is_linux () { [ $OS_TYPE = 'linux' ]; }
is_bsd () { [ $OS_TYPE = 'bsd']; }
is_unknown () { [ $OS_TYPE = 'unknown' ]; }

Expand All @@ -28,4 +28,4 @@ else
make_temp_dir () {
mktemp -d
}
fi
fi
16 changes: 4 additions & 12 deletions reporters/influxdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,20 @@ start () {
fi

if [ "$INFLUXDB_SEND_HOSTNAME" = true ]; then
__influxdb_columns="[\"value\",\"host\"]"
__influxdb_hostname=$(hostname)
else
__influxdb_columns="[\"value\"]"
__influxdb_hostname="host=$(hostname)"
fi
}

report () {
local metric=$1
local value=$2
local points
if [ "$INFLUXDB_SEND_HOSTNAME" = true ]; then
points="[$value,\"$__influxdb_hostname\"]"
else
points="[$value]"
fi
local data="[{\"name\":\"$metric\",\"columns\":$__influxdb_columns,\"points\":[$points]}]"
curl -s -X POST $INFLUXDB_API_ENDPOINT -d $data
local data="$metric,$__influxdb_hostname value=$value"
curl -s -X POST $INFLUXDB_API_ENDPOINT --data-binary "$data"
}

docs () {
echo "Send data to InfluxDB."
echo "INFLUXDB_API_ENDPOINT=$INFLUXDB_API_ENDPOINT"
echo "INFLUXDB_SEND_HOSTNAME=$INFLUXDB_SEND_HOSTNAME"
}
}

0 comments on commit b21a7c1

Please sign in to comment.