1. open-falcon基本介绍

Open-Falcon作为一款开源的互联网企业级监控系统解决方案,以其高性能、易扩展、灵活配置等特点,在互联网公司和大规模IT基础设施中得到了广泛应用。无论是企业IT运维、开发团队还是DevOps,都可以通过Open-Falcon提升运维效率和故障排除能力

设计原理

Open-Falcon的设计原理主要包括以下几个部分:

  1. 模块架构
    • 数据采集与上报:通过falcon-agent组件自动发现并采集服务器的各种数据和指标,支持用户主动push和用户自定义插件。
    • 告警:Judge组件负责判断采集到的数据是否触发告警规则,并生成告警事件。
    • 归档与绘图:Graph组件负责存储监控数据,并提供绘图所需的接口。
    • 报警策略配置:用户可以在系统中配置多种报警策略,以满足不同的监控需求。
  2. 执行过程
    • falcon-agent采集到数据后,通过长连接迅速转发给Transfer组件。
    • Transfer组件负责分发数据给Judge和Graph组件,分别用于告警判定和绘图。
    • Judge组件根据报警策略判断数据是否触发告警,并将告警事件写入Redis消息队列。
    • Alarm组件监听Redis中的消息队列,将告警事件转发给微信、短信或邮件等通知方式。

主要功能

  1. 数据采集
    • 支持多种数据采集方式,包括Agent采集、API采集、脚本采集等。
    • falcon-agent能够高效采集系统指标、应用指标和自定义指标。
  2. 数据存储与分析
    • 支持多种数据存储后端,如Graphite、OpenTSDB、InfluxDB等。
    • 提供高效的数据存储和压缩算法,确保大规模数据的高效存储。
  3. 告警管理
    • 提供灵活的告警规则配置,支持多种告警触发条件和通知方式。
    • 内置智能的告警策略引擎,支持自动收敛,避免误报和漏报。
  4. 数据可视化
    • 提供Web管理界面(Dashboard),方便用户查看监控图表和配置告警规则23。
    • 支持自定义仪表盘和报告,便于数据展示和分享。
  5. 可扩展性
    • 设计为分布式架构,支持高可用性和横向扩展。
    • 提供丰富的扩展接口,支持自定义数据源和插件。

使用场景

Open-Falcon可以应用于多种场景,包括:

  • 企业IT运维:对数据中心、云服务器、网络设备进行实时监控,及时发现并解决问题。
  • 开发团队:监控应用和服务的性能,为持续集成与交付提供决策依据。
  • DevOps:自动化运维流程,通过告警快速定位问题,缩短故障恢复时间。

监控项目分为CPU、Load、内存、磁盘、IO、网络相关、内核参数、ss 统计输出、端口采集、核心服务的进程存活信息采集、关键业务进程资源消耗、NTP offset采集、DNS解析采集,这些指标,都是open-falcon的agent组件直接支持的。

2. open-falcon与其他监控工具的区别

img

3. 环境部署

主机名 WanIP LanIP 角色 应用
open-falcon 10.0.0.200 172.16.1.200 open-falcon服务端 open-falcon-server、MySQL
open-falcon-agent 10.0.0.201 172.16.1.201 open-falcon的客户端 open-falcon-agent
  • CentOs7.9
  • 2核4G
  • 内存分配20G
  • 镜像源:阿里源

4. 服务端部署

1
2
3
4
5
6
7
8
9
10
11
12
13
14
## 更换阿里源和epel源
[root@falcon ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[root@falcon ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2024-08-03 23:17:34-- http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 180.178.233.232, 180.178.233.233, 180.178.245.235, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|180.178.233.232|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

100%[=============================================================================>] 2,523 --.-K/s in 0.001s

2024-08-03 23:17:34 (2.84 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]

1
2
3
## 下载常用软件
[root@falcon ~]# yum install git telnet net-tools tree nmap sysstat lrzsz dos2unix tcpdump ntpdate wget ## -y

1
2
3
## 配置时间同步
[root@falcon ~]# ntpdate cn.pool.ntp.org
3 Aug 23:24:22 ntpdate[20532]: adjust time server 119.28.183.184 offset -0.435286 sec
1
2
3
4
#开启缓存
[root@falcon ~]# sed -i 's#keepcache=0#keepcache=1#g' /etc/yum.conf
[root@falcon ~]# grep keepcache /etc/yum.conf
keepcache=1
1
2
3
4
5
6
7
8
#关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0

#关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service

1
2
## 安装 redis
[root@falcon ~]# yum install redis -y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## 启动redis
[root@falcon ~]# redis-server &
[1] 20863
[root@falcon ~]# 20863:C 03 Aug 23:27:25.244 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
20863:M 03 Aug 23:27:25.244 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.12 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 20863
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'

20863:M 03 Aug 23:27:25.244 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
20863:M 03 Aug 23:27:25.244 # Server started, Redis version 3.2.12
20863:M 03 Aug 23:27:25.244 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
20863:M 03 Aug 23:27:25.244 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
20863:M 03 Aug 23:27:25.244 * The server is now ready to accept connections on port 6379
^C

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
## 安装mysql并设置开机自启

[root@falcon ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
--2024-08-03 23:41:44-- http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 96.7.105.231, 2600:1417:8400:ab8::1d68, 2600:1417:8400:a87::1d68
Connecting to repo.mysql.com (repo.mysql.com)|96.7.105.231|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6140 (6.0K) [application/x-redhat-package-manager]
Saving to: ‘mysql-community-release-el7-5.noarch.rpm’

100%[=============================================================================>] 6,140 --.-K/s in 0s

2024-08-03 23:41:44 (783 MB/s) - ‘mysql-community-release-el7-5.noarch.rpm’ saved [6140/6140]

[root@falcon ~]# ll
total 200
-rw-------. 1 root root 1413 May 13 15:22 anaconda-ks.cfg
-rw-r--r--. 1 root root 188754 Apr 23 11:13 main.sh
-rw-r--r-- 1 root root 6140 Nov 12 2015 mysql-community-release-el7-5.noarch.rpm

[root@falcon ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-release-el7-5 ################################# [100%]

[root@falcon ~]# ll /etc/yum.repos.d/
total 44
-rw-r--r-- 1 root root 2523 Aug 4 2022 CentOS-Base.repo
-rw-r--r--. 1 root root 1675 May 13 16:46 CentOS-Base.repo.backup
-rw-r--r--. 1 root root 1312 May 13 16:46 CentOS-CR.repo
-rw-r--r--. 1 root root 649 May 13 16:46 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 292 May 13 16:46 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 629 May 13 16:46 CentOS-Media.repo
-rw-r--r--. 1 root root 1347 May 13 16:46 CentOS-Sources.repo
-rw-r--r--. 1 root root 921 May 13 16:46 epel.repo
-rw-r--r--. 1 root root 1020 May 13 16:46 epel-testing.repo
-rw-r--r-- 1 root root 1209 Jan 29 2014 mysql-community.repo
-rw-r--r-- 1 root root 1060 Jan 29 2014 mysql-community-source.repo

[root@falcon ~]# yum install -y mysql-server

[root@falcon ~]# systemctl start mysqld.service
[root@falcon ~]# systemctl enable mysqld.service

[root@falcon ~]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 20863/redis-server
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 8960/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 9190/master
tcp6 0 0 :::3306 :::* LISTEN 22084/mysqld
tcp6 0 0 :::6379 :::* LISTEN 20863/redis-server
tcp6 0 0 :::22 :::* LISTEN 8960/sshd
tcp6 0 0 ::1:25 :::* LISTEN 9190/master
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
## 初始化MySQL表结构,给用户设置密码,导入数据库表

[root@falcon ~]# cd /tmp/ && git clone https://github.com/open-falcon/falcon-plus.git
Cloning into 'falcon-plus'...
remote: Enumerating objects: 10196, done.
remote: Counting objects: 100% (279/279), done.
remote: Compressing objects: 100% (229/229), done.
remote: Total 10196 (delta 60), reused 229 (delta 36), pack-reused 9917
Receiving objects: 100% (10196/10196), 16.95 MiB | 2.43 MiB/s, done.
Resolving deltas: 100% (5352/5352), done.
[root@falcon tmp]# cd /tmp/falcon-plus/scripts/mysql/db_schema/
[root@falcon db_schema]# ll
total 24
-rw-r--r-- 1 root root 1952 Aug 4 00:08 1_uic-db-schema.sql
-rw-r--r-- 1 root root 7573 Aug 4 00:08 2_portal-db-schema.sql
-rw-r--r-- 1 root root 3391 Aug 4 00:08 3_dashboard-db-schema.sql
-rw-r--r-- 1 root root 1807 Aug 4 00:08 4_graph-db-schema.sql
-rw-r--r-- 1 root root 2558 Aug 4 00:08 5_alarms-db-schema.sql
[root@falcon db_schema]# mysqladmin -uroot password "password"
Warning: Using a password on the command line interface can be insecure.
[root@falcon db_schema]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.6.51 MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

mysql> \q
Bye
[root@falcon db_schema]# mysql -h 127.0.0.1 -u root -p < 1_uic-db-schema.sql
Enter password:
[root@falcon db_schema]# mysql -h 127.0.0.1 -u root -p < 2_portal-db-schema.sql
Enter password:
[root@falcon db_schema]# mysql -h 127.0.0.1 -u root -p < 3_dashboard-db-schema.sql
Enter password:
[root@falcon db_schema]# mysql -h 127.0.0.1 -u root -p < 4_graph-db-schema.sql
Enter password:
[root@falcon db_schema]# mysql -h 127.0.0.1 -u root -p < 5_alarms-db-schema.sql
Enter password:

[root@falcon db_schema]# mysql -uroot -ppassword
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.6.51 MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| alarms |
| dashboard |
| falcon_portal |
| graph |
| mysql |
| performance_schema |
| uic |
+--------------------+
8 rows in set (0.00 sec)

mysql> \q
Bye
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
## 安装go语言开发环境,配置好环境变量

[root@falcon db_schema]# yum install golang -y

[root@falcon db_schema]# [root@falcon db_schema]# go version
go version go1.20.12 linux/amd64

[root@falcon db_schema]# find / -name go
/usr/bin/go
/usr/lib/golang/src/cmd/go
/usr/lib/golang/src/cmd/vendor/golang.org/x/tools/go
/usr/lib/golang/src/go
/usr/lib/golang/bin/go

[root@falcon db_schema]# export GOROOT=/usr/lib/golang
[root@falcon db_schema]# export GOPATH=/home
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
## 安装open-falcon

[root@falcon profile.d]# export FALCON_HOME=/home/work
[root@falcon profile.d]# export WORKSPACE=$FALCON_HOME/open-falcon
[root@falcon profile.d]# mkdir -p $WORKSPACE
[root@falcon profile.d]# ll
total 68
-rw-r--r--. 1 root root 771 Oct 31 2018 256term.csh
-rw-r--r--. 1 root root 841 Oct 31 2018 256term.sh
-rw-r--r--. 1 root root 196 Mar 25 2017 colorgrep.csh
-rw-r--r--. 1 root root 201 Mar 25 2017 colorgrep.sh
-rw-r--r--. 1 root root 1741 Oct 30 2018 colorls.csh
-rw-r--r--. 1 root root 1606 Oct 30 2018 colorls.sh
-rw-r--r--. 1 root root 80 Oct 31 2018 csh.local
-rw-r--r-- 1 root root 50 Aug 4 00:29 go_env.sh
-rw-r--r--. 1 root root 1706 Oct 31 2018 lang.csh
-rw-r--r--. 1 root root 2703 Oct 31 2018 lang.sh
-rw-r--r--. 1 root root 123 Jul 31 2015 less.csh
-rw-r--r--. 1 root root 121 Jul 31 2015 less.sh
-rw-r--r--. 1 root root 81 Oct 31 2018 sh.local
-rw-r--r--. 1 root root 105 Dec 16 2020 vim.csh
-rw-r--r--. 1 root root 269 Dec 16 2020 vim.sh
-rw-r--r--. 1 root root 164 Jan 28 2014 which2.csh
-rw-r--r--. 1 root root 169 Jan 28 2014 which2.sh
[root@falcon profile.d]# cd
[root@falcon ~]# ll
total 200
-rw-------. 1 root root 1413 May 13 15:22 anaconda-ks.cfg
-rw-r--r--. 1 root root 188754 Apr 23 11:13 main.sh
-rw-r--r-- 1 root root 6140 Nov 12 2015 mysql-community-release-el7-5.noarch.rpm

[root@falcon ~]# rz
rz waiting to receive.**[root@falcon ~]# ll
total 67276
-rw-------. 1 root root 1413 May 13 15:22 anaconda-ks.cfg
-rw-r--r--. 1 root root 188754 Apr 23 11:13 main.sh
-rw-r--r-- 1 root root 6140 Nov 12 2015 mysql-community-release-el7-5.noarch.rpm
-r--r--r-- 1 root root 68685265 Jul 31 21:23 open-falcon-v0.3.tar.gz
[root@falcon ~]# tar xf open-falcon-v0.3.tar.gz -C $WORKSPACE
[root@falcon ~]# cd $WORKSPACE/
[root@falcon open-falcon]# ll
total 4272
drwxr-xr-x 7 czm_core czm_core 71 May 30 2019 agent
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 aggregator
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 alarm
drwxr-xr-x 6 czm_core czm_core 55 May 30 2019 api
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 gateway
drwxr-xr-x 6 czm_core czm_core 55 May 30 2019 graph
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 hbs
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 judge
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 nodata
-rwxr-xr-x 1 czm_core czm_core 4370880 May 30 2019 open-falcon
lrwxrwxrwx 1 czm_core czm_core 15 May 30 2019 plugin -> ./agent/plugin/
lrwxrwxrwx 1 czm_core czm_core 15 May 30 2019 public -> ./agent/public/
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 transfer
[root@falcon open-falcon]# cd /home/work
[root@falcon work]# ll
total 0
drwxr-xr-x 12 czm_core czm_core 190 May 30 2019 open-falcon
[root@falcon work]# cd open-falcon/
[root@falcon open-falcon]# ll
total 4272
drwxr-xr-x 7 czm_core czm_core 71 May 30 2019 agent
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 aggregator
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 alarm
drwxr-xr-x 6 czm_core czm_core 55 May 30 2019 api
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 gateway
drwxr-xr-x 6 czm_core czm_core 55 May 30 2019 graph
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 hbs
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 judge
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 nodata
-rwxr-xr-x 1 czm_core czm_core 4370880 May 30 2019 open-falcon
lrwxrwxrwx 1 czm_core czm_core 15 May 30 2019 plugin -> ./agent/plugin/
lrwxrwxrwx 1 czm_core czm_core 15 May 30 2019 public -> ./agent/public/
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 transfer
[root@falcon open-falcon]# pwd
/home/work/open-falcon

修改配置文件cfg.json(由于之前设置的root密码为password,底下配置文件要改)

修改的文件 路径
aggregator /home/work/open-falcon/aggregator/config/cfg.json
graph /home/work/open-falcon/graph/config/cfg.json
hbs /home/work/open-falcon/hbs/config/cfg.json
nodata /home/work/open-falcon/nodata/config/cfg.json
api /home/work/open-falcon/api/config/cfg.json
alarm /home/work/open-falcon/alarm/config/cfg.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
## 修改aggregator的配置文件

[root@falcon open-falcon]# cd aggregator/
[root@falcon aggregator]# ll
total 0
drwxr-xr-x 2 czm_core czm_core 31 May 30 2019 bin
drwxr-xr-x 2 czm_core czm_core 22 May 30 2019 config
drwxr-xr-x 2 czm_core czm_core 6 May 30 2019 logs
[root@falcon aggregator]# cd config/
[root@falcon config]# ll
total 4
-rw-r--r-- 1 czm_core czm_core 522 May 30 2019 cfg.json
[root@falcon config]# pwd
/home/work/open-falcon/aggregator/config
[root@falcon config]# vim cfg.json

img

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
## 修改graph的配置文件

[root@falcon open-falcon]# ll
total 4272
drwxr-xr-x 7 czm_core czm_core 71 May 30 2019 agent
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 aggregator
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 alarm
drwxr-xr-x 6 czm_core czm_core 55 May 30 2019 api
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 gateway
drwxr-xr-x 6 czm_core czm_core 55 May 30 2019 graph
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 hbs
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 judge
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 nodata
-rwxr-xr-x 1 czm_core czm_core 4370880 May 30 2019 open-falcon
lrwxrwxrwx 1 czm_core czm_core 15 May 30 2019 plugin -> ./agent/plugin/
lrwxrwxrwx 1 czm_core czm_core 15 May 30 2019 public -> ./agent/public/
drwxr-xr-x 5 czm_core czm_core 43 May 30 2019 transfer
[root@falcon open-falcon]# pwd
/home/work/open-falcon
[root@falcon open-falcon]# cd graph/
[root@falcon graph]# cd config
[root@falcon config]# vim cfg.json

img

1
2
3
## 修改hbs的配置文件

[root@falcon config]# vim /home/work/open-falcon/hbs/config/cfg.json

img

1
2
## 修改nodata的配置文件
[root@falcon config]# vim /home/work/open-falcon/nodata/config/cfg.json

img

1
2
## 修改api的配置文件
[root@falcon config]# vim /home/work/open-falcon/api/config/cfg.json

img

1
2
## 修改alarm的配置文件
[root@falcon config]# vim /home/work/open-falcon/alarm/config/cfg.json

img

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
## 启动后端模块,检查启动状态

[root@falcon work]# cd /home/work/open-falcon/
[root@falcon open-falcon]# ./open-falcon start
[falcon-graph] 31555
[falcon-hbs] 31567
[falcon-judge] 31578
[falcon-transfer] 31589
[falcon-nodata] 31597
[falcon-aggregator] 31616
[falcon-agent] 31635
[falcon-gateway] 31643
[falcon-api] 31653
[falcon-alarm] 31667

[root@falcon open-falcon]# ./open-falcon check
falcon-graph UP 31555
falcon-hbs UP 31567
falcon-judge UP 31578
falcon-transfer UP 31589
falcon-nodata UP 31597
falcon-aggregator UP 31616
falcon-agent UP 31635
falcon-gateway UP 31643
falcon-api UP 31653
falcon-alarm UP 31667

#更多的命令行工具用法

# ./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

#For debugging , You can check $WorkDir/$moduleName/log/logs/xxx.log

[root@falcon open-falcon]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 20863/redis-server
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 8960/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 9190/master
tcp6 0 0 :::6055 :::* LISTEN 31616/falcon-aggreg
tcp6 0 0 :::6090 :::* LISTEN 31597/falcon-nodata
tcp6 0 0 :::3306 :::* LISTEN 22084/mysqld
tcp6 0 0 :::6379 :::* LISTEN 20863/redis-server
tcp6 0 0 :::14444 :::* LISTEN 31643/falcon-gatewa
tcp6 0 0 :::6060 :::* LISTEN 31589/falcon-transf
tcp6 0 0 :::6030 :::* LISTEN 31567/falcon-hbs
tcp6 0 0 :::6031 :::* LISTEN 31567/falcon-hbs
tcp6 0 0 :::8080 :::* LISTEN 31653/falcon-api
tcp6 0 0 :::8433 :::* LISTEN 31589/falcon-transf
tcp6 0 0 :::6070 :::* LISTEN 31555/falcon-graph
tcp6 0 0 :::22 :::* LISTEN 8960/sshd
tcp6 0 0 :::6071 :::* LISTEN 31555/falcon-graph
tcp6 0 0 :::9912 :::* LISTEN 31667/falcon-alarm
tcp6 0 0 ::1:25 :::* LISTEN 9190/master
tcp6 0 0 :::16060 :::* LISTEN 31643/falcon-gatewa
tcp6 0 0 :::4444 :::* LISTEN 31589/falcon-transf
tcp6 0 0 :::6080 :::* LISTEN 31578/falcon-judge
tcp6 0 0 :::18433 :::* LISTEN 31643/falcon-gatewa
tcp6 0 0 :::6081 :::* LISTEN 31578/falcon-judge
tcp6 0 0 :::1988 :::* LISTEN 31635/falcon-agent

5. 客户端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
## 创建目录,导入组件代码

[root@open-falcon-agent profile.d]# export HOME=/home/work
[root@open-falcon-agent profile.d]# export WORKSPACE=$HOME/open-falcon
[root@open-falcon-agent profile.d]# mkdir -p $WORKSPACE
[root@open-falcon-agent profile.d]# cd $WORKSPACE
[root@open-falcon-agent open-falcon]# ll
total 0

[root@open-falcon-agent open-falcon]# rz
rz waiting to receive.**[root@open-falcon-agent open-falcon]# ll
total 1516
-r--r--r-- 1 root root 1550458 Jul 31 21:22 dashboard-master.zip
[root@open-falcon-agent open-falcon]# unzip dashboard-master.zip


[root@open-falcon-agent open-falcon]# ll
total 1516
drwxr-xr-x 5 root root 265 Jun 22 2020 dashboard-master
-r--r--r-- 1 root root 1550458 Jul 31 21:22 dashboard-master.zip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## 安装依赖包

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

[root@open-falcon-agent dashboard-master]# cd $WORKSPACE/dashboard-master
[root@open-falcon-agent dashboard-master]# ll
total 56
-rw-r--r-- 1 root root 97 Jun 22 2020 babel.cfg
-rwxr-xr-x 1 root root 2653 Jun 22 2020 control
-rw-r--r-- 1 root root 510 Jun 22 2020 Dockerfile
-rw-r--r-- 1 root root 319 Jun 22 2020 entrypoint.sh
-rw-r--r-- 1 root root 170 Jun 22 2020 gunicorn.conf
-rw-r--r-- 1 root root 1235 Jun 22 2020 i18n.md
-rw-r--r-- 1 root root 11358 Jun 22 2020 LICENSE
-rw-r--r-- 1 root root 462 Jun 22 2020 NOTICE
-rw-r--r-- 1 root root 139 Jun 22 2020 pip_requirements.txt
-rw-r--r-- 1 root root 5296 Jun 22 2020 README.md
drwxr-xr-x 10 root root 194 Jun 22 2020 rrd
drwxr-xr-x 2 root root 101 Jun 22 2020 screenshots
drwxr-xr-x 2 root root 65 Jun 22 2020 scripts
-rwxr-xr-x 1 root root 979 Jun 22 2020 wsgi.py


[root@open-falcon-agent dashboard-master]# virtualenv ./env
New python executable in /home/work/open-falcon/dashboard-master/env/bin/python2
Also creating executable in /home/work/open-falcon/dashboard-master/env/bin/python
Installing setuptools, pip, wheel...done.

[root@open-falcon-agent dashboard-master]# source env/bin/activate
(env) [root@open-falcon-agent dashboard-master]# pip install -r pip_requirements.txt -i

Usage:
pip install [options] <requirement specifier> [package-index-options] ...
pip install [options] -r <requirements file> [package-index-options] ...
pip install [options] [-e] <vcs project url> ...
pip install [options] [-e] <local project path> ...
pip install [options] <archive url/path> ...

-i option requires an argument




#如果安装了高版本pip,请先卸载pip uninstall pip 再按两次y
#指定源安装包(备注:这步如果安装不成功,请检查pip版本是否为pip-9.0.1)
pip install -r pip_requirements.txt -i
这里virtualenv ./env作用是创建一个新的python环境,详见:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001432712108300322c61f256c74803b43bfd65c6f8d0d0000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
## 切换环境后,pip安装

(env) [root@open-falcon-agent dashboard-master]# ./env/bin/pip install -r pip_requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting Flask==1.0 (from -r pip_requirements.txt (line 1))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/55/b1/4365193655df97227ace49311365cc296e74b60c7f5c63d23cd30175e2f6/Flask-1.0-py2.py3-none-any.whl (97kB)
100% |████████████████████████████████| 102kB 1.6MB/s
Collecting Flask-Babel==0.9 (from -r pip_requirements.txt (line 2))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/24/6b/dd9031c446e05600b740086274a9939799f26401b8b96e124ccf71e6a9b2/Flask-Babel-0.9.tar.gz
Collecting Jinja2>=2.10.1 (from -r pip_requirements.txt (line 3))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/7e/c2/1eece8c95ddbc9b1aeb64f5783a9e07a286de42191b7204d67b7496ddf35/Jinja2-2.11.3-py2.py3-none-any.whl (125kB)
100% |████████████████████████████████| 133kB 4.3MB/s
Collecting Werkzeug==0.15.4 (from -r pip_requirements.txt (line 4))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/9f/57/92a497e38161ce40606c27a86759c6b92dd34fcdb33f64171ec559257c02/Werkzeug-0.15.4-py2.py3-none-any.whl (327kB)
100% |████████████████████████████████| 327kB 3.1MB/s
Collecting gunicorn==19.9.0 (from -r pip_requirements.txt (line 5))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/8c/da/b8dd8deb741bff556db53902d4706774c8e1e67265f69528c14c003644e6/gunicorn-19.9.0-py2.py3-none-any.whl (112kB)
100% |████████████████████████████████| 122kB 4.6MB/s
Collecting python-dateutil==2.2 (from -r pip_requirements.txt (line 6))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/75/c5/85d027471fa665f8c8b8eb0b925f9d84b4eee745a257b16de4957de99e81/python-dateutil-2.2.tar.gz (259kB)
100% |████████████████████████████████| 266kB 5.5MB/s
Collecting requests==2.3.0 (from -r pip_requirements.txt (line 7))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f7/51/7aa1e337862118bee783c0249debd64cb07b8fbdfef154b1e185754b02d5/requests-2.3.0-py2.py3-none-any.whl (452kB)
100% |████████████████████████████████| 460kB 2.8MB/s
Collecting mysql-python (from -r pip_requirements.txt (line 8))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 9.3MB/s
Collecting python-ldap (from -r pip_requirements.txt (line 9))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/9d/e2/deb47064d443344b708ffb5899ea269b201d7c22dcc653ebadcbb44c57d5/python-ldap-3.3.1.tar.gz (379kB)
100% |████████████████████████████████| 389kB 4.4MB/s
Collecting itsdangerous>=0.24 (from Flask==1.0->-r pip_requirements.txt (line 1))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting click>=5.1 (from Flask==1.0->-r pip_requirements.txt (line 1))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82kB)
100% |████████████████████████████████| 92kB 9.6MB/s
Collecting Babel>=1.0 (from Flask-Babel==0.9->-r pip_requirements.txt (line 2))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/aa/96/4ba93c5f40459dc850d25f9ba93f869a623e77aaecc7a9344e19c01942cf/Babel-2.9.1-py2.py3-none-any.whl (8.8MB)
100% |████████████████████████████████| 8.8MB 138kB/s
Collecting speaklater>=1.2 (from Flask-Babel==0.9->-r pip_requirements.txt (line 2))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/11/92/5ae1effe0ccb8561c034a0111d53c8788660ddb7ed4992f0da1bb5c525e5/speaklater-1.3.tar.gz
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10.1->-r pip_requirements.txt (line 3))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
Collecting six (from python-dateutil==2.2->-r pip_requirements.txt (line 6))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Collecting pyasn1>=0.3.7 (from python-ldap->-r pip_requirements.txt (line 9))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d1/75/4686d2872bf2fc0b37917cbc8bbf0dd3a5cdb0990799be1b9cbf1e1eb733/pyasn1-0.5.1-py2.py3-none-any.whl (84kB)
100% |████████████████████████████████| 92kB 9.6MB/s
Collecting pyasn1_modules>=0.1.5 (from python-ldap->-r pip_requirements.txt (line 9))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/cd/8e/bea464350e1b8c6ed0da3a312659cb648804a08af6cacc6435867f74f8bd/pyasn1_modules-0.3.0-py2.py3-none-any.whl (181kB)
100% |████████████████████████████████| 184kB 4.0MB/s
Collecting pytz>=2015.7 (from Babel>=1.0->Flask-Babel==0.9->-r pip_requirements.txt (line 2))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/9c/3d/a121f284241f08268b21359bd425f7d4825cffc5ac5cd0e1b3d82ffd2b10/pytz-2024.1-py2.py3-none-any.whl (505kB)
100% |████████████████████████████████| 512kB 2.5MB/s
Building wheels for collected packages: Flask-Babel, python-dateutil, mysql-python, python-ldap, speaklater
Running setup.py bdist_wheel for Flask-Babel ... done
Stored in directory: /home/work/.cache/pip/wheels/ef/39/53/91220f10958c5110d839b0a9fa7ffaa0adb686067089eda64a
Running setup.py bdist_wheel for python-dateutil ... done
Stored in directory: /home/work/.cache/pip/wheels/03/2c/f1/9d772ba9eb2d4e0b583817de401202b1158140b8bd115e3f97
Running setup.py bdist_wheel for mysql-python ... done
Stored in directory: /home/work/.cache/pip/wheels/34/db/d9/39a931d72d59ffb68de9f85fe9ac2f02f47eef3fe142589db4
Running setup.py bdist_wheel for python-ldap ... done
Stored in directory: /home/work/.cache/pip/wheels/8c/9c/45/c563c2acb81523eae28c9e9a7cf4721b486829199c2278230b
Running setup.py bdist_wheel for speaklater ... done
Stored in directory: /home/work/.cache/pip/wheels/74/c5/f5/62413af6c8e6dbc120b9d9f8ea93bd179f07d3c993a5e4df22
Successfully built Flask-Babel python-dateutil mysql-python python-ldap speaklater
Installing collected packages: MarkupSafe, Jinja2, itsdangerous, Werkzeug, click, Flask, pytz, Babel, speaklater, Flask-Babel, gunicorn, six, python-dateutil, requests, mysql-python, pyasn1, pyasn1-modules, python-ldap
Successfully installed Babel-2.9.1 Flask-1.0 Flask-Babel-0.9 Jinja2-2.11.3 MarkupSafe-1.1.1 Werkzeug-0.15.4 click-7.1.2 gunicorn-19.9.0 itsdangerous-1.1.0 mysql-python-1.2.5 pyasn1-0.5.1 pyasn1-modules-0.3.0 python-dateutil-2.2 python-ldap-3.3.1 pytz-2024.1 requests-2.3.0 six-1.16.0 speaklater-1.3
You are using pip version 9.0.1, however version 24.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

(env) [root@open-falcon-agent dashboard-master]# wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
--2024-08-04 01:42:54-- https://bootstrap.pypa.io/ez_setup.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 146.75.112.175, 2a04:4e42:8c::175
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|146.75.112.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12537 (12K) [text/x-python]
Saving to: ‘ez_setup.py’

100%[=============================================================================>] 12,537 --.-K/s in 0.03s

2024-08-04 01:42:57 (422 KB/s) - ‘ez_setup.py’ saved [12537/12537]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
## 先安装ez_setup.py,再安装pip

(env) [root@open-falcon-agent dashboard-master]# wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
--2024-08-04 01:42:54-- https://bootstrap.pypa.io/ez_setup.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 146.75.112.175, 2a04:4e42:8c::175
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|146.75.112.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12537 (12K) [text/x-python]
Saving to: ‘ez_setup.py’

100%[=============================================================================>] 12,537 --.-K/s in 0.03s

2024-08-04 01:42:57 (422 KB/s) - ‘ez_setup.py’ saved [12537/12537]

(env) [root@open-falcon-agent dashboard-master]# python ez_setup.py --insecure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
## 下载pip

(env) [root@open-falcon-agent dashboard-master]# wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
#md5=35f01da33009719497f01a4ba69d63c9
--2024-08-04 01:43:34-- https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
Resolving pypi.python.org (pypi.python.org)... 151.101.76.223, 2a04:4e42:8c::223
Connecting to pypi.python.org (pypi.python.org)|151.101.76.223|:443... connected.
HTTP request sent, awaiting response... 301 Redirect to Primary Domain
Location: https://pypi.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz [following]
--2024-08-04 01:43:34-- https://pypi.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
Resolving pypi.org (pypi.org)... 151.101.0.223, 151.101.64.223, 151.101.192.223, ...
Connecting to pypi.org (pypi.org)|151.101.0.223|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://files.pythonhosted.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz [following]
--2024-08-04 01:43:35-- https://files.pythonhosted.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
Resolving files.pythonhosted.org (files.pythonhosted.org)... 146.75.112.223, 2a04:4e42:8c::223
Connecting to files.pythonhosted.org (files.pythonhosted.org)|146.75.112.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1197370 (1.1M) [binary/octet-stream]
Saving to: ‘pip-9.0.1.tar.gz’

100%[=============================================================================>] 1,197,370 836KB/s in 1.4s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
## 解压并安装

(env) [root@open-falcon-agent dashboard-master]# tar xf pip-9.0.1.tar.gz
(env) [root@open-falcon-agent dashboard-master]# cd pip-9.0.1
(env) [root@open-falcon-agent pip-9.0.1]# python setup.py install
(env) [root@open-falcon-agent pip-9.0.1]# cd ..
(env) [root@open-falcon-agent dashboard-master]# which pip
/home/work/open-falcon/dashboard-master/env/bin/pip


#配置pip环境变量
(env) [root@open-falcon-agent dashboard-master]# vim /etc/profile

#pip path
export PATH="/home/work/open-falcon/dashboard-master/env/bin/pip/bin:$PATH"

#使环境变量生效source /etc/profile
(env) [root@open-falcon-agent dashboard-master]# source /etc/profile

#测试是否可用
(env) [root@open-falcon-agent dashboard-master]# pip
Usage:
pip <command> [options]

Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#查看需要安装的软件,并安装

(env) [root@open-falcon-agent dashboard-master]# cat pip_requirements.txt
Flask==1.0
Flask-Babel==0.9
Jinja2>=2.10.1
Werkzeug==0.15.4
gunicorn==19.9.0
python-dateutil==2.2
requests==2.3.0
mysql-python
python-ldap
(env) [root@open-falcon-agent dashboard-master]# cd /home/work/open-falcon/dashboard-master
(env) [root@open-falcon-agent dashboard-master]# pip install -r pip_requirements.txt
Requirement already satisfied: Flask==1.0 in ./env/lib/python2.7/site-packages (from -r pip_requirements.txt (line 1))
Requirement already satisfied: Flask-Babel==0.9 in ./env/lib/python2.7/site-packages (from -r pip_requirements.txt (line 2))
Requirement already satisfied: Jinja2>=2.10.1 in ./env/lib/python2.7/site-packages (from -r pip_requirements.txt (line 3))
Requirement already satisfied: Werkzeug==0.15.4 in ./env/lib/python2.7/site-packages (from -r pip_requirements.txt (line 4))
Requirement already satisfied: gunicorn==19.9.0 in ./env/lib/python2.7/site-packages (from -r pip_requirements.txt (line 5))
Requirement already satisfied: python-dateutil==2.2 in ./env/lib/python2.7/site-packages (from -r pip_requirements.txt (line 6))
Requirement already satisfied: requests==2.3.0 in ./env/lib/python2.7/site-packages (from -r pip_requirements.txt (line 7))
Requirement already satisfied: mysql-python in ./env/lib/python2.7/site-packages (from -r pip_requirements.txt (line 8))
Requirement already satisfied: python-ldap in ./env/lib/python2.7/site-packages (from -r pip_requirements.txt (line 9))
Requirement already satisfied: itsdangerous>=0.24 in ./env/lib/python2.7/site-packages (from Flask==1.0->-r pip_requirements.txt (line 1))
Requirement already satisfied: click>=5.1 in ./env/lib/python2.7/site-packages (from Flask==1.0->-r pip_requirements.txt (line 1))
Requirement already satisfied: speaklater>=1.2 in ./env/lib/python2.7/site-packages (from Flask-Babel==0.9->-r pip_requirements.txt (line 2))
Requirement already satisfied: Babel>=1.0 in ./env/lib/python2.7/site-packages (from Flask-Babel==0.9->-r pip_requirements.txt (line 2))
Requirement already satisfied: MarkupSafe>=0.23 in ./env/lib/python2.7/site-packages (from Jinja2>=2.10.1->-r pip_requirements.txt (line 3))
Requirement already satisfied: six in ./env/lib/python2.7/site-packages (from python-dateutil==2.2->-r pip_requirements.txt (line 6))
Requirement already satisfied: pyasn1-modules>=0.1.5 in ./env/lib/python2.7/site-packages (from python-ldap->-r pip_requirements.txt (line 9))
Requirement already satisfied: pyasn1>=0.3.7 in ./env/lib/python2.7/site-packages (from python-ldap->-r pip_requirements.txt (line 9))
Requirement already satisfied: pytz>=2015.7 in ./env/lib/python2.7/site-packages (from Babel>=1.0->Flask-Babel==0.9->-r pip_requirements.txt (line 2))
You are using pip version 9.0.1, however version 24.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
## 先备份,后修改配置文件

(env) [root@open-falcon-agent dashboard-master]# ll
total 1932
-rw-r--r-- 1 root root 97 Jun 22 2020 babel.cfg
-rwxr-xr-x 1 root root 2653 Jun 22 2020 control
-rw-r--r-- 1 root root 510 Jun 22 2020 Dockerfile
-rw-r--r-- 1 root root 319 Jun 22 2020 entrypoint.sh
drwxr-xr-x 5 root root 82 Aug 4 01:38 env
-rw-r--r-- 1 root root 12537 Jul 29 06:47 ez_setup.py
-rw-r--r-- 1 root root 170 Jun 22 2020 gunicorn.conf
-rw-r--r-- 1 root root 1235 Jun 22 2020 i18n.md
-rw-r--r-- 1 root root 11358 Jun 22 2020 LICENSE
-rw-r--r-- 1 root root 462 Jun 22 2020 NOTICE
drwxr-xr-x 7 501 games 217 Aug 4 01:44 pip-9.0.1
-rw-r--r-- 1 root root 1197370 Apr 10 2023 pip-9.0.1.tar.gz
-rw-r--r-- 1 root root 139 Jun 22 2020 pip_requirements.txt
-rw-r--r-- 1 root root 5296 Jun 22 2020 README.md
drwxr-xr-x 10 root root 194 Jun 22 2020 rrd
drwxr-xr-x 2 root root 101 Jun 22 2020 screenshots
drwxr-xr-x 2 root root 65 Jun 22 2020 scripts
-rw-r--r-- 1 root root 702770 Aug 4 01:43 setuptools-33.1.1.zip
-rwxr-xr-x 1 root root 979 Jun 22 2020 wsgi.py
(env) [root@open-falcon-agent dashboard-master]# cd rrd/
(env) [root@open-falcon-agent rrd]# ll
total 16
-rwxr-xr-x 1 root root 2764 Jun 22 2020 config.py
-rw-r--r-- 1 root root 737 Jun 22 2020 consts.py
drwxr-xr-x 2 root root 25 Jun 22 2020 corelib
-rw-r--r-- 1 root root 1539 Jun 22 2020 __init__.py
drwxr-xr-x 3 root root 156 Jun 22 2020 model
drwxr-xr-x 2 root root 49 Jun 22 2020 service
drwxr-xr-x 13 root root 231 Jun 22 2020 static
-rw-r--r-- 1 root root 3911 Jun 22 2020 store.py
drwxr-xr-x 8 root root 157 Jun 22 2020 templates
drwxr-xr-x 4 root root 26 Jun 22 2020 translations
drwxr-xr-x 2 root root 132 Jun 22 2020 utils
drwxr-xr-x 7 root root 124 Jun 22 2020 view

(env) [root@open-falcon-agent rrd]# cp config.py config.py.bak
(env) [root@open-falcon-agent rrd]# vim config.py
(env) [root@open-falcon-agent rrd]# cat config.py
#-*-coding:utf-8 -*-
# Copyright 2017 Xiaomi, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# app config
import os
LOG_LEVEL = os.environ.get("LOG_LEVEL",'DEBUG')
SECRET_KEY = os.environ.get("SECRET_KEY","secret-key")
PERMANENT_SESSION_LIFETIME = os.environ.get("PERMANENT_SESSION_LIFETIME",3600 * 24 * 30)
SITE_COOKIE = os.environ.get("SITE_COOKIE","open-falcon-ck")

# Falcon+ API
API_ADDR = os.environ.get("API_ADDR","http://172.16.1.200:18080/api/v1")
API_USER = os.environ.get("API_USER","admin")
API_PASS = os.environ.get("API_PASS","password")

# portal database
# TODO: read from api instead of db
PORTAL_DB_HOST = os.environ.get("PORTAL_DB_HOST","172.16.1.200")
PORTAL_DB_PORT = int(os.environ.get("PORTAL_DB_PORT",3306))
PORTAL_DB_USER = os.environ.get("PORTAL_DB_USER","root")
PORTAL_DB_PASS = os.environ.get("PORTAL_DB_PASS","password")
PORTAL_DB_NAME = os.environ.get("PORTAL_DB_NAME","falcon_portal")

# alarm database
# TODO: read from api instead of db
ALARM_DB_HOST = os.environ.get("ALARM_DB_HOST","172.16.1.200")
ALARM_DB_PORT = int(os.environ.get("ALARM_DB_PORT",3306))
ALARM_DB_USER = os.environ.get("ALARM_DB_USER","root")
ALARM_DB_PASS = os.environ.get("ALARM_DB_PASS","password")
ALARM_DB_NAME = os.environ.get("ALARM_DB_NAME","alarms")

# ldap config
LDAP_ENABLED = os.environ.get("LDAP_ENABLED",False)
LDAP_SERVER = os.environ.get("LDAP_SERVER","ldap.forumsys.com:389")
LDAP_BASE_DN = os.environ.get("LDAP_BASE_DN","dc=example,dc=com")
LDAP_BINDDN = os.environ.get("LDAP_BINDDN","cn=manager,dc=example,dc=org")
LDAP_BIND_PASS = os.environ.get("LDAP_BIND_PASS","password")
LDAP_SEARCH_FMT = os.environ.get("LDAP_SEARCH_FMT","uid=%s")
LDAP_ATTRS = ["cn","mail","telephoneNumber"]
LDAP_TLS_START_TLS = False
LDAP_TLS_CACERTDIR = ""
LDAP_TLS_CACERTFILE = "/etc/openldap/certs/ca.crt"
LDAP_TLS_CERTFILE = ""
LDAP_TLS_KEYFILE = ""
LDAP_TLS_REQUIRE_CERT = True
LDAP_TLS_CIPHER_SUITE = ""

# i18n
BABEL_DEFAULT_LOCALE = 'zh_CN'
BABEL_DEFAULT_TIMEZONE = 'Asia/Shanghai'
# available translations
LANGUAGES = {
'en': 'English',
'zh_CN': 'Chinese-Simplified',
}

# portal site config
MAINTAINERS = ['root']
CONTACT = 'root@open-falcon.com'

DEBUG = True

try:
from rrd.local_config import *
except:
print "[warning] no local config file"

1
2
3
4
5
6
## 启动服务

(env) [root@open-falcon-agent rrd]# cd ..
(env) [root@open-falcon-agent dashboard-master]# ./control start
falcon-dashboard started..., pid=25575

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
## 查看日志并退出环境

(env) [root@open-falcon-agent dashboard-master]# ./control tail
[2024-08-04 02:03:48 +0000] [25575] [INFO] Starting gunicorn 19.9.0
[2024-08-04 02:03:48 +0000] [25575] [INFO] Listening at: http://0.0.0.0:8081 (25575)
[2024-08-04 02:03:48 +0000] [25575] [INFO] Using worker: sync
[2024-08-04 02:03:48 +0000] [25580] [INFO] Booting worker with pid: 25580
[2024-08-04 02:03:48 +0000] [25585] [INFO] Booting worker with pid: 25585
[2024-08-04 02:03:48 +0000] [25590] [INFO] Booting worker with pid: 25590
[2024-08-04 02:03:48 +0000] [25591] [INFO] Booting worker with pid: 25591
^C
(env) [root@open-falcon-agent dashboard-master]# deactivate
[root@open-falcon-agent dashboard-master]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 25575/python2
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 8951/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 9216/master
tcp6 0 0 :::22 :::* LISTEN 8951/sshd
tcp6 0 0 ::1:25 :::* LISTEN 9216/master

访问网站 10.0.0.201:8081

img

img

img