CentOS7下部署Open-Falcon小米开源监控系统_sql


Open-Falcon

Open-Falcon是由小米开启的一款企业级、高可用、可扩展的开源监控解决方案

特点与优势如下

1、强大灵活的数据采集:自动发现,支持falcon-agent、snmp、支持用户主动push、用户自定义插件支持、opentsdb data model like(timestamp、endpoint、metric、key-value tags)

2、水平扩展能力:支持每个周期上亿次的数据采集、告警判定、历史数据存储和查询

3、高效率的告警策略管理:高效的portal、支持策略模板、模板继承和覆盖、多种告警方式、支持callback调用

4、人性化的告警设置:最大告警次数、告警级别、告警恢复通知、告警暂停、不同时段不同阈值、支持维护周期

5、高效率的graph组件:单机支撑200万metric的上报、归档、存储(周期为1分钟)

6、高效的历史数据query组件:采用rrdtool的数据归档策略,秒级返回上百个metric一年的历史数据

7、dashboard:多维度的数据展示,用户自定义Screen

8、高可用:整个系统无核心单点,易运维,易部署,可水平扩展

9、开发语言:整个系统的后端,全部golang编写,portal和dashboard使用python编写

Open-Falcon 专为现代分布式系统设计的开源和企业级监视系统。

架构图

CentOS7下部署Open-Falcon小米开源监控系统_sed_02

CentOS7下部署单机版本Open-Falcon

参考官方文档 https://book.open-falcon.org/zh_0_2/quick_install/

1、环境准备

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
yum clean all
yum makecache

systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

CentOS7下部署Open-Falcon小米开源监控系统_sql_03

CentOS7下部署Open-Falcon小米开源监控系统_mysql_04

2、安装golang,redis,mariadb所需组件

yum install -y golang

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

yum install -y redis
systemctl start redis
systemctl enable redis

yum install -y mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysqladmin -uroot password "openfalcon"

CentOS7下部署Open-Falcon小米开源监控系统_mysql_05

CentOS7下部署Open-Falcon小米开源监控系统_sql_06

CentOS7下部署Open-Falcon小米开源监控系统_sql_07

3、导入open-falcon数据库

mkdir -p /home/work/open-falcon
cd /home/work/open-falcon
git clone https://github.com/open-falcon/falcon-plus.git

cd /home/work/open-falcon/falcon-plus/scripts/mysql/db_schema
mysql -h 127.0.0.1 -u root -popenfalcon < 1_uic-db-schema.sql
mysql -h 127.0.0.1 -u root -popenfalcon < 2_portal-db-schema.sql
mysql -h 127.0.0.1 -u root -popenfalcon < 3_dashboard-db-schema.sql
mysql -h 127.0.0.1 -u root -popenfalcon < 4_graph-db-schema.sql
mysql -h 127.0.0.1 -u root -popenfalcon < 5_alarms-db-schema.sql

CentOS7下部署Open-Falcon小米开源监控系统_mysql_08

CentOS7下部署Open-Falcon小米开源监控系统_mysql_09

4、下载open-falcon-v0.3版本二进制包

https://github.com/open-falcon/falcon-plus/releases/download/v0.3/open-falcon-v0.3.tar.gz

cd /home/work/
mkdir open-falcon
wget https://github.com/open-falcon/falcon-plus/releases/download/v0.3/open-falcon-v0.3.tar.gz
tar -zxvf open-falcon-v0.3.tar.gz -C /home/work/open-falcon/

CentOS7下部署Open-Falcon小米开源监控系统_sql_10

5、先部署后端

sed -i 's#root:@tcp(127.0.0.1:3306)#root:openfalcon@tcp(127.0.0.1:3306)#g' `find ./ -type f -name "cfg.json"|egrep "alarm|api|nodata|hbs|graph|aggregator"`
cat `find ./ -type f -name "cfg.json"|egrep "alarm|api|nodata|hbs|graph|aggregator"` |grep 'root:openfalcon@tcp(127.0.0.1:3306)'
./open-falcon start

CentOS7下部署Open-Falcon小米开源监控系统_sed_11

或者参考官网的操作

cd $WORKSPACE
grep -Ilr 3306 ./ | xargs -n1 -- sed -i 's/root:/real_user:real_password/g'

6、部署前端

cd /home/work/
git clone https://github.com/open-falcon/dashboard.git
cd dashboard
yum install -y python-virtualenv python-devel openldap-devel mysql-devel
yum groupinstall -y "Development tools"
virtualenv ./env
./env/bin/pip install -r pip_requirements.txt -i https://pypi.douban.com/simple

CentOS7下部署Open-Falcon小米开源监控系统_sql_12

CentOS7下部署Open-Falcon小米开源监控系统_sed_13

CentOS7下部署Open-Falcon小米开源监控系统_mysql_14

CentOS7下部署Open-Falcon小米开源监控系统_sql_15

修改配置 修改数据库连接密码,dashboard的配置文件为:rrd/config.py

CentOS7下部署Open-Falcon小米开源监控系统_sql_16

然后启动dashboard 

./control start

CentOS7下部署Open-Falcon小米开源监控系统_sql_17

7、访问并体验WebUI界面

1、先测试启动自身Agent进行测试 ./open-falcon start agent  启动进程 

2、登录web界面,新增一个root用户,然后登录

CentOS7下部署Open-Falcon小米开源监控系统_mysql_18


3、查看endpoint有没有上线,刷新counter列表,可以看到监控指标

CentOS7下部署Open-Falcon小米开源监控系统_sed_19

4、添加host后,点击host可以直接查看该host的监控信息与状况

CentOS7下部署Open-Falcon小米开源监控系统_sql_20

CentOS7下部署Open-Falcon小米开源监控系统_sql_21

更多功能可以自行尝试(未完待续)