Statsd(bucky) / graphite / grafana

graphite install
yum install -y gcc gcc-c++ libffi libffi-devel httpd24 httpd24-tools mysql-server mysql MySQL-python27 mod24_wsgi-python27 cairo-devel freetype* urw-fonts
pip install cairocffi pytz scandir

export PYTHONPATH=”/opt/graphite/lib/:/opt/graphite/webapp/”
pip install –no-binary=:all: https://github.com/graphite-project/whisper/tarball/master
pip install –no-binary=:all: https://github.com/graphite-project/carbon/tarball/master
pip install –no-binary=:all: https://github.com/graphite-project/graphite-web/tarball/master

export GRAPHITE_ROOT=/opt/graphite

vim $GRAPHITE_ROOT/webapp/graphite/local_settings.py
add —
DATABASES = {
‘default’: {
‘NAME’: ‘graphiteDB’,
‘ENGINE’: ‘django.db.backends.mysql’,
‘USER’: ‘graphite’,
‘PASSWORD’: ‘${PASSWORD}’,
‘HOST’: ‘localhost’,
‘PORT’: ‘3306’
}
}

sudo /etc/init.d/mysqld start
sudo /usr/bin/mysqladmin -u root password ‘${PASSWORD}!’
mysql -u root -p${PASSWORD}
CREATE USER ‘graphite’@’localhost’ IDENTIFIED BY ‘${PASSWORD}’;
GRANT ALL PRIVILEGES ON *.* TO graphite@’%’ IDENTIFIED BY ‘${PASSWORD}’;
GRANT ALL PRIVILEGES ON *.* TO graphite@’localhost’ IDENTIFIED BY ‘${PASSWORD}’;
FLUSH PRIVILEGES;
exit;
mysql -u graphite -p${PASSWORD}
create database graphiteDB;
exit;

PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py migrate –settings=graphite.settings –run-syncdb
PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py collectstatic –noinput –settings=graphite.settings

cp /opt/graphite/examples/example-graphite-vhost.conf /etc/httpd/conf.d/graphite-vhost.conf
vim /etc/httpd/conf.d/graphite-vhost.conf
add —
<Directory /opt/graphite/static/>
<IfVersion < 2.4>
Order deny,allow
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>

cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi

cd /opt/graphite/conf
from .example
carbon.conf
storage-aggregation.conf
storage-schemas.conf

yum install collectd
sudo pip install bucky
sudo mkdir /etc/bucky
vim /etc/bucky/bucky.conf
add contents from https://github.com/trbs/bucky
add “/usr/share/collectd/types.db” to types.db list in /etc/bucky/bucky.conf

create init scripts for bucky and carbon

#!/bin/bash
# bucky Init script for running the bucky daemon
#
#
# chkconfig: – 98 02
#
# description: some description
# processname: bucky

PATH=/usr/bin:/sbin:/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
export PATH

lockfile=’/var/lock/subsys/bucky’
pidfile=’/var/run/bucky.pid’
bucky=’/usr/local/bin/bucky’
config=’/etc/bucky/bucky.conf’
logfile=’/var/log/bucky/bucky.log’

RETVAL=0

# Source function library.
. /etc/rc.d/init.d/functions

# Determine if we can use the -p option to daemon, killproc, and status.
# RHEL < 5 can’t.
if status | grep -q — ‘-p’ 2>/dev/null; then
pidopts=”-p $pidfile”
fi

start() {
echo -n $”Starting bucky daemon: ”
$bucky $config >> $logfile 2>&1 &
RETVAL=$?

local PID=`pgrep -f “${bucky} ${config}”`
echo $PID > ${pidfile}

[ $RETVAL -eq 0 ] && (touch ${lockfile}; echo_success) || echo_failure
echo

return $RETVAL
}

stop() {
echo -n $”Stopping bucky daemon: ”
killproc $pidopts $bucky
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}
}

restart() {
stop
start
}

rh_status() {
status $pidopts $bucky
RETVAL=$?
return $RETVAL
}

rh_status_q() {
rh_status >/dev/null 2>&1
}

case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
status)
rh_status
;;
*)
echo $”Usage: $0 {start|stop|restart|condrestart|try-restart|status}”
exit 1
esac

exit $RETVAL

yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.2.0-1.x86_64.rpm

Leave a comment