open-falcon plus——安裝
阿新 • • 發佈:2018-11-04
open-falcon 是小米開源的運維繫統後臺為golang開發,正常情況下按照官方文件說明就可以搭建成功。
一、後臺程式編譯安裝
1、環境準備
- Git >= 1.7.5
- Go >= 1.6
- yum install redis
- yum install mysql
如果redis與mysql環境已經安裝,可在配置檔案配置。
2、下載原始碼(open-falcon有0.1與0.2版本,0.1版本各個模組獨立執行,非常不方便,0.2版本各個模組整合,編譯打包很方便)
# Please make sure that you have set `$GOPATH` and `$GOROOT` correctly. # If you have not golang in your host, please follow [https://golang.org/doc/install] to install golang. mkdir -p $GOPATH/src/github.com/open-falcon cd $GOPATH/src/github.com/open-falcon git clone https://github.com/open-falcon/falcon-plus.git
資料庫初始化
cd $GOPATH/src/github.com/open-falcon/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、編譯打包
cd $GOPATH/src/github.com/open-falcon/falcon-plus/
# make all modules
make all
# make specified module
make agent
# pack all modules
make pack
說明:直接執行時會提示配置檔案或執行檔案目錄不對,但是打包檔案解壓可正常執行./g/g.go檔案可對執行檔案與配置檔案路徑進行編輯。
4、解壓執行
export WorkDir="$HOME/open-falcon" mkdir -p $WorkDir tar -xzvf open-falcon-vx.x.x.tar.gz -C $WorkDir cd $WorkDir cd $WorkDir ./open-falcon start # check modules status ./open-falcon check
5、狀態檢視
# ./open-falcon [start|stop|restart|check|monitor|reload] module
./open-falcon start agent
./open-falcon check
falcon-graph UP 53007
falcon-hbs UP 53014
falcon-judge UP 53020
falcon-transfer UP 53026
falcon-nodata UP 53032
falcon-aggregator UP 53038
falcon-agent UP 53044
falcon-gateway UP 53050
falcon-api UP 53056
falcon-alarm UP 53063
6、上面執行是所有模組都運行了,一般只有運維伺服器需要執行這些模組,監控端只需要執行agent模組即可。
二、前端安裝
1、open-falcon採用前後端分離,前端dashboard為另外一個專案https://github.com/open-falcon/dashboard,支援docker與i18n,原始碼執行,為python環境
2、下載檔案
export HOME=/home/work/
mkdir -p $HOME/open-falcon/
cd $HOME/open-falcon && git clone https://github.com/open-falcon/dashboard.git
cd dashboard;
3、安裝依賴
CentOS
yum install -y python-virtualenv
yum install -y python-devel
yum install -y openldap-devel
yum install -y mysql-devel
yum groupinstall "Development tools"
cd $HOME/open-falcon/dashboard/
virtualenv ./env
./env/bin/pip install -r pip_requirements.txt
Ubuntu
apt-get install -y python-virtualenv
apt-get install -y slapd ldap-utils
apt-get install -y libmysqld-dev
apt-get install -y build-essential
apt-get install -y python-dev libldap2-dev libsasl2-dev libssl-dev
cd $HOME/open-falcon/dashboard/
virtualenv ./env
./env/bin/pip install -r pip_requirements.txt
4、初始化資料庫,步驟與後臺安裝是一致,若前面已經初始化,此步驟可以省略
5、配置後臺介面rrd/config.py
dashboard config file is 'rrd/config.py', change it if necessary.
## set API_ADDR to your falcon-plus api modules addr, default value as bellow:
API_ADDR = "http://127.0.0.1:8080/api/v1"
## set PORTAL_DB_* if necessary, default mysql user is root, default passwd is ""
## set ALARM_DB_* if necessary, default mysql user is root, default passwd is ""
## if following error msg occurred, please check DB config in rrd/config.py
Error 'NoneType' object has no attribute 'cursor'
6、執行
control start
在瀏覽器中輸入http://ip:8081/能訪問則說明前端執行正常,首次登陸需要自己註冊使用者。
前面簡單的安裝就成功了, 官方文件非常清晰,但是後面如何使用還要慢慢研究。
附:中文手冊地址:https://book.open-falcon.org/zh_0_2/