Skip to content

Commit

Permalink
allow overriding statsd host and port
Browse files Browse the repository at this point in the history
* allow overriding statsd host and port, by means of
  STATSD_HOST and STATSD_PORT environment variables
* lowercase non-environment variables. that's a good convention
* rename 'statsd' variable to 'host'
  • Loading branch information
Dieter Plaetinck committed Sep 27, 2012
1 parent 0b39c18 commit b99c0d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/statsd-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#
# Alexander Fortin <alexander.fortin@gmail.com>
#
STATSD="127.0.0.1"
PORT="8125"
host="${STATSD_HOST:-127.0.0.1}"
port="${STATSD_PORT:-8125}"

if [ $# -ne 1 ]
then
Expand All @@ -15,7 +15,7 @@ then
fi

# Setup UDP socket with statsd server
exec 3<> /dev/udp/${STATSD}/${PORT}
exec 3<> /dev/udp/$host/$port

# Send data
echo "$1" >&3
Expand Down

0 comments on commit b99c0d5

Please sign in to comment.