转 http://blog.51cto.com/wangzhijian/2094165
一、环境准备
yum -y install redis mariadb-server
# yum install-y python-virtualenv python-devel mariadb-devel openldap-devel
# yum groupinstall"Development tools"# systemctl start redis
# systemctl status redis
# systemctl start mariadb
# systemctl status mariadb
二、初始化MySQL表结构
git clone https://github.com/open-falcon/scripts.git
# cd falcon-plus/scripts/mysql/db_schema/
# mysql -h 127.0.0.1 -u root -p < 1_uic-db-schema.sql
# mysql -h 127.0.0.1 -u root -p < 2_portal-db-schema.sql
# mysql -h 127.0.0.1 -u root -p < 3_dashboard-db-schema.sql
# mysql -h 127.0.0.1 -u root -p < 4_graph-db-schema.sql
# mysql -h 127.0.0.1 -u root -p < 5_alarms-db-schema.sql
三、创建工作目录并下载解压文件
wget https://codeload.github.com/open-falcon/falcon-plus/tar.gz/v0.2.1 -O open-falcon-v0.2.1.tar.gz
# export FALCON_HOME=/etc
# export WORKSPACE=$FALCON_HOME/open-falcon
# mkdir -p $WORKSPACE
# tar -zxvf open-falcon-v0.2.1.tar.gz -C $WORKSPACE
四、启动open-falcon
# cd /etc/open-falcon
# ./open-falcon start ##启动open-falcon
# ./open-falcon check ##检查所有模块的启动状况
falcon-graph UP 2920falcon-hbs UP 2929falcon-judge UP 2938falcon-transfer UP 2946falcon-nodata UP 2951falcon-aggregator UP 2959falcon-agent UP 2965falcon-gateway UP 2972falcon-api UP 2980falcon-alarm UP 2986
五、安装并启用dashboard
# cd /etc/open-falcon
# git clone https://github.com/open-falcon/dashboard.git
# yum -y install python-pip python-wheel
# pip install--upgrade pip
# pip install-r pip_requirements.txt -i https://pypi.douban.com/simple
# cd dashboard
# ./control start
# ./control status
falcon-dashboard now is running, pid=3040
注1:dashboard的配置文件为:"rrd/config.py",请根据实际情况修改。
注2:dashbord没有默认创建任何账号包括管理账号,需要自行通过页面注册账号。想拥有管理全局的超级管理员账号,需手动注册用户名为root的账号。
六、安装vsphere-monitor
# git clone https://github.com/freedomkk-qfeng/vsphere-monitor.git
# yum install -y python-virtualenv
# cd vsphere-monitor
# virtualenv ./env
# ./env/bin/pip install -r requirement.txt
七、配置并运行vsphere-monitor
# vim config.py
#coding=utf-8# falcon
endpoint= "vcenter" # 上报给 open-falcon 的 endpoint
push_api= "http://127.0.0.1:6060/api/push"# 上报的 http api 接口
interval= 60# 上报的 step 间隔
# vcenter
host= "192.168.100.111"# vcenter 的地址
user= "administrator@zhi.local"# vcenter 的用户名
pwd= "abcdef"# vcenter 的密码
port= 443# vcenter 的端口
# esxi
esxi_names=[] # 需要采集的 esxi ,留空则全部采集
# datastore
datastore_names=[] # 需要采集的 datastore ,留空则全部采集
# vm
vm_enable=True # 是否要采集虚拟机信息
vm_names=[] # 需要采集的虚拟机,留空则全部采集
# env/bin/python /root/vsphere-monitor/vsphere-monitor.py ##运行vsphere-monitor
# crontab-e ##添加定时任务
# crontab-l ##列出定时任务0-59/1 * * * * /root/vsphere-monitor/env/bin/python /root/vsphere-monitor/vsphere-monitor.py
八、监控图如下