Skip to content

Instantly share code, notes, and snippets.

@PowerWagon
Last active August 29, 2015 13:58
Show Gist options
  • Save PowerWagon/9934522 to your computer and use it in GitHub Desktop.
Save PowerWagon/9934522 to your computer and use it in GitHub Desktop.
Graphite and Carbon install script
#!/bin/bash
# taken from http://www.linuxsysadmintutorials.com/install-graphite-on-a-centosrhel-server/
#
# This creates a minimum of security for everything. You've been warned.
# This installs and configures:
# graphite, carbon, MySQL, and httpd
#
#######################
## Install munin-node and a wonderful python script to dump munin into graphite with this:
# su -
# yum -y install munin-node python-argparse wget
# service munin-node start
# mkdir /root/bin; cd /root/bin
# wget https://raw.githubusercontent.com/jforman/munin-graphite/master/m2g-poller.py
# chmod +x m2g-poller.py
#
## run the munin poller with:
# ./m2g-poller.py --host localhost --carbon localhost:2004
## -OR- run in crontab
# * * * * * /root/bin/m2g-poller.py --host localhost --carbon localhost:2004 --interval 0
## you could poll multiple nodes with a little 'for' loop and munin-node configuration.
## Thank you to user jforman for this awesome module!
#######################
yum -y localinstall https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y install graphite-web graphite-web-selinux mysql mysql-server MySQL-python httpd python-whisper python-carbon
service mysqld start
chkconfig mysqld on
mysql -e "CREATE USER 'graphite'@'localhost' IDENTIFIED BY 'complexpassw0rd';" -u root
mysql -e "GRANT ALL PRIVILEGES ON graphite.* TO 'graphite'@'localhost';" -u root
mysql -e "CREATE DATABASE graphite;" -u root
mysql -e 'FLUSH PRIVILEGES;' -u root
cat << 'EOF' >> /etc/graphite-web/local_settings.py
DATABASES = {
'default': {
'NAME': 'graphite',
'ENGINE': 'django.db.backends.mysql',
'USER': 'graphite',
'PASSWORD': 'complexpassw0rd',
'HOST': 'localhost',
'PORT': '3306',
}
}
EOF
/usr/lib/python2.6/site-packages/graphite/manage.py syncdb <<< no
service httpd restart
chkconfig httpd on
cat << 'EOF' > /etc/carbon/relay-rules.conf
[default]
default = true
destinations = 127.0.0.1:2004:a, 127.0.0.1:2104:b
EOF
service carbon-aggregator start
service carbon-cache start
service carbon-relay start
chkconfig carbon-aggregator on
chkconfig carbon-cache on
chkconfig carbon-relay on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment