運(yùn)維監(jiān)控系統(tǒng)之Open-Falcon
一龄句、Open-Falcon介紹
open-falcon是一款用golang和python寫的監(jiān)控系統(tǒng),由小米啟動(dòng)這個(gè)項(xiàng)目散罕。
1分歇、監(jiān)控系統(tǒng),可以從運(yùn)營級(jí)別(基本配置即可)欧漱,以及應(yīng)用級(jí)別(二次開發(fā)职抡,通過端口進(jìn)行日志上報(bào)),對服務(wù)器误甚、操作系統(tǒng)缚甩、中間件、應(yīng)用進(jìn)行全面的監(jiān)控窑邦,及報(bào)警擅威,對我們的系統(tǒng)正常運(yùn)行的作用非常重要。
2冈钦、基礎(chǔ)監(jiān)控
CPU郊丛、Load、內(nèi)存、磁盤厉熟、IO导盅、網(wǎng)絡(luò)相關(guān)、內(nèi)核參數(shù)揍瑟、ss 統(tǒng)計(jì)輸出白翻、端口采集、核心服務(wù)的進(jìn)程存活信息采集绢片、關(guān)鍵業(yè)務(wù)進(jìn)程資源消耗滤馍、NTP offset采集、DNS解析采集杉畜,這些指標(biāo)纪蜒,都是open-falcon的agent組件直接支持的。
Linux運(yùn)維基礎(chǔ)采集項(xiàng):http://book.open-falcon.org/zh/faq/linux-metrics.html
對于這些基礎(chǔ)監(jiān)控選項(xiàng)全部理解透徹的時(shí)刻纯续,也就是對Linux運(yùn)行原理及命令進(jìn)階的時(shí)刻。
3灭袁、第三方監(jiān)控
術(shù)業(yè)有專攻猬错,運(yùn)行在OS上的應(yīng)用甚多,Open-Falcon的開發(fā)團(tuán)隊(duì)不可能把所有的第三方應(yīng)用的監(jiān)控全部做完茸歧,這個(gè)就需要開源社區(qū)提供更多的插件倦炒,當(dāng)前對于很多常用的第三方應(yīng)用都有相關(guān)插件了。
4软瞎、JVM監(jiān)控
對于Java作為主要開發(fā)語言的大多數(shù)公司逢唤,對于JVM的監(jiān)控不可或缺。
每個(gè)JVM應(yīng)用的參數(shù)涤浇,比如GC鳖藕、類加載、JVM內(nèi)存只锭、進(jìn)程著恩、線程,都可以上報(bào)給Falcon蜻展,而這些參數(shù)的獲得喉誊,都可以通過MxBeans實(shí)現(xiàn)。
使用 Java 平臺(tái)管理 bean:http://www.ibm.com/developerworks/cn/java/j-mxbeans/
5纵顾、業(yè)務(wù)應(yīng)用監(jiān)控
對于業(yè)務(wù)需要監(jiān)控的接口伍茄,比如響應(yīng)時(shí)間等∈┯猓可以根據(jù)業(yè)務(wù)的需要幻林,上報(bào)相關(guān)數(shù)據(jù)到Falcon贞盯,并通過Falcon查看結(jié)果音念。
官方網(wǎng)址:http://open-falcon.org/
中文文檔:https://book.open-falcon.org/zh_0_2/
中英文檔:https://book.open-falcon.org
軟件下載:https://github.com/open-falcon/falcon-plus/releases
二沪饺、Open-Falcon編寫的整個(gè)腦洞歷程
三、環(huán)境準(zhǔn)備
1.系統(tǒng)環(huán)境
[root@open-falcon-server ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
2.系統(tǒng)優(yōu)化
#安裝下載軟件
yum install wget -y
#更換aliyun源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#下載epel源
yum install epel-release.noarch -y
rpm -Uvh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
yum clean all
yum makecache
#下載常用軟件
yum install git telnet net-tools tree nmap sysstat lrzsz dos2unix tcpdump ntpdate -y
#配置時(shí)間同步
ntpdate cn.pool.ntp.org
#更改主機(jī)名
hostnamectl set-hostname open-falcon-server
hostname open-falcon-server
#開啟緩存
sed -i 's#keepcache=0#keepcache=1#g' /etc/yum.conf
grep keepcache /etc/yum.conf
#關(guān)閉selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
#關(guān)閉防火墻
systemctl stop firewalld.service
systemctl disable firewalld.service
3.軟件環(huán)境準(zhǔn)備
(1)redis準(zhǔn)備
#安裝 redis
yum install redis -y
#redis常用命令
redis-server redis 服務(wù)端
redis-cli redis 命令行客戶端
redis-benchmark redis 性能測試工具
redis-check-aof AOF文件修復(fù)工具
redis-check-dump RDB文件修復(fù)工具
redis-sentinel Sentinel 服務(wù)端
#啟動(dòng)redis
[root@open-falcon-server ~]# redis-server &
[1] 1662
[root@open-falcon-server ~]# 1662:C 27 Jul 14:44:56.463 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1662:M 27 Jul 14:44:56.464 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.10 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 1662
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
1662:M 27 Jul 14:44:56.464 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1662:M 27 Jul 14:44:56.464 # Server started, Redis version 3.2.10
1662:M 27 Jul 14:44:56.464 # 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.
1662:M 27 Jul 14:44:56.464 # 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.
1662:M 27 Jul 14:44:56.464 * The server is now ready to accept connections on port 6379
(2)mysql準(zhǔn)備
#安裝mysql
yum install mariadb mariadb-server -y
#啟動(dòng)mysql
systemctl start mariadb
systemctl enable mariadb
#登錄數(shù)據(jù)庫測試
[root@open-falcon-server ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> exit
Bye
#檢查服務(wù)
[root@open-falcon-server ~]# netstat -lntp|egrep "3306|6379"
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1978/mysqld
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 1662/redis-server *
tcp6 0 0 :::6379 :::* LISTEN 1662/redis-server *
#初始化MySQL表結(jié)構(gòu)
cd /tmp/ && git clone https://github.com/open-falcon/falcon-plus.git
cd /tmp/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
rm -rf /tmp/falcon-plus/
#設(shè)置數(shù)據(jù)庫密碼
mysqladmin -uroot password "123456"
#檢查導(dǎo)入的數(shù)據(jù)庫
[root@open-falcon-server ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| alarms |
| dashboard |
| falcon_portal |
| graph |
| mysql |
| performance_schema |
| test |
| uic |
+--------------------+
9 rows in set (0.00 sec)
MariaDB [(none)]> exit
Bye
(3)Go安裝
#安裝go語言開發(fā)包
yum install golang -y
#檢查版本
[root@open-falcon-server ~]# go version
go version go1.9.4 linux/amd64
#查看Go安裝路徑
[root@open-falcon-server ~]# find / -name go
/etc/alternatives/go
/var/lib/alternatives/go
/usr/bin/go
/usr/lib/golang/src/cmd/go #需要這個(gè)路徑
/usr/lib/golang/src/go
/usr/lib/golang/bin/go
/usr/lib/golang/pkg/linux_amd64/cmd/go
/usr/lib/golang/pkg/linux_amd64/go
四闷愤、Open-Falcon后端
#創(chuàng)建工作目錄
export FALCON_HOME=/home/work
export WORKSPACE=$FALCON_HOME/open-falcon
mkdir -p $WORKSPACE
#下載解壓二進(jìn)制包
wget https://github.com/open-falcon/falcon-plus/releases/download/v0.2.1/open-falcon-v0.2.1.tar.gz
tar xf open-falcon-v0.2.1.tar.gz -C $WORKSPACE
#查看解壓結(jié)果
[root@open-falcon-server ~]# cd $WORKSPACE
[root@open-falcon-server open-falcon]# ll
總用量 3896
drwxrwxr-x 7 501 501 67 8月 15 2017 agent
drwxrwxr-x 5 501 501 40 8月 15 2017 aggregator
drwxrwxr-x 5 501 501 40 8月 15 2017 alarm
drwxrwxr-x 6 501 501 51 8月 15 2017 api
drwxrwxr-x 5 501 501 40 8月 15 2017 gateway
drwxrwxr-x 6 501 501 51 8月 15 2017 graph
drwxrwxr-x 5 501 501 40 8月 15 2017 hbs
drwxrwxr-x 5 501 501 40 8月 15 2017 judge
drwxrwxr-x 5 501 501 40 8月 15 2017 nodata
-rwxrwxr-x 1 501 501 3987469 8月 15 2017 open-falcon
lrwxrwxrwx 1 501 501 16 8月 15 2017 plugins -> ./agent/plugins/
lrwxrwxrwx 1 501 501 15 8月 15 2017 public -> ./agent/public/
drwxrwxr-x 5 501 501 40 8月 15 2017 transfer
模塊 | 文件所在路徑 |
---|---|
aggregator | /home/work/aggregator/config/cfg.json |
graph | /home/work/graph/config/cfg.json |
hbs | /home/work/hbs/config/cfg.json |
nodata | /home/work/nodata/config/cfg.json |
api | /home/work/api/config/cfg.json |
alarm | /home/work/alarm/config/cfg.json |
#修改配置文件
sed -i 's#root:@tcp(127.0.0.1:3306)#root:123456@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:123456@tcp(127.0.0.1:3306)'
#啟動(dòng)后端模塊
[root@open-falcon-server open-falcon]# cd /home/work/open-falcon
[root@open-falcon-server open-falcon]# ./open-falcon start
[falcon-graph] 5583
[falcon-hbs] 5592
[falcon-judge] 5600
[falcon-transfer] 5606
[falcon-nodata] 5613
[falcon-aggregator] 5620
[falcon-agent] 5628
[falcon-gateway] 5635
[falcon-api] 5641
[falcon-alarm] 5653
#檢查服務(wù)啟動(dòng)狀態(tài)
[root@open-falcon-server open-falcon]# ./open-falcon check
falcon-graph UP 5583
falcon-hbs UP 5592
falcon-judge UP 5600
falcon-transfer UP 5606
falcon-nodata UP 5613
falcon-aggregator UP 5620
falcon-agent UP 5628
falcon-gateway UP 5635
falcon-api UP 5641
falcon-alarm UP 5653
#更多命令行工具用法
# ./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
至此后端部署完成整葡。
#其他用法
重載配置(備注:修改vi cfg.json配置文件后,可以用下面命令重載配置)
curl 127.0.0.1:1988/config/reload
五讥脐、Open-Falcon前端
#創(chuàng)建工作目錄
export HOME=/home/work
export WORKSPACE=$HOME/open-falcon
mkdir -p $WORKSPACE
cd $WORKSPACE
#克隆前端組件代碼
git clone https://github.com/open-falcon/dashboard.git
#安裝依賴包
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
#下載ez_setup.py
cd ~
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
python ez_setup.py --insecure
#下載安裝pip
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
tar xf pip-9.0.1.tar.gz
cd pip-9.0.1
python setup.py install
#解決pip安裝慢
mkdir -p ~/.pip
echo '[global]' >>~/.pip/pip.conf
echo 'index-url = https://pypi.tuna.tsinghua.edu.cn/simple' >>~/.pip/pip.conf
#測試是否可用
[root@open-falcon-server ~]# cd /home/work/open-falcon/dashboard
[root@open-falcon-server dashboard]# pip -V
pip 9.0.1 from /usr/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
[root@open-falcon-server dashboard]# 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.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
--trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.
#查看需要安裝模塊
[root@open-falcon-server dashboard]# cat pip_requirements.txt
Flask==0.10.1
Flask-Babel==0.9
Jinja2==2.7.2
Werkzeug==0.9.4
gunicorn==19.5.0
python-dateutil==2.2
requests==2.3.0
mysql-python
python-ldap
#安裝模塊
pip install -r pip_requirements.txt
#修改配置文件
配置說明:
dashboard的配置文件為: 'rrd/config.py'遭居,根據(jù)實(shí)際情況修改:
# API_ADDR 表示后端api組件的地址
API_ADDR = "http://127.0.0.1:8080/api/v1"
# 根據(jù)實(shí)際情況,修改PORTAL_DB_*, 默認(rèn)用戶名為root旬渠,默認(rèn)密碼為""
# 根據(jù)實(shí)際情況俱萍,修改ALARM_DB_*, 默認(rèn)用戶名為root,默認(rèn)密碼為""
配置修改:
cp rrd/config.py{,.bak}
vim rrd/config.py
修改內(nèi)容:
# Falcon+ API
API_ADDR = os.environ.get("API_ADDR","http://10.0.0.100:8080/api/v1")
# portal database
# TODO: read from api instead of db
PORTAL_DB_HOST = os.environ.get("PORTAL_DB_HOST","10.0.0.100")
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","123456")
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","10.0.0.100")
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","123456")
ALARM_DB_NAME = os.environ.get("ALARM_DB_NAME","alarms")
#啟動(dòng)服務(wù)
[root@open-falcon-server dashboard]# virtualenv ./env
New python executable in /home/work/open-falcon/dashboard/env/bin/python
Installing setuptools, pip, wheel...done.
[root@open-falcon-server dashboard]# source env/bin/activate
(env) [root@open-falcon-server dashboard]# ./control start
falcon-dashboard started..., pid=20814
(env) [root@open-falcon-server dashboard]# ./control tail
[2018-07-27 16:37:02 +0000] [20814] [INFO] Starting gunicorn 19.5.0
[2018-07-27 16:37:02 +0000] [20814] [INFO] Listening at: http://0.0.0.0:8081 (20814)
[2018-07-27 16:37:02 +0000] [20814] [INFO] Using worker: sync
[2018-07-27 16:37:02 +0000] [20819] [INFO] Booting worker with pid: 20819
[2018-07-27 16:37:02 +0000] [20820] [INFO] Booting worker with pid: 20820
[2018-07-27 16:37:02 +0000] [20821] [INFO] Booting worker with pid: 20821
[2018-07-27 16:37:02 +0000] [20826] [INFO] Booting worker with pid: 20826
^C
(env) [root@open-falcon-server dashboard]# deactivate
六告丢、訪問網(wǎng)站
http://10.0.0.100:8081
#dashbord用戶管理
dashbord沒有默認(rèn)創(chuàng)建任何賬號(hào)包括管理賬號(hào)枪蘑,需要你通過頁面進(jìn)行注冊賬號(hào)。
想擁有管理全局的超級(jí)管理員賬號(hào)岖免,需要手動(dòng)注冊用戶名為root的賬號(hào)(第一個(gè)帳號(hào)名稱為root的用戶會(huì)被自動(dòng)設(shè)置為超級(jí)管理員)岳颇。
超級(jí)管理員可以給普通用戶分配權(quán)限管理。
小提示:注冊賬號(hào)能夠被任何打開dashboard頁面的人注冊颅湘,所以當(dāng)給相關(guān)的人注冊完賬號(hào)后话侧,需要去關(guān)閉注冊賬號(hào)功能。只需要去修改api組件的配置文件cfg.json闯参,將signup_disable配置項(xiàng)修改為true瞻鹏,重啟api即可。當(dāng)需要給人開賬號(hào)的時(shí)候鹿寨,再將配置選項(xiàng)改回去新博,用完再關(guān)掉即可。
七释移、Open-Falcon客戶端
#服務(wù)端操作
[root@open-falcon-server ~]# cd /home/work/open-falcon
[root@open-falcon-server open-falcon]# scp -r agent root@10.0.0.101:/home/
[root@open-falcon-server open-falcon]# scp -r open-falcon root@10.0.0.101:/home/
#客戶端操作
[root@open-falcon-client ~]# mkdir -p /home/work/open-falcon
[root@open-falcon-client ~]# mkdir -p /home/work/open-falcon
[root@open-falcon-client ~]# mv /home/open-falcon /home/agent /home/work/open-falcon
[root@open-falcon-client ~]# cd /home/work/open-falcon
[root@open-falcon-client open-falcon]# vim agent/config/cfg.json
修改內(nèi)容:
{
"debug": true, # 控制一些debug信息的輸出叭披,生產(chǎn)環(huán)境通常設(shè)置為false
"hostname": "", # agent采集了數(shù)據(jù)發(fā)給transfer,endpoint就設(shè)置為了hostname玩讳,默認(rèn)通過`hostname`獲取涩蜘,如果配置中配置了hostname熏纯,就用配置中的
"ip": "", # agent與hbs心跳的時(shí)候會(huì)把自己的ip地址發(fā)給hbs同诫,agent會(huì)自動(dòng)探測本機(jī)ip,如果不想讓agent自動(dòng)探測樟澜,可以手工修改該配置
"plugin": {
"enabled": false, # 默認(rèn)不開啟插件機(jī)制
"dir": "./plugin", # 把放置插件腳本的git repo clone到這個(gè)目錄
"git": "https://github.com/open-falcon/plugin.git", # 放置插件腳本的git repo地址
"logs": "./logs" # 插件執(zhí)行的log误窖,如果插件執(zhí)行有問題叮盘,可以去這個(gè)目錄看log
},
"heartbeat": {
"enabled": true, # 此處enabled要設(shè)置為true
"addr": "10.0.0.100:6030", # hbs的地址,端口是hbs的rpc端口
"interval": 60, # 心跳周期霹俺,單位是秒
"timeout": 1000 # 連接hbs的超時(shí)時(shí)間柔吼,單位是毫秒
},
"transfer": {
"enabled": true,
"addrs": [
"10.0.0.100:18433"
], # transfer的地址,端口是transfer的rpc端口, 可以支持寫多個(gè)transfer的地址丙唧,agent會(huì)保證HA
"interval": 60, # 采集周期愈魏,單位是秒,即agent一分鐘采集一次數(shù)據(jù)發(fā)給transfer
"timeout": 1000 # 連接transfer的超時(shí)時(shí)間想际,單位是毫秒
},
"http": {
"enabled": true, # 是否要監(jiān)聽http端口
"listen": ":1988",
"backdoor": false
},
"collector": {
"ifacePrefix": ["eth", "em"], # 默認(rèn)配置只會(huì)采集網(wǎng)卡名稱前綴是eth培漏、em的網(wǎng)卡流量,配置為空就會(huì)采集所有的胡本,lo的也會(huì)采集牌柄。可以從/proc/net/dev看到各個(gè)網(wǎng)卡的流量信息
"mountPoint": []
},
"default_tags": {
},
"ignore": { # 默認(rèn)采集了200多個(gè)metric侧甫,可以通過ignore設(shè)置為不采集
"cpu.busy": true,
"df.bytes.free": true,
"df.bytes.total": true,
"df.bytes.used": true,
"df.bytes.used.percent": true,
"df.inodes.total": true,
"df.inodes.free": true,
"df.inodes.used": true,
"df.inodes.used.percent": true,
"mem.memtotal": true,
"mem.memused": true,
"mem.memused.percent": true,
"mem.memfree": true,
"mem.swaptotal": true,
"mem.swapused": true,
"mem.swapfree": true
}
}
#啟動(dòng)服務(wù)
./open-falcon start agent 啟動(dòng)進(jìn)程
./open-falcon stop agent 停止進(jìn)程
./open-falcon monitor agent 查看日志
看var目錄下的log是否正常珊佣,或者瀏覽器訪問其1988端口。另外agent提供了一個(gè)--check參數(shù)闺骚,可以檢查agent是否可以正常跑在當(dāng)前機(jī)器上
cd /home/work/open-falcon/agent/bin/
./falcon-agent --check
進(jìn)入監(jiān)控界面查看:
八彩扔、參考文檔
## Open-Falcon
# 運(yùn)維監(jiān)控系統(tǒng)之Open-Falcon
https://www.cnblogs.com/nulige/p/7741580.html
# open-falcon安裝使用監(jiān)控樹莓派
https://yq.aliyun.com/articles/437196
# 小米運(yùn)維架構(gòu)服務(wù)監(jiān)控Open-Falcon
https://blog.csdn.net/qq_27384769/article/details/79234270
# 架構(gòu)師的成長之路-博客-導(dǎo)圖
https://github.com/csy512889371/learnDoc
# Open-Falcon編寫的整個(gè)腦洞歷程
http://mp.weixin.qq.com/s?__biz=MjM5OTcxMzE0MQ==&mid=400225178&idx=1&sn=c98609a9b66f84549e41cd421b4df74d