open-falcon搭建
发表于:2024-11-24 作者:千家信息网编辑
千家信息网最后更新 2024年11月24日,环境准备yum install -y redisyum install -y mysql-server###安装并开机自启### export HOME=/home/workexport WORKSP
千家信息网最后更新 2024年11月24日open-falcon搭建
环境准备
yum install -y redis
yum install -y mysql-server
###安装并开机自启###
export HOME=/home/work
export WORKSPACE=$HOME/open-falcon
mkdir -p $WORKSPACE
cd $WORKSPACE
git clone https://github.com/open-falcon/scripts.git
cd ./scripts/
mysql -h localhost -u root --password="" < db_schema/graph-db-schema.sql
mysql -h localhost -u root --password="" < db_schema/dashboard-db-schema.sql
mysql -h localhost -u root --password="" < db_schema/portal-db-schema.sql
mysql -h localhost -u root --password="" < db_schema/links-db-schema.sql
mysql -h localhost -u root --password="" < db_schema/uic-db-schema.sql
####数据库密码为空####
mkdir ./tmp
导入安装包open-falcon-v0.1.0.tar.gz
Shell脚本执行
tar -zxf open-falcon-latest.tar.gz -C ./tmp/
for x in `find ./tmp/ -name "*.tar.gz"`;do \
app=`echo $x|cut -d '-' -f2`; \
mkdir -p $app; \
tar -zxf $x -C $app; \
done
安装go环境
cd ~
wget http://dinp.qiniudn.com/go1.4.1.linux-amd64.tar.gz
tar zxf go1.4.1.linux-amd64.tar.gz
mkdir -p workspace/src
echo "" >> .bashrc
echo 'export GOROOT=$HOME/go' >> .bashrc
echo 'export GOPATH=$HOME/workspace' >> .bashrc
echo 'export PATH=$GOROOT/bin:$GOPATH/bin:$PATH' >> .bashrc
echo "" >> .bashrc
source .bashrc
接下来clone代码,以备后用
cd $GOPATH/src
mkdir github.com
cd github.com
git clone --recursive https://github.com/open-falcon/of-release.git
安装agent(采集机器监控指标)
cd $GOPATH/src/github.com/open-falcon/agent
###所有组件配置文件必须叫cfg.json,可以基于cfg.example.json修改
./control start 启动进程
./control stop 停止进程
./control restart 重启进程
./control status 查看进程状态
./control tail 用tail -f的方式查看var/app.log
./falcon-agent -check检查是否可以正常跑在当前机器
安装Transfer(数据转发服务)
Cd transfer
vim cfg.json
{
"debug": false,
"minStep": 30,
"http": {
"enabled": true,
"listen": "0.0.0.0:6060"
},
"rpc": {
"enabled": true,
"listen": "0.0.0.0:8433"
},
"socket": {
"enabled": false,
"listen": "0.0.0.0:4444",
"timeout": 3600
},
"judge": {
"enabled": true,
"batch": 200,
"connTimeout": 1000,
"callTimeout": 5000,
"maxConns": 32,
"maxIdle": 32,
"replicas": 500,
"cluster": {
"judge-00" : "127.0.0.1:6080"
}
},
"graph": {
"enabled": true,
"batch": 200,
"connTimeout": 1000,
"callTimeout": 5000,
"maxConns": 32,
"maxIdle": 32,
"replicas": 500,
"cluster": {
"graph-00" : "127.0.0.1:6070"
}
},
"tsdb": {
"enabled": true,
"batch": 200,
"connTimeout": 1000,
"callTimeout": 5000,
"maxConns": 32,
"maxIdle": 32,
"retry": 3,
"address": "127.0.0.1:8088"
}
}
启动
./control start
curl -s "127.0.0.1:6060/health" 校验
cd graph
mv cfg.example.json cfg.json
vim cfg.json
{
"debug": false,
"http": {
"enabled": true,
"listen": "0.0.0.0:6071"
},
"rpc": {
"enabled": true,
"listen": "0.0.0.0:6070"
},
"rrd": {
"storage": "/home/work/data/6070"
},
"db": {
"dsn": "root:@tcp(127.0.0.1:3306)/graph?loc=Local&parseTime=true",
"maxIdle": 4
},
"callTimeout": 5000,
"migrate": {
"enabled": false,
"concurrency": 2,
"replicas": 500,
"cluster": {
"graph-00" : "127.0.0.1:6070"
}
}
}
./control start
curl -s "127.0.0.1:6071/health"
cd ../queph
mv cfg.example.json cfg.json
vim cfg.json
{
"debug": "false",
"http": {
"enabled": true,
"listen": "0.0.0.0:9966"
},
"graph": {
"connTimeout": 1000,
"callTimeout": 5000,
"maxConns": 32,
"maxIdle": 32,
"replicas": 500,
"cluster": {
"graph-00": "127.0.0.1:6070"
}
},
"api": {
"query": "http://127.0.0.1:9966",
"dashboard": "http://127.0.0.1:8081",
"max": 500
服务启动后,可以通过日志查看服务的运行状态,日志文件地址为./var/app.log。可以通过查询脚本./scripts/query读取绘图数据,如 运行 bash ./scripts/query "ur.endpoint" "ur.counter"可以查询Endpoint="ur.endpoint" & Counter="ur.counter"对应的绘图数据。
注意: 请确保 graph.replicas和graph.cluster 的内容与transfer的配置完全一致
安装dashboard
yum install -y python-virtualenv
cd /path/to/dashboard/
virtualenv ./env
./env/bin/pip install -r pip_requirements.txt
###这里MySQL-Python会出错。在pip_requirements.txt里去掉MySQL-Python单独安装。参考地址:http://blog.csdn.net/winsonyuan/article/details/65447796
vim ./gunicorn.conf
vim ./rrd/config.py
workers = 4
bind = ':8081'
proc_name = 'falcon-dashboard-opensource'
pidfile = '/tmp/falcon-dashboard-opensource.pid'
limit_request_field_size = 0
limit_request_line = 0
#-*-coding:utf8-*-
import os
#-- dashboard db config --
DASHBOARD_DB_HOST = "127.0.0.1"
DASHBOARD_DB_PORT = 3306
DASHBOARD_DB_USER = "root"
DASHBOARD_DB_PASSWD = ""
DASHBOARD_DB_NAME = "dashboard"
#-- graph db config --
GRAPH_DB_HOST = "127.0.0.1"
GRAPH_DB_PORT = 3306
GRAPH_DB_USER = "root"
GRAPH_DB_PASSWD = ""
GRAPH_DB_NAME = "graph"
#-- app config --
DEBUG = True
SECRET_KEY = "secret-key"
SESSION_COOKIE_NAME = "open-falcon"
PERMANENT_SESSION_LIFETIME = 3600 * 24 * 30
SITE_COOKIE = "open-falcon-ck"
#-- query config --
QUERY_ADDR = "http://127.0.0.1:9966"
BASE_DIR = "/home/work/open-falcon/dashboard/"
LOG_PATH = os.path.join(BASE_DIR,"log/")
try:
from rrd.local_config import *
except:
pass
邮件短信接口这里需要单独安装falcon-mail-provider的安装包
{
"debug": true,
"http": {
"listen": "10.0.0.60:4000",
"token": ""
},
"smtp": {
"addr": "smtp.qq.com:587",
"username": "XXXX@qq.com",
"password": "eahqkylmljenbfge",==》这里有个授权码问题。
"from": "XXXX@qq.com"
}
}
~ ./control start
发送一份测试邮件:curl http://10.0.0.60:4000/sender/mail -d tos=XXXX@qq.com&subject=helloworld&content=test
安装sender(调用公司提供的邮件、短信接口)
Cd sender
Vi cfg.json
{
"debug": true,
"http": {
"enabled": true,
"listen": "0.0.0.0:6066"
},
"redis": {
"addr": "127.0.0.1:6379",
"maxIdle": 5
},
"queue": {
"sms": "/sms",
"mail": "/mail"
},
"worker": {
"sms": 10,
"mail": 50
},
"api": {
"sms": "http://10.0.0.60:8000/sms",
"mail": "http://10.0.0.60:4000/sender/mail"
}
}
curl 127.0.0.1:6066/health
安装FE(UIC web入口)
Cd fe
Vi cfg.json
{
"log": "debug",
"company": "PJwuliu", ==》这里是公司名称用于生成二维码
"http": {
"enabled": true,
"listen": "0.0.0.0:1234"
},
"cache": {
"enabled": true,
"redis": "127.0.0.1:6379",
"idle": 10,
"max": 1000,
"timeout": {
"conn": 10000,
"read": 5000,
"write": 5000
}
},
"salt": "fdfdfdsfsdfsfdsfs",
"canRegister": true,
"ldap": {
"enabled": false,
"addr": "ldap.example.com:389",
"baseDN": "dc=example,dc=com",
"bindDN": "cn=mananger,dc=example,dc=com",
"bindPasswd": "12345678",
"userField": "uid",
"attributes": ["sn","mail","telephoneNumber"]
},
"uic": {
"addr": "root:@tcp(127.0.0.1:3306)/uic?charset=utf8&loc=Asia%2FChongqing",
"idle": 10,
"max": 100
},
"shortcut": {
"falconPortal": "http://10.0.0.60:5050/",
"falconDashboard": "http://10.0.0.60:8081/",
"falconAlarm": "http://10.0.0.60:9912/"
}
安装portal(配置报警策略)
# yum install -y python-virtualenv
$ cd /path/to/portal/
$ virtualenv ./env
$ ./env/bin/pip install -r pip_requirements.txt
vi ../portal/frame/config.py
# -*- coding:utf-8 -*-
__author__ = 'Ulric Qin'
# -- app config --
DEBUG = True
# -- db config --
DB_HOST = "127.0.0.1"
DB_PORT = 3306
DB_USER = "root"
DB_PASS = ""
DB_NAME = "falcon_portal"
# -- cookie config --
SECRET_KEY = "4e.5tyg8-u9iojds"
SESSION_COOKIE_NAME = "falcon-portal"
PERMANENT_SESSION_LIFETIME = 3600 * 24 * 30
UIC_ADDRESS = {
'internal': 'http://10.0.0.60:1234',
'external': 'http://10.0.0.60:1234',
}
UIC_TOKEN = ''
MAINTAINERS = ['root']
CONTACT = 'ulric.qin@gmail.com'
COMMUNITY = True
try:
from frame.local_config import *
except Exception, e:
print "[warning] %s" % e
cd hbs
{
"debug": true,
"database": "root:@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true",
"hosts": "",
"maxIdle": 100,
"listen": ":6030",
"trustable": [""],
"http": {
"enabled": true,
"listen": "0.0.0.0:6031"
}
}
Cd judge~(告警判断)
{
"debug": true,
"debugHost": "nil",
"remain": 11,
"http": {
"enabled": true,
"listen": "10.0.0.60:6081"
},
"rpc": {
"enabled": true,
"listen": "0.0.0.0:6080"
},
"hbs": {
"servers": ["10.0.0.60:6030"],
"timeout": 300,
"interval": 60
},
"alarm": {
"enabled": true,
"minInterval": 300,
"queuePattern": "event:p%v",
"redis": {
"dsn": "127.0.0.1:6379",
"maxIdle": 5,
"connTimeout": 5000,
"readTimeout": 5000,
"writeTimeout": 5000
}
}
}
curl 127.0.0.1:6081/health
cd links
virtualenv ./env
./env/bin/pip install -r pip_requirements.txt
# -*- coding:utf-8 -*-
__author__ = 'Ulric Qin'
# -- app config --
DEBUG = True
# -- db config --
DB_HOST = "10.0.0.60"
DB_PORT = 3306
DB_USER = "root"
DB_PASS = ""
DB_NAME = "falcon_links"
# -- cookie config --
SECRET_KEY = "4e.5tyg8-u9ioj"
SESSION_COOKIE_NAME = "falcon-links"
PERMANENT_SESSION_LIFETIME = 3600 * 24 * 30
try:
from frame.local_config import *
except Exception, e:
print "[warning] %s" % e
安装alarm(处理报警event),judge产生的报警event写入redis,alarm从redis读取处理
{
"debug": true,
"uicToken": "",
"http": {
"enabled": true,
"listen": "10.0.0.60:9912"
},
"queue": {
"sms": "/sms",
"mail": "/mail"
},
"redis": {
"addr": "127.0.0.1:6379",
"maxIdle": 5,
"highQueues": [
"event:p0",
"event:p1",
"event:p2",
"event:p3",
"event:p4",
"event:p5"
],
"lowQueues": [
"event:p6"
],
"userSmsQueue": "/queue/user/sms",
"userMailQueue": "/queue/user/mail"
},
"api": {
"portal": "http://10.0.0.60:5050",
"uic": "http://10.0.0.60:1234",
"links": "http://10.0.0.60:5090"
}
}
安装task(定时任务)
{
"debug": false,
"http": {
"enable": true,
"listen": "0.0.0.0:8002"
},
"index": {
"enable": false,
"dsn": "root:root@tcp(127.0.0.1:3306)/graph?loc=Local&parseTime=true",
"maxIdle": 4,
"autoDelete": false,
"cluster":{
"test.hostname01:6071" : "0 0 0 ? * 0-5",
"test.hostname02:6071" : "0 30 0 ? * 0-5"
}
},
"collector" : {
"enable": true,
"destUrl" : "http://127.0.0.1:1988/v1/push",
"srcUrlFmt" : "http://%s/statistics/all",
"cluster" : [
"transfer,open-falcon.te:6060",
"graph,open-falcon.te:6071",
"task,open-falcon.te:8001"
]
}
}
安装nodata(监测监控数据的上报异常)
{
"debug": true,
"http": {
"enabled": true,
"listen": "0.0.0.0:6090"
},
"query":{
"connectTimeout": 5000,
"requestTimeout": 30000,
"queryAddr": "127.0.0.1:9966"
},
"config": {
"enabled": true,
"dsn": "root:@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true&wait_timeout=604800",
"maxIdle": 4
},
"collector":{
"enabled": true,
"batch": 200,
"concurrent": 10
},
"sender":{
"enabled": true,
"connectTimeout": 5000,
"requestTimeout": 30000,
"transferAddr": "127.0.0.1:6060",
"batch": 500,
"block": {
"enabled": false,
"threshold": 32
}
}
}
安装aggregator (集群聚合模块)
{
"debug": true,
"http": {
"enabled": true,
"listen": "0.0.0.0:6055"
},
"database": {
"addr": "root:@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true",
"idle": 10,
"ids": [1, -1],
"interval": 55
},
"api": {
"hostnames": "http://127.0.0.1:5050/api/group/%s/hosts.json",
"push": "http://127.0.0.1:6060/api/push",
"graphLast": "http://127.0.0.1:9966/graph/last"
}
}至此open-falcon已经搭建完成。现在open-falcon刚发布不久plus版,有时间再去看看吧! 祝玩的开心!!! 官网地址: https://github.com/open-falcon-archive/of-release
数据
进程
地址
邮件
报警
服务
配置
公司
可以通过
接口
文件
日志
机器
状态
环境
短信
脚本
utf-8
处理
查询
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
服务器管理平台怎么用
2018年工控网络安全事件
sql数据库新建
串口通讯服务器批发
网易明日之后服务器机房
贵州云服务器存储云主机
琼海市手机软件开发
软件开发中的六性要求
手机与互联网科技图片
oracle数据库历史
对社交网络安全认识
网络安全运行防护工作
电子科技大学计算机学院数据库课件
软件开发培训排名
哪一种软件开发比较吃香
中央网信网络安全指挥中心
安元可信网络安全平台功能
软件开发规范及流程
网上邻居 服务器
戴尔服务器H7NZGJ2
软件开发一般包含哪几个部分
普陀区营销网络技术服务常见问题
关于限制全国网络安全会议
网络技术 教学 局域网
哪一种软件开发比较吃香
web服务器建设实验报告
数据库的封锁技术
中南大学数据库答案
互联网科技菌
代理服务器怎么填