Skip to content

Instantly share code, notes, and snippets.

@binarytemple
Created February 5, 2016 22:03
Show Gist options
  • Save binarytemple/c87e6036ce068adec6d4 to your computer and use it in GitHub Desktop.
Save binarytemple/c87e6036ce068adec6d4 to your computer and use it in GitHub Desktop.

http://centoshowtos.org/monitoring/graphite/

  • Install graphite software and MySQL for backend
yum install graphite-web graphite-web-selinux mysql mysql-server MySQL-python
  • Start MySQL, lock it down, and create a Graphite database and user.
/etc/init.d/mysqld start
mysql_secure_installation

Create graphite db, username and password

mysql -e "CREATE DATABASE graphite;" -u root 
mysql -e "GRANT ALL PRIVILEGES ON graphite.* TO 'graphite'@'localhost' IDENTIFIED BY 'graphite899kin';" -u root
mysql -e 'FLUSH PRIVILEGES;' -u root 
vi /etc/graphite-web/local_settings.py

set the databases to the following:

DATABASES = {
 'default': {
 'NAME': 'graphite',
 'ENGINE': 'django.db.backends.mysql',
 'USER': 'graphite',
 'PASSWORD': 'graphite899kin',
 }
}

Now create the graphite db stuff..

[root@smlonmonitoring001 ~]# /usr/lib/python2.6/site-packages/graphite/manage.py syncdb
/usr/lib/python2.6/site-packages/graphite/settings.py:231: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security
  warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
/usr/lib/python2.6/site-packages/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
/usr/lib/python2.6/site-packages/django/core/cache/__init__.py:82: DeprecationWarning: settings.CACHE_* is deprecated; use settings.CACHES instead.
  DeprecationWarning
Creating tables ...
Creating table account_profile
Creating table account_variable
Creating table account_view
Creating table account_window
Creating table account_mygraph
Creating table dashboard_dashboard_owners
Creating table dashboard_dashboard
Creating table events_event
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_session
Creating table django_admin_log
Creating table django_content_type
Creating table tagging_tag
Creating table tagging_taggeditem

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'): 
E-mail address: 
.... 

Then start httpd ... if there are any errors regarding the hosts fully qualified domain name, make sure that /etc/resolv.conf is configured correctly, it should contain the following:

[root@smlonmonitoring001 ~]# cat /etc/resolv.conf 
domain prod.smoke.lon
search prod.smoke.lon smoke.lon dyn.smoke.lon smoke.nyc smoke.sh bb.lon
nameserver 172.27.208.57
nameserver 172.27.208.58

Oh... time to ensure that iptables will allow connections .... lets add the entire subnet(s)

[root@smlonmonitoring001 ~]# cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
[root@smlonmonitoring001 ~]# /etc/init.d/iptables restart
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
[root@smlonmonitoring001 ~]# 

Install Carbon and Whisper

yum install python-carbon python-whisper

Start Carbon Cache Service

/etc/init.d/carbon-cache start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment