CentOS-7 stand-alone deployment of Open-Falcon millet open source monitoring system

Introduction to Open-Falcon:

  • OpenFalcon is an enterprise-level, highly available, and scalable open source monitoring solution.
  • Currently: Thousands of stars and thousands of forks have been achieved on github.
  • Official introduction: https://book.open-falcon.org/zh_0_2/intro/

Open-Falcon Features:

  • Powerful and flexible data collection: automatic discovery, support for falcon-agent, snmp, user active push, user-defined plug-in support, opentsdb data model like (timestamp, endpoint, metric, key-value tags);
  • Horizontal expansion capability: support hundreds of millions of data collection, alarm judgment, historical data storage and query in each cycle;
  • Efficient alarm policy management: efficient portal, support for policy templates, template inheritance and coverage, multiple alarm methods, support for callback calls;
  • Humanized alarm settings: maximum number of alarms, alarm level, alarm recovery notification, alarm suspension, different thresholds for different periods, and support for maintenance cycles;
  • High-efficiency graph component: a single machine supports the reporting, archiving, and storage of 2 million metrics (period is 1 minute);
  • Efficient historical data query component: adopt rrdtool's data archiving strategy, and return hundreds of metric's historical data for one year in seconds;
  • dashboard: multi-dimensional data display, user-defined Screen;
  • High availability: the whole system has no core single point, easy to operate and maintain, easy to deploy, and can be expanded horizontally;
  • Development language: The backend of the entire system is written in golang, and the portal and dashboard are written in python.

Open-Falcon architecture:

Environment preparation:

1): Replace Yum source (use Ali source):

# 备份CentOS-7默认yum源文件
cd /etc/yum.repos.d/ && mkdir bak && mv *.repo bak
# 下载阿里云Base源文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 清除缓存并重新生产缓存
yum clean all
yum makecache
# 加载阿里云epel仓库
yum install epel-release

2): Deploy Redis in yum mode:

# yum安装redis
yum install redis -y
# 启动Redis服务
systemctl start redis
# 查看Redis服务运行状态
systemctl status redis

3): Deploy Mysql 5.7:

# 创建software目录并切换
mkdir -p /opt/software && cd /opt/software
# 下载mysql-RPM包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# yum localinstall安装mysql-RPM包,相比rpm -ivh方式,此方式会自动解决安装依赖
yum localinstall mysql57-community-release-el7-8.noarch.rpm -y
yum repolist enabled | grep "mysql.*-community.*"
# yum安装mysql
yum install mysql-community-server -y
# 启动Mysql服务
systemctl start mysqld
# 查看Mysql服务运行状态
systemctl status mysqld

# 获取Mysql初始生成的密码
grep 'temporary password' /var/log/mysqld.log
# 修改root密码
mysql -uroot -p'pk+wyYkD>5ah'
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1qaz@WSX';
mysql> exit

insert image description here

4): Initialize the MySQL table structure:

# 安装git命令
yum install -y git
# 拉取Sql脚本文件
git clone https://github.com/open-falcon/falcon-plus.git
# 切换目录
cd /opt/software/falcon-plus/scripts/mysql/db_schema/
# 依次执行初始化脚本
# 使用-p明文密码会提示不安全,实际生产中切忌使用明文密码
mysql -h 127.0.0.1 -u root -p'1qaz@WSX' < 1_uic-db-schema.sql
mysql -h 127.0.0.1 -u root -p'1qaz@WSX' < 2_portal-db-schema.sql
mysql -h 127.0.0.1 -u root -p'1qaz@WSX' < 3_dashboard-db-schema.sql
mysql -h 127.0.0.1 -u root -p'1qaz@WSX' < 4_graph-db-schema.sql
mysql -h 127.0.0.1 -u root -p'1qaz@WSX' < 5_alarms-db-schema.sql

insert image description here

Deploy the Open-Falcon backend service

  • There are two ways of backend deployment:
    • The first method: compile and install from source code
    • The second: use the compiled binary version

1): Download and decompress the binary package:

# 切换目录,下载二进制包
cd /opt/software/ && wget https://github.com/open-falcon/falcon-plus/releases/download/v0.3/open-falcon-v0.3.tar.gz
# 创建工作目录,解压二进制包
mkdir -p /opt/open-falcon && tar -zxvf open-falcon-v0.3.tar.gz -C /opt/open-falcon/

2): Modify the configuration file:

# 切换至工作目录,修改配置文件中Mysql用户名和密码;
cd /opt/open-falcon/ && grep -Ilr 3306  ./ | xargs -n1 -- sed -i 's/root:/root:1qaz@WSX/g'

3): Start the backend service:

# 启动后端所有服务
./open-falcon start
# 检查所有模块的启动状况:"UP"正常,"Down"异常
./open-falcon check
  • 3.1.1): More command-line tool usage:
# 所有可选参数,"module"为模块名称
./open-falcon [start|stop|restart|check|monitor|reload] module

# 日志查看与调试分析,日志路径如下
$WorkDir/$moduleName/log/logs/xxx.log

Deploy the Open-Falcon front-end service

1): Pull the front-end component code

# 目录切换,拉取前端组件代码
cd /opt/open-falcon/ && git clone https://github.com/open-falcon/dashboard.git

2): Install dependent packages

yum install -y python-virtualenv python-devel openldap-devel mysql-devel
yum groupinstall "Development tools" -y

cd /opt/open-falcon/dashboard/
virtualenv ./env

./env/bin/pip install -r pip_requirements.txt -i https://pypi.douban.com/simple

3): Modify the Dashboard configuration

  • The configuration file of the dashboard is: 'rrd/config.py'
# 修改数据库的用户名和密码
sed -i 's/"PORTAL_DB_USER","falcon"/"PORTAL_DB_USER","root"/g' ./rrd/config.py
sed -i 's/"PORTAL_DB_PASS","falcon"/"PORTAL_DB_PASS","1qaz@WSX"/g' ./rrd/config.py
sed -i 's/"ALARM_DB_PASS",""/"ALARM_DB_PASS","1qaz@WSX"/g' ./rrd/config.py

#修改Falcon+ API的地址端口信息
sed -i 's/127.0.0.1:18080/127.0.0.1:8080/g' ./rrd/config.py

4): Start the front-end service:

# 切换至Dashboard工作目录,并启动服务
cd /opt/open-falcon/dashboard/ && bash control start
# 查看日志
bash control tail
# 停止Dashboard服务
bash control stop
  • 4.1.1): Dashboard user management:
  • Dashbord does not create any account by default, including management account, you need to register an account through the page.

  • If you want to have a super administrator account for global management, you need to manually register an account with the user name root (the first user whose account name is root will be automatically set as a super administrator).

  • Super administrators can assign authority management to ordinary users.

  • Tip: The registered account can be registered by anyone who opens the dashboard page, so after registering the account for the relevant person, you need to close the function of registering the account.

    • You only need to modify the configuration file cfg.json of the api component, change the signup_disable configuration item to true, and restart the api. When you need to open an account for someone, you can change the configuration option back, and then close it after use.insert image description here

Guess you like

Origin blog.csdn.net/wkl1007/article/details/113374903