Yum
yum install python-pip graphite-web python-carbon python-whisper graphite nodejs npm mysql-server mysql-client MySQL-python
User
Create user nodejs to run application
vi /etc/sudoers
Add: nodejs ALL = NOPASSWD: /usr/bin/node
Comment: #Defaults requiretty
Node
mkdir /opt/statsd
cd /opt/statsd
npm install nodeunit
npm install temp
npm install underscore
chown -R nodejs:nodejs /opt/statsd
Mysql
mysql -u root -p
create database graphite; create user 'graphite'@'localhost' identified by 'password'; grant all on graphite.* to 'graphite'@'localhost';
cd /etc/graphite-web
Edit local_settings.py
Change Database Configuration settings, uncomment and edit to the following
DATABASES = {
'default': {
'NAME': 'graphite',
'ENGINE': 'django.db.backends.mysql',
'USER': 'graphite',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '3306'
}
}
GraphiteRun the following
/usr/lib/python2.6/site-packages/graphite/manage.py syncdb
/usr/lib/python2.6/site-packages/graphite/manage.py createsuperuser
Graphite will connect to Apache by default to root directory
service httpd restart
Open Browser and go to http://
Statsd Config Download statsd from Github and extract to /opt/statsd
Copy exampleConfig.js to
{
"graphitePort": 2003,
"graphiteHost": "127.0.0.1",
"address": "0.0.0.0",
"port": 8125,
"flushInterval": 10000,
"deleteIdleStats": false,
"deleteGauges": false,
"deleteTimers": false,
"deleteSets": false,
"deleteCounters": false,
"graphite": {
"legacyNamespace": true,
"globalPrefix": "stats",
"prefixCounter": "counters",
"prefixTimer": "timers",
"prefixGauge": "gauges",
"prefixSet": "sets"
}
Firewall
Open UPD port in ipTables/Firewall
iptables -I INPUT 10 -m state --state NEW -p udp --dport 8125 -j ACCEPT (10 is the line number, change per ipTables open ports)
/sbin/service iptables save
service iptables restart
Upstart
Create /etc/init/statsd
#!upstart
description "statsd"
env PROGRAM_NAME="statsd"
env FULL_PATH="/opt/statsd"
env FILE_NAME="stats.js"
env NODE_PATH="/usr/bin/node"
env USERNAME="nodejs"
start on runlevel [2345]
stop on runlevel [016]
script
echo $$ > /var/run/$PROGRAM_NAME.pid
cd $FULL_PATH
exec sudo -u $USERNAME $NODE_PATH $FULL_PATH/$FILE_NAME /opt/statsd/dbs2Config.js >> /var/log/$PROGRAM_NAME.sys.log 2>&1
end script
Start statsd
initctl start statsd