1、環境準備
html
# 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
2、初始化MySQL表結構python
# 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
3、建立工做目錄並下載解壓文件mysql
# 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
4、啓動open-falcongit
# cd /etc/open-falcon # ./open-falcon start ##啓動open-falcon # ./open-falcon check ##檢查全部模塊的啓動情況 falcon-graph UP 2920 falcon-hbs UP 2929 falcon-judge UP 2938 falcon-transfer UP 2946 falcon-nodata UP 2951 falcon-aggregator UP 2959 falcon-agent UP 2965 falcon-gateway UP 2972 falcon-api UP 2980 falcon-alarm UP 2986
5、安裝並啓用dashboard
github
# 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的帳號。
redis
6、安裝vsphere-monitorsql
# 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
7、配置並運行vsphere-monitorvim
# 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
8、監控圖以下api
注:詳細內容請參詳:https://book.open-falcon.org/zh_0_2/usage/vsphere.htmlbash