graphite安装
环境准备
# yum install gcc python27-devel.x86_64 python-devel -y
# yum install cairo pango gdk-pixbuf -y
# yum install libffi libffi-devel -y
安装go-carbon
# wget https://github.com/lomik/go-carbon/releases/download/v0.12.0/go-carbon-0.12.0-1.x86_64.rpm
# rpm -ivh go-carbon-0.12.0-1.x86_64.rpm
# /etc/init.d/go-carbon start
安装graphite-web
# pip install --no-binary=:all: https://github.com/graphite-project/whisper/tarball/master
# pip install --no-binary=:all: https://github.com/graphite-project/graphite-web/tarball/master
# pip install --no-binary=:all: https://github.com/graphite-project/carbon/tarball/master
# pip install whisper
# pip install bottle
# pip install uwsgi
# yum install nginx
配置文件
# cd /opt/graphite/conf/
# cp storage-schemas.conf.example storage-schemas.conf
# cat << EOF > /opt/graphite/conf/uwsgi.ini
> [uwsgi]
[uwsgi]
socket = /opt/graphite/conf/uwsgi.sock
workers = 2
#workers = 5
master = true
pythonpath = /opt/graphite/webapp/graphite
wsgi-file = /opt/graphite/conf/graphite.wsgi
pidfile = /opt/graphite/conf/uwsgi.pid
daemonize = /opt/graphite/logs/graphite.log
disable-logging = 1
stats = 127.0.0.1:1717
EOF
# cp graphite.wsgi.example graphite.wsgi
# mkdir -p /opt/graphite/logs
# /usr/local/bin/uwsgi --ini /opt/graphite/conf/uwsgi.ini
nginx
cat << EOF > /etc/nginx/conf.d/graphite.conf
upstream django {
server unix:///opt/graphite/conf/uwsgi.sock; # for a file socket
}
server {
listen 8001;
#server_name .example.com; # substitute your machine's IP address or FQDN
charset utf-8;
client_max_body_size 75M; # adjust to taste
location /static {
alias /opt/graphtie/webapp/content; # your Django project's static files - amend as required
}
location /static/admin {
alias /opt/graphtie/webapp/static/admin; # your Django project's static files - amend as required
}
location / {
auth_basic "Restricted Area";
# auth_basic_user_file /etc/nginx/conf.d/htppasswd;
uwsgi_pass django;
include uwsgi_params; # the uwsgi_params file you installed
}
}
server {
listen 8002;
charset utf-8;
client_max_body_size 75M; # adjust to taste
allow 127.0.0.1;
deny all;
location /static {
alias /opt/graphtie/webapp/content;
}
location /static/admin {
alias /opt/graphite/webapp/static/admin;
}
location / {
uwsgi_pass django;
include uwsgi_params; # the uwsgi_params file you installed
}
}
EOF
# /etc/init.d/nginx start
初始化数据库 (有问题)
# find / -name django-admin.py
# PYTHONPATH=/opt/graphite/webapp /usr/local/bin/django-admin.py collectstatic --noinput --settings=graphite.settings
# mv local_settings.py.example local_settings.py
# PYTHONPATH=/opt/graphite/webapp /usr/local/bin/django-admin.py migrate --settings=graphite.settings --run-syncdb
# PYTHONPATH=/opt/graphite/webapp /usr/local/bin/django-admin.py collectstatic --noinput --settings=graphite.settings
# /opt/graphite/bin/run-graphite-devel-server.py --libs=/opt/graphite/webapp/ /opt/graphite/ &
grafana
# yum install initscripts fontconfig -y
# yum install urw-fonts -y
# rpm -ivh grafana-5.0.4-1.x86_64.rpm
# /etc/init.d/grafana-server start
collectd
# yum install collectd -y
# cd /etc/collectd.d/
# cat df.conf
LoadPlugin df
IgnoreSelected false
ReportByDevice false
ReportReserved false
ReportInodes false
ValuesPercentage true
# cat graphite.conf
LoadPlugin write_graphite
Host "10.17.0.206"
Port "2003"
Protocol "udp"
LogSendErrors true
Prefix "collectd."
#Postfix "collectd"
SeparateInstances true
StoreRates true
AlwaysAppendDS false
EscapeCharacter "_"
# /etc/init.d/collectd start