标签:agent 技术 conf rap 名称 collect oat xargs name
1 [root@falcon ~]# yum install -y redis
1 [root@falcon ~]# yum -y install mariadb mariadb-server
1 [root@falcon ~]# systemctl start redis 2 [root@falcon ~]# systemctl enable redis 3 [root@falcon ~]# systemctl start mariadb 4 [root@falcon ~]# systemctl enable mariadb
1 [root@falcon ~]# mysql_secure_installation #设置安全性,并设置数据库root密码
1 [root@falcon ~]# mkdir /gohome 2 [root@falcon ~]# yum install -y epel-release 3 [root@falcon ~]# yum install -y golang
1 [root@falcon ~]# wget https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz 2 [root@falcon ~]# tar -C /usr/local/ -zxvf go1.11.2.linux-amd64.tar.gz 3 [root@falcon ~]# echo ‘export GOROOT=/usr/local/go‘ >> /etc/profile.d/go.sh 4 [root@falcon ~]# echo ‘export GOBIN=$GOROOT/bin‘ >> /etc/profile.d/go.sh 5 [root@falcon ~]# echo ‘export GOPKG=$GOROOT/pkg/tool/linux_amd64‘ >> /etc/profile.d/go.sh 6 [root@falcon ~]# echo ‘export GOARCH=amd64‘ >> /etc/profile.d/go.sh 7 [root@falcon ~]# echo ‘export GOOS=linux‘ >> /etc/profile.d/go.sh 8 [root@falcon ~]# echo ‘export GOPATH=/gohome‘ >> /etc/profile.d/go.sh 9 [root@falcon ~]# echo ‘export PATH=$PATH:$GOBIN:$GOPKG:$GOPATH/bin‘ >> /etc/profile.d/go.sh 10 [root@falcon ~]# go version 11 go version go1.11.2 linux/amd64
1 [root@falcon ~]# mkdir -p $GOPATH/src/github.com/open-falcon
1 [root@falcon ~]# cd $GOPATH/src/github.com/open-falcon 2 [root@falcon open-falcon]# git clone https://github.com/open-falcon/falcon-plus.git
1 [root@falcon tmp]# cd $GOPATH/src/github.com/open-falcon/falcon-plus/scripts/mysql/db_schema 2 [root@falcon db_schema]# mysql -h 127.0.0.1 -u root -p123456 < 1_uic-db-schema.sql 3 [root@falcon db_schema]# mysql -h 127.0.0.1 -u root -p123456 < 2_portal-db-schema.sql 4 [root@falcon db_schema]# mysql -h 127.0.0.1 -u root -p123456 < 3_dashboard-db-schema.sql 5 [root@falcon db_schema]# mysql -h 127.0.0.1 -u root -p123456 < 4_graph-db-schema.sql 6 [root@falcon db_schema]# mysql -h 127.0.0.1 -u root -p123456 < 5_alarms-db-schema.sql
1 [root@falcon db_schema]# cd $GOPATH/src/github.com/open-falcon/falcon-plus/ 2 [root@falcon falcon-plus]# go get github.com/open-falcon/rrdlite
1 [root@falcon falcon-plus]# make all 2 [root@falcon falcon-plus]# make pack
1 [root@falcon ~]# export FALCON_HOME=/data/falcon 2 [root@falcon ~]# export WORKSPACE=$FALCON_HOME/open-falcon 3 [root@falcon ~]# mkdir -p $WORKSPACE
1 [root@falcon ~]# cd $GOPATH/src/github.com/open-falcon/falcon-plus/ 2 [root@falcon falcon-plus]# tar -xzvf open-falcon-v0.2.1.tar.gz -C $WORKSPACE
1 [root@falcon ~]# cd $WORKSPACE 2 [root@falcon open-falcon]# grep -Ilr 3306 ./ | xargs -n1 -- sed -i ‘s/root:/root:123456/g‘ 3 [root@falcon open-falcon]# grep -Ir 3306 ./ #确认修改
1 [root@falcon ~]# cd $WORKSPACE 2 [root@falcon open-falcon]# ./open-falcon start #启动所有后端模块 3 [root@falcon open-falcon]# ./open-falcon check #检查启动情况
1 # ./open-falcon [start|stop|restart|check|monitor|reload] module 2 # ./open-falcon start agent 3 [root@falcon open-falcon]# ./open-falcon check 4 falcon-graph UP 17148 5 falcon-hbs UP 17165 6 falcon-judge UP 17178 7 falcon-transfer UP 17187 8 falcon-nodata UP 17199 9 falcon-aggregator UP 17209 10 falcon-agent UP 17220 11 falcon-gateway UP 17232 12 falcon-api UP 17243 13 falcon-alarm UP 17259
1 [root@falcon ~]# cd $WORKSPACE 2 [root@falcon open-falcon]# git clone https://github.com/open-falcon/dashboard.git
1 [root@falcon ~]# yum install -y python-virtualenv 2 [root@falcon ~]# yum install -y python-devel 3 [root@falcon ~]# yum install -y openldap-devel 4 [root@falcon ~]# yum install -y mariadb-devel 5 [root@falcon ~]# yum groupinstall "Development tools" -y 6 [root@falcon ~]# cd $WORKSPACE/dashboard/ 7 [root@falcon dashboard]# virtualenv ./env 8 [root@falcon dashboard]# ./env/bin/pip install -r pip_requirements.txt -i https://pypi.douban.com/simple
1 [root@falcon ~]# vi /data/falcon/open-falcon/dashboard/rrd/config.py 2 # portal database 3 # TODO: read from api instead of db 4 PORTAL_DB_HOST = os.environ.get("PORTAL_DB_HOST","127.0.0.1") 5 PORTAL_DB_PORT = int(os.environ.get("PORTAL_DB_PORT",3306)) 6 PORTAL_DB_USER = os.environ.get("PORTAL_DB_USER","root") 7 PORTAL_DB_PASS = os.environ.get("PORTAL_DB_PASS","123456") #修改数据库密码 8 PORTAL_DB_NAME = os.environ.get("PORTAL_DB_NAME","falcon_portal") 9 10 # alarm database 11 # TODO: read from api instead of db 12 ALARM_DB_HOST = os.environ.get("ALARM_DB_HOST","127.0.0.1") 13 ALARM_DB_PORT = int(os.environ.get("ALARM_DB_PORT",3306)) 14 ALARM_DB_USER = os.environ.get("ALARM_DB_USER","root") 15 ALARM_DB_PASS = os.environ.get("ALARM_DB_PASS","123456") #修改数据库密码 16 ALARM_DB_NAME = os.environ.get("ALARM_DB_NAME","alarms")
1 [root@falcon ~]# firewall-cmd --add-port=8081/tcp --permanent 2 [root@falcon ~]# firewall-cmd --reload
1 [root@falcon ~]# cd /data/falcon/open-falcon/dashboard/ 2 [root@falcon dashboard]# bash control start #以生产模式启动 3 [root@falcon dashboard]# bash control tail #查看相关log
提示:注册账号能够被任何打开dashboard页面的人注册,所以当给相关的人注册完账号后,需要去关闭注册账号功能。只需要去修改api组件的配置文件cfg.json,将signup_disable配置项修改为true,重启api即可。当需要给人开账号的时候,再将配置选项改回去,用完再关掉即可。
1 [root@node01 ~]# mkdir -p /data/falcon/open-falcon/ #node01节点创建工作目录 2 [root@falcon ~]# cd /data/falcon/open-falcon/ 3 [root@falcon open-falcon]# scp -r agent/ root@172.24.10.216:/data/falcon/open-falcon/ 4 [root@falcon open-falcon]# scp -r open-falcon root@172.24.10.216:/data/falcon/open-falcon/
1 [root@node01 ~]# vi /data/falcon/open-falcon/agent/config/cfg.json 2 { 3 "debug": true, # 控制一些debug信息的输出,生产环境通常设置为false 4 "hostname": "", # agent采集了数据发给transfer,endpoint就设置为了hostname,默认通过`hostname`获取,如果配置中配置了hostname,就用配置中的 5 "ip": "", # agent与hbs心跳的时候会把自己的ip地址发给hbs,agent会自动探测本机ip,如果不想让agent自动探测,可以手工修改该配置 6 "plugin": { 7 "enabled": false, # 默认不开启插件机制 8 "dir": "./plugin", # 把放置插件脚本的git repo clone到这个目录 9 "git": "https://github.com/open-falcon/plugin.git", # 放置插件脚本的git repo地址 10 "logs": "./logs" # 插件执行的log,如果插件执行有问题,可以去这个目录看log 11 }, 12 "heartbeat": { 13 "enabled": true, # 此处enabled要设置为true 14 "addr": "172.24.10.95:6030", # hbs的地址,端口是hbs的rpc端口 15 "interval": 60, # 心跳周期,单位是秒 16 "timeout": 1000 # 连接hbs的超时时间,单位是毫秒 17 }, 18 "transfer": { 19 "enabled": true, 20 "addrs": [ 21 "172.24.10.95:18433" 22 ], # transfer的地址,端口是transfer的rpc端口, 可以支持写多个transfer的地址,agent会保证HA 23 "interval": 60, # 采集周期,单位是秒,即agent一分钟采集一次数据发给transfer 24 "timeout": 1000 # 连接transfer的超时时间,单位是毫秒 25 }, 26 "http": { 27 "enabled": true, # 是否要监听http端口 28 "listen": ":1988", 29 "backdoor": false 30 }, 31 "collector": { 32 "ifacePrefix": ["eth", "em"], # 默认配置只会采集网卡名称前缀是eth、em的网卡流量,配置为空就会采集所有的,lo的也会采集。可以从/proc/net/dev看到各个网卡的流量信息 33 "mountPoint": [] 34 }, 35 "default_tags": { 36 }, 37 "ignore": { # 默认采集了200多个metric,可以通过ignore设置为不采集 38 "cpu.busy": true, 39 "df.bytes.free": true, 40 "df.bytes.total": true, 41 "df.bytes.used": true, 42 "df.bytes.used.percent": true, 43 "df.inodes.total": true, 44 "df.inodes.free": true, 45 "df.inodes.used": true, 46 "df.inodes.used.percent": true, 47 "mem.memtotal": true, 48 "mem.memused": true, 49 "mem.memused.percent": true, 50 "mem.memfree": true, 51 "mem.swaptotal": true, 52 "mem.swapused": true, 53 "mem.swapfree": true 54 } 55 }
1 [root@node01 ~]# cd /data/falcon/open-falcon/ 2 [root@node01 open-falcon]# ./open-falcon start agent 3 [root@node01 open-falcon]# ./open-falcon monitor agent #查看运行日志
1 [root@node01 ~]# cd /data/falcon/open-falcon/agent/bin 2 [root@node01 bin]# ./falcon-agent --check 3 disk.io ... ok 4 memory ... ok 5 netstat ... ok 6 ss -s ... ok 7 kernel ... ok 8 net.if ... ok 9 loadavg ... ok 10 cpustat ... ok 11 du -bs ... ok 12 df.bytes ... ok 13 ss -tln ... ok 14 ps aux ... ok
标签:agent 技术 conf rap 名称 collect oat xargs name
原文地址:https://www.cnblogs.com/itzgr/p/10066750.html