Skip to content

Instantly share code, notes, and snippets.

@deepakmahakale
Last active November 13, 2018 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepakmahakale/a80a91fb685ad68dbae7c816ab3215d9 to your computer and use it in GitHub Desktop.
Save deepakmahakale/a80a91fb685ad68dbae7c816ab3215d9 to your computer and use it in GitHub Desktop.
StatsD + influxDB + telegraf

Install StatsD

Make sure nodejs is installed

git clone https://github.com/etsy/statsd.git
cd statsd
cp exampleConfig.js config.js
subl config.js
node stats.js config.js

Execute the following in another tab

echo "my.metric:2|c" | nc -u -w 1 127.0.0.1 8125
echo "my.metric.time:320|ms" | nc -u -w 1 127.0.0.1 8125

Install telegraf

wget http://get.influxdb.org/telegraf/telegraf_linux_amd64_0.2.0.tar.gz
tar -xvf telegraf_linux_amd64_0.2.0.tar.gz
mv telegraf_linux_amd64 /usr/bin/telegraf && chmod +x /usr/bin/telegraf
telegraf -sample-config -filter statsd -outputfilter influxdb > tele.conf
telegraf -config tele.conf
telegraf

Install influxDB

sudo apt-get update
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release

# NOTE: You might get an error with the following command if you are using zsh in that case substitute the variables
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

# If you get an error with above command use this approach
$ echo $DISTRIB_ID
ubuntu
$ echo $DISTRIB_CODENAME
xenial

$ echo "deb https://repos.influxdata.com/ubuntu xenial stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

# Install 

sudo apt-get update && sudo apt-get install influxdb

# Start InfluxDB

sudo service influxdb start

influx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment