Quantcast
Channel: Eureka! » Node.js
Viewing all articles
Browse latest Browse all 9

StatsD – Installation and integration with Graphite

$
0
0

Previous: Install Graphite under pyenv virtualenv on Ubuntu

-

 

Compared to Graphite, installing StatsD server is just a piece of cake.

1. Install Node.js. For better management on Node.js, you could consider using nvm.

 

2. Checkout the StatsD project on GitHub.

git clone https://github.com/etsy/statsd.git

 

3. Copy the exampleConfig.js and name it to whatever you like and edit it as follow.
ex. statsdConfig.js.

{
  graphitePort: 2003
, graphiteHost: "<graphite host>"
, port: 8125
, backends: [ "./backends/graphite", "./backends/console" ] // console is for debug
, debug: true // For debug
, graphite: { legacyNamespace: false } // Better group all collected metrics under stats
}

 

4. Edit the Graphite storage-schemas.conf to define the schema for those metrics with namespace which are start with stats. The file size of the .wsp under this retention is about 6.2MB.

[stats]
pattern = ^stats\.
retentions = 10s:24h,1min:7d,2min:365d,10min:1825d

 

5. Since we have different retentions period, we need to create the storage-aggregation.conf to define the rules for the data downsampling.

[min]
pattern = \.min$
xFilesFactor = 0.1
aggregationMethod = min

[max]
pattern = \.max$
xFilesFactor = 0.1
aggregationMethod = max

[lower]
pattern = \.lower$
xFilesFactor = 0.1
aggregationMethod = min

[upper]
pattern = \.upper(_\d+)?$
xFilesFactor = 0.1
aggregationMethod = max

[sum]
pattern = \.sum$
xFilesFactor = 0
aggregationMethod = sum

[count]
pattern = \.count$
xFilesFactor = 0
aggregationMethod = sum

[default_average]
pattern = .*
xFilesFactor = 0.3
aggregationMethod = average

 

6. Restart the carbon-cache.py and start the StatsD server.

cd <statsd root>
node stats.js statsdConfig.js

 

7. There are 2 ways to test your StatsD setup. The first one is to use Netcat but i find that not all the data written to the StatsD listening port could be received.

# Install Netcat
sudo apt-get install netcat
# Send data to the StatsD server
echo "ykyuen.test.random:1|c" | nc -u -w0 127.0.0.1 8125

 

8. Another way is to use the StatsD example client which i didn’t experience any data loss. Go to <statsd root>/examples and send some testing data to The StatsD server. You can keep sending and the default StatsD flush rate is 10s which should be larger or equal to the minimum retention period defined in storage-schemas.conf.

./statsd-client.sh 'ykyuen.test.random:1|c'

 

8. Check it out on your graphite-web portal.
statsd-installation-and-graphite-integration
 

Done =)


Filed under: Monitoring Tagged: Carbon, Etsy, Graphite, Green Legos, Netcat, Node.js, nvm, StatsD, Ubuntu

Viewing all articles
Browse latest Browse all 9

Trending Articles