当前位置: 首页 > 工具软件 > Falcon > 使用案例 >

open-falcon plus——安装

松翔
2023-12-01

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/

 类似资料: