Skip to content

Instantly share code, notes, and snippets.

@textarcana
Last active March 18, 2024 11:21
Show Gist options
  • Save textarcana/4611024 to your computer and use it in GitHub Desktop.
Save textarcana/4611024 to your computer and use it in GitHub Desktop.

Revisions

  1. Noah Sussman revised this gist Jun 13, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    This gist contains everything you need to install StatsD and Graphite on CentOS 6.3. Unless I forgot something. If I did, shoot a reminder email to noah at one more bug dot com. tl;dr womm.
    This gist contains everything you need to install StatsD and Graphite on CentOS 6.3. Unless I forgot something. If I did, shoot a reminder email to noah at one more bug dot com. **tl;dr: womm, ymmv, yolo.**

    I (mostly) followed the steps shown in the [EZUnix wiki](http://www.ezunix.org/index.php?title=Install_statsd_and_graphite_on_CentOS_or_RHEL)

  2. Noah Sussman revised this gist Jan 24, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions install-statsd-graphite-centos-6-3.sh
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ cp graphite.wsgi.example graphite.wsgi

    # Graphite defaults to the Chicago time zone (because that's Django's default).
    cp /opt/graphite/webapp/graphite/local_settings.py.example /opt/graphite/webapp/graphite/local_settings.py
    # then just edit the TIME_ZONE line
    # then uncomment and edit the TIME_ZONE line. Etc./UTC is recommended.


    echo '
    @@ -50,7 +50,7 @@ Include "/etc/httpd/vhosts/*.conf"
    chown -R apache:apache /opt/graphite/storage/

    # or optionally:
    # chown -R www-data:www-data /opt/graphite
    # chown -R apache:apache /opt/graphite

    cd /opt/graphite/webapp/graphite
    sudo python manage.py syncdb
  3. Noah Sussman revised this gist Jan 24, 2013. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions install-statsd-graphite-centos-6-3.sh
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,11 @@ cp storage-aggregation.conf.example storage-aggregation.conf
    cp graphTemplates.conf.example graphTemplates.conf
    cp graphite.wsgi.example graphite.wsgi

    # Graphite defaults to the Chicago time zone (because that's Django's default).
    cp /opt/graphite/webapp/graphite/local_settings.py.example /opt/graphite/webapp/graphite/local_settings.py
    # then just edit the TIME_ZONE line


    echo '
    [stats]
    priority = 110
  4. Noah Sussman revised this gist Jan 24, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install-statsd-graphite-centos-6-3.sh
    Original file line number Diff line number Diff line change
    @@ -72,7 +72,7 @@ echo 0 >/selinux/enforce
    #
    # Start Apache. Graphite should now be running and you should be able
    # to see it in a Web browser on port 80
    apachectl start
    service apache start


    cd /tmp
  5. Noah Sussman revised this gist Jan 24, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions install-statsd-graphite-centos-6-3.sh
    Original file line number Diff line number Diff line change
    @@ -58,6 +58,9 @@ cd /opt/graphite/

    # disable SELinux enforcement or all you will see is a stack trace to the effect of:
    # "DatabaseError: attempt to write a readonly database"
    #
    # See the comment thread on this answer: http://stackoverflow.com/questions/3319112/sqlite-read-only-database/3330616#3330616
    # and also see https://answers.launchpad.net/graphite/+question/178172

    echo 0 >/selinux/enforce

  6. Noah Sussman revised this gist Jan 24, 2013. 1 changed file with 2 additions and 9 deletions.
    11 changes: 2 additions & 9 deletions install-statsd-graphite-centos-6-3.sh
    Original file line number Diff line number Diff line change
    @@ -56,18 +56,11 @@ sudo python manage.py syncdb
    cd /opt/graphite/
    ./bin/carbon-cache.py start

    # fix SElinux settings, see http://sergiy.kyrylkov.name/2006/05/15/13permission-denied-httpd-could-not-open-error-log-file/
    #
    # Note to find the right arguments for 'chcon -R' I said: ls -lZ /var/log/httpd
    chcon -R unconfined_u:object_r:httpd_log_t:s0 /opt/graphite/storage/
    chcon -R unconfined_u:object_r:httpd_log_t:s0 /opt/graphite/webapp/

    # disable SELinux enforcement or all you will see is a stack trace to the effect of:

    # disable SELinux enforcement or all you will see is a stack trace to the effect of:
    # "DatabaseError: attempt to write a readonly database"

    echo 0 >/selinux/enforce


    # Note that if you do not have the 'graphite' vhost defined in DNS,
    # then you need to update your /etc/hosts and map 'graphite' to the
    # host IP address. This must be done on both the host and
  7. Noah Sussman revised this gist Jan 24, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    This gist contains everything you need to install StatsD and Graphite on CentOS 6.3. Unless I forgot something. If I did, shoot a reminder email to noah at one more bug dot com. tl;dr womm, fwiw.
    This gist contains everything you need to install StatsD and Graphite on CentOS 6.3. Unless I forgot something. If I did, shoot a reminder email to noah at one more bug dot com. tl;dr womm.

    I (mostly) followed the steps shown in the [EZUnix wiki](http://www.ezunix.org/index.php?title=Install_statsd_and_graphite_on_CentOS_or_RHEL)

  8. Noah Sussman revised this gist Jan 24, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    This gist contains everything you need to install StatsD and Graphite on CentOS 6.3.
    This gist contains everything you need to install StatsD and Graphite on CentOS 6.3. Unless I forgot something. If I did, shoot a reminder email to noah at one more bug dot com. tl;dr womm, fwiw.

    I (mostly) followed the steps shown in the [EZUnix wiki](http://www.ezunix.org/index.php?title=Install_statsd_and_graphite_on_CentOS_or_RHEL)

  9. Noah Sussman revised this gist Jan 24, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    This gist contains everything you need to install StatsD and Graphite on CentOS 6.3.

    Based on the stesps shown in the [EZUnix wiki](http://www.ezunix.org/index.php?title=Install_statsd_and_graphite_on_CentOS_or_RHEL)
    I (mostly) followed the steps shown in the [EZUnix wiki](http://www.ezunix.org/index.php?title=Install_statsd_and_graphite_on_CentOS_or_RHEL)

    And also see [this gist by Michael Grace](http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/)
    And I also referred back to [this gist by Michael Grace](http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/)
  10. Noah Sussman revised this gist Jan 24, 2013. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    This gist contains everything you need to install StatsD and Graphite on CentOS 6.3.

    Based on the stesps shown in the [EZUnix wiki](http://www.ezunix.org/index.php?title=Install_statsd_and_graphite_on_CentOS_or_RHEL)

    And also see [this gist by Michael Grace](http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/)
  11. @textarcana-automation textarcana-automation revised this gist Jan 24, 2013. 1 changed file with 27 additions and 3 deletions.
    30 changes: 27 additions & 3 deletions install-statsd-graphite-centos-6-3.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    # run as root
    #
    # based on http://www.ezunix.org/index.php?title=Install_statsd_and_graphite_on_CentOS_or_RHEL

    rpm -i http://ftp.uninett.no/linux/epel/6/x86_64/epel-release-6-8.noarch.rpm
    yum -y update
    @@ -33,8 +35,6 @@ xFilesFactor = 0.0
    aggregationMethod = sum
    ' >> storage-aggregation.conf

    mkdir /etc/httpd/wsgi

    echo '
    Include "/etc/httpd/vhosts/*.conf"
    ' >> /etc/httpd/conf/httpd.conf
    @@ -44,6 +44,9 @@ Include "/etc/httpd/vhosts/*.conf"

    chown -R apache:apache /opt/graphite/storage/

    # or optionally:
    # chown -R www-data:www-data /opt/graphite

    cd /opt/graphite/webapp/graphite
    sudo python manage.py syncdb

    @@ -53,7 +56,28 @@ sudo python manage.py syncdb
    cd /opt/graphite/
    ./bin/carbon-cache.py start

    apachectl restart
    # fix SElinux settings, see http://sergiy.kyrylkov.name/2006/05/15/13permission-denied-httpd-could-not-open-error-log-file/
    #
    # Note to find the right arguments for 'chcon -R' I said: ls -lZ /var/log/httpd
    chcon -R unconfined_u:object_r:httpd_log_t:s0 /opt/graphite/storage/
    chcon -R unconfined_u:object_r:httpd_log_t:s0 /opt/graphite/webapp/

    # disable SELinux enforcement or all you will see is a stack trace to the effect of:


    echo 0 >/selinux/enforce


    # Note that if you do not have the 'graphite' vhost defined in DNS,
    # then you need to update your /etc/hosts and map 'graphite' to the
    # host IP address. This must be done on both the host and
    # client(s). You may have more luck using a Fully Qualified Domain
    # Name (FQDN) such as 'graphite.dev'
    #
    # Start Apache. Graphite should now be running and you should be able
    # to see it in a Web browser on port 80
    apachectl start


    cd /tmp
    git clone http://github.com/joyent/node.git
  12. @textarcana-automation textarcana-automation revised this gist Jan 23, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions graphite-vhost.conf
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    WSGISocketPrefix /var/run/wsgi

    <VirtualHost *:80>
    ServerName graphite
    DocumentRoot "/opt/graphite/webapp"
  13. @textarcana-automation textarcana-automation revised this gist Jan 23, 2013. 1 changed file with 79 additions and 1 deletion.
    80 changes: 79 additions & 1 deletion install-statsd-graphite-centos-6-3.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1,79 @@
    rpm -i http://ftp.uninett.no/linux/epel/6/x86_64/epel-release-6-5.noarch.rpm
    # run as root

    rpm -i http://ftp.uninett.no/linux/epel/6/x86_64/epel-release-6-8.noarch.rpm
    yum -y update

    yum -y install python-devel.x86_64 python-pip.noarch mod_wsgi.x86_64 mod_python.x86_64 python-sqlite2.x86_64 \
    bitmap.x86_64 pycairo.x86_64 python-zope-interface.x86_64 python-simplejson.x86_64 django-tagging.noarch \
    python-pip.noarch python-twisted-web.x86_64 bitmap bitmap-fonts gcc-c++.x86_64 \
    openssl-devel.x86_64 git.x86_64 make.x86_64

    pip-python install carbon
    pip-python install graphite-web
    pip-python install whisper

    pushd /opt/graphite/conf
    cp carbon.conf.example carbon.conf
    cp storage-schemas.conf.example storage-schemas.conf
    cp storage-aggregation.conf.example storage-aggregation.conf
    cp graphTemplates.conf.example graphTemplates.conf
    cp graphite.wsgi.example graphite.wsgi

    echo '
    [stats]
    priority = 110
    pattern = ^stats\..*
    retentions = 10:2160,60:10080,600:262974
    ' >> storage-schemas.conf

    echo '
    [counters]
    pattern = stats.counts.*
    xFilesFactor = 0.0
    aggregationMethod = sum
    ' >> storage-aggregation.conf

    mkdir /etc/httpd/wsgi

    echo '
    Include "/etc/httpd/vhosts/*.conf"
    ' >> /etc/httpd/conf/httpd.conf

    # replace /etc/httpd/vhosts/graphite-vhost.conf with the
    # graphite-vhost.conf from this repo.

    chown -R apache:apache /opt/graphite/storage/

    cd /opt/graphite/webapp/graphite
    sudo python manage.py syncdb

    # This will create a Django admin user named 'root'. You will also
    # have to pick an email address and password.

    cd /opt/graphite/
    ./bin/carbon-cache.py start

    apachectl restart

    cd /tmp
    git clone http://github.com/joyent/node.git
    cd node
    git checkout v0.8
    ./configure && make && make install

    cd /tmp
    wget --no-check-certificate http://npmjs.org/install.sh
    sh install.sh
    /usr/local/bin/npm install express

    cd /tmp
    git clone http://github.com/etsy/statsd.git
    cp -R /tmp/statsd /opt/graphite

    cd /opt/graphite/statsd
    cp exampleConfig.js local.js

    # edit local.js and update the config for graphiteHost

    nohup /usr/local/bin/node stats.js local.js &

  14. @textarcana-automation textarcana-automation revised this gist Jan 23, 2013. 1 changed file with 39 additions and 0 deletions.
    39 changes: 39 additions & 0 deletions graphite-vhost.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    <VirtualHost *:80>
    ServerName graphite
    DocumentRoot "/opt/graphite/webapp"
    ErrorLog /opt/graphite/storage/log/webapp/error.log
    CustomLog /opt/graphite/storage/log/webapp/access.log common

    # I've found that an equal number of processes & threads tends
    # to show the best performance for Graphite (ymmv).
    WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120
    WSGIProcessGroup graphite
    WSGIApplicationGroup %{GLOBAL}
    WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite application-group=%{GLOBAL}

    # XXX You will need to create this file! There is a graphite.wsgi.example
    # file in this directory that you can safely use, just copy it to graphite.wgsi
    WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi

    Alias /content/ /opt/graphite/webapp/content/
    <Location "/content/">
    SetHandler None
    </Location>

    # XXX In order for the django admin site media to work you
    # must use the path to your django installation, which is
    # probably something like:
    # /usr/lib/python2.6/site-packages/django

    Alias /media/ "/usr/lib/python2.6/site-packages/django/contrib/admin/media/"
    <Location "/media/">
    SetHandler None
    </Location>
    # The graphite.wsgi file has to be accessible by apache. It won't
    # be visible to clients because of the DocumentRoot though.
    <Directory /opt/graphite/conf/>
    Order deny,allow
    Allow from all
    </Directory>

    </VirtualHost>
  15. Noah Sussman created this gist Jan 23, 2013.
    1 change: 1 addition & 0 deletions install-statsd-graphite-centos-6-3.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    rpm -i http://ftp.uninett.no/linux/epel/6/x86_64/epel-release-6-5.noarch.rpm