User Tools

Site Tools


aix:graphite

AIX compile wsgi_mod
http://stackoverflow.com/questions/4229542/aix-missing-symbols-ap-cleanup-scoreboard-and-ap-accept-lock-mech-for-apache-pro

Apache 2 on AIX7 with mod_ssl, Django and mod_wsgi http://www.sturge.ca/?p=117

http://tompurl.com/2011/08/12/installing-graphite-on-ubuntu-10-4-lts/

http://graphite.readthedocs.org/en/0.9.10/install.html

http://kaivanov.blogspot.fr/2012/02/how-to-install-and-use-graphite.html

http://blog.vuksan.com/2010/09/29/integrating-graphite-with-ganglia/

http://grantheffernan.wordpress.com/tag/graphite/

http://graphite.readthedocs.org/en/latest/config-carbon.html

install: https://gist.github.com/textarcana/3093751 https://gist.github.com/jgeurts/3112065

On Ubuntu

####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################

cd
sudo apt-get update
sudo apt-get upgrade

wget https://launchpad.net/graphite/0.9/0.9.10/+download/graphite-web-0.9.10.tar.gz
wget https://launchpad.net/graphite/0.9/0.9.10/+download/carbon-0.9.10.tar.gz
wget https://launchpad.net/graphite/0.9/0.9.10/+download/whisper-0.9.10.tar.gz
tar -zxvf graphite-web-0.9.10.tar.gz
tar -zxvf carbon-0.9.10.tar.gz
tar -zxvf whisper-0.9.10.tar.gz
mv graphite-web-0.9.10 graphite
mv carbon-0.9.10 carbon
mv whisper-0.9.10 whisper
rm graphite-web-0.9.10.tar.gz
rm carbon-0.9.10.tar.gz
rm whisper-0.9.10.tar.gz
sudo apt-get install --assume-yes apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 build-essential python3.2 python-dev libpython3.2 python3-minimal libapache2-mod-wsgi libaprutil1-ldap memcached python-cairo-dev python-django python-ldap python-memcache python-pysqlite2 sqlite3 erlang-os-mon erlang-snmp rabbitmq-server bzr expect ssh libapache2-mod-python python-setuptools
sudo easy_install django-tagging

sudo easy_install zope.interface

sudo easy_install twisted

sudo easy_install txamqp

####################################
# INSTALL WHISPER
####################################

cd ~/whisper
sudo python setup.py install

####################################
# INSTALL CARBON
####################################

cd ~/carbon
sudo python setup.py install

cd /opt/graphite/conf
sudo cp carbon.conf.example carbon.conf
sudo cp storage-schemas.conf.example storage-schemas.conf
sudo gedit storage-schemas.conf
### Replace contents of storage-schemas.conf to be the following
[stats]
priority = 110
pattern = .*
retentions = 15s:7d,1m:21d,15m:5y
###


####################################
# CONFIGURE GRAPHITE (webapp)
####################################

cd ~/graphite
sudo python check-dependencies.py
sudo python setup.py install

# CONFIGURE APACHE
###################
cd ~/graphite/examples
sudo cp example-graphite-vhost.conf /etc/apache2/sites-available/default
sudo cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
sudo mkdir /etc/httpd
sudo mkdir /etc/httpd/wsgi

sudo gedit /etc/apache2/sites-available/default
#####
# Change the line: WSGISocketPrefix run/wsgi
# To: WSGISocketPrefix /etc/httpd/wsgi
#####

sudo /etc/init.d/apache2 reload


####################################
# INITIAL DATABASE CREATION
####################################
cd /opt/graphite/webapp/graphite/
sudo python manage.py syncdb
# follow prompts to setup django admin user
sudo chown -R www-data:www-data /opt/graphite/storage/
sudo /etc/init.d/apache2 restart
cd /opt/graphite/webapp/graphite
sudo cp local_settings.py.example local_settings.py

####################################
# START CARBON
####################################
cd /opt/graphite/
sudo ./bin/carbon-cache.py start

http://graphite.wikidot.com/installation

Whisper :

$ sudo whisper-info.py /data/whisper/collectd/63694/swap/used.wsp

maxRetention: 31536000
xFilesFactor: 0.5
aggregationMethod: average
fileSize: 534580

Archive 0
retention: 86400
secondsPerPoint: 60
points: 1440
size: 17280
offset: 52

...

http://obfuscurity.com/2012/04/

If you need to adjust the xFilesFactor value for existing metrics, employ the whisper-resize.py tool:

$ sudo su -c "umask 0033; whisper-resize.py --xFilesFactor=0.0 --nobackup \
  /data/whisper/pulse/amqp-publishes-per-second.wsp 1s:5m 1m:1d 5m:28d 15m:1y" carbon

Retrieving all data from the archives

Creating new whisper database: amqp-publishes-per-second.wsp.tmp
Created: amqp-publishes-per-second.wsp.tmp (534580 bytes)
Migrating data...
Renaming old database to: amqp-publishes-per-second.wsp.bak
Renaming new database to: amqp-publishes-per-second.wsp
Unlinking backup: amqp-publishes-per-second.wsp.bak

Init script for carbon

To start carbon at reboot, add the following script into the right rc level:

#! /bin/sh
# /etc/init.d/carbon

# Some things that run always
touch /var/run/carbon

GRAPHITE_HOME=/opt/graphite
CARBON_USER=www

# Carry out specific functions when asked to by the system
case "$1" in
    start)
        echo "Starting script carbon "
        su $CARBON_USER -c "cd $GRAPHITE_HOME"; su $CARBON_USR -c "$GRAPHITE_HOME/bin/carbon-cache.py start"
        ;;
    stop)
        echo "Stopping script carbon"
        su $CARBON_USER -c "cd $GRAPHITE_HOME"; su $CARBON_USR -c "$GRAPHITE_HOME/bin/carbon-cache.py stop"
        ;;
    *)
        echo "Usage: /etc/init.d/carbon {start|stop}"
        exit 1
        ;;
esac

exit 0

Django DB

http://www.boris.co/2012/02/get-graphite-run-for-django-project.html

Run

1	# carbon
2	cd ../../
3	sudo ./bin/carbon-cache.py start
4	## it will listen on 2003 port
5	 
6	# graphite web ui
7	cd webapp/graphite
8	python manage.py runserver 0.0.0.0:8000

As Graphite has an internal Django DB, here are some usefull commands:
First go to the Django DB home directory: search the file settings.py and go in that directory

Create a superuser for the DB:
python manage.py createsuperuser --username=joe --email=joe@example.com
Create a basic user for the DB:
python manage.py shell
>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')
# At this point, user is a User object that has already been saved
# to the database. You can continue to change its attributes
# if you want to change other fields.
>>> user.last_name = 'Lennon'
>>> user.save()
List all users defined into the DB:
python manage.py shell
Python 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import User, Group
>>> User.objects.filter(first_name='')
[<User: root>, <User: default>, <User: manu>]
>>> User.objects.filter(is_superuser='true')
[<User: root>, <User: manu>]
Change a user password
python manage.py shell
>>> from django.contrib.auth.models import User
>>> u = User.objects.get(username__exact='john')
>>> u.set_password('new password')
>>> u.save()

https://docs.djangoproject.com/en/dev/topics/auth/default/#user-objects

aix/graphite.txt · Last modified: 2021/01/01 21:21 (external edit)