open-falcon 安装

openfalcon 规划

 

拓扑图

 transfer 配置文件

[root@openfalcon_transfer1 transfer]# cat cfg.json 
{
    "debug": true,
    "minStep": 30,
    "http": {
        "enabled": true,
        "listen": "0.0.0.0:6060"
    },
    "rpc": {
        "enabled": true,
        "listen": "0.0.0.0:8433"
    },
    "socket": {
        "enabled": true,
        "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" : "172.16.230.163:6080",
            "judge-01" : "172.16.230.164:6080"
        }
    },
    "graph": {
        "enabled": true,
        "batch": 200,
        "connTimeout": 1000,
        "callTimeout": 5000,
        "maxConns": 32,
        "maxIdle": 32,
        "replicas": 500,
        "cluster": {
            "graph-00" : "172.16.230.165:6070",
            "graph-01" : "172.16.230.166:6070"
        }
    },
    "tsdb": {
        "enabled": false,
        "batch": 200,
        "connTimeout": 1000,
        "callTimeout": 5000,
        "maxConns": 32,
        "maxIdle": 32,
        "retry": 3,
        "address": "127.0.0.1:8088"
    }
}

 judge配置文件

[root@openfalcon_judge1 judge]# cat cfg.json 
{
    "debug": true,
    "debugHost": "nil",
    "remain": 11, 
    "http": {
        "enabled": true,
        "listen": "0.0.0.0:6081"
    },
    "rpc": {
        "enabled": true,
        "listen": "0.0.0.0:6080"
    },
    "hbs": {
        "servers": ["172.16.230.169:6030"],
        "timeout": 300,
        "interval": 60
    },
    "alarm": {
        "enabled": true,
        "minInterval": 300,
        "queuePattern": "event:p%v",
        "redis": {
            "dsn": "172.16.230.167:6379",
            "maxIdle": 5,
            "connTimeout": 5000,
            "readTimeout": 5000,
            "writeTimeout": 5000
        }
    }
}

graph配置文件

[root@openfalcon_graph2 graph]# cat cfg.json 
{
    "debug": false,
    "http": {
        "enabled": true,
        "listen": "0.0.0.0:6071"
    },
    "rpc": {
        "enabled": true,
        "listen": "0.0.0.0:6070"
    },
    "rrd": {
        "storage": "/data/graph/data6070"
    },
    "db": {
        "dsn": "openfalcon:123456@tcp(172.16.230.168: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"
        }
    }
}

alarm配置文件

[root@openfalcon_master alarm]# cat cfg.json 
{
    "debug": true,
    "uicToken": "",
    "http": {
        "enabled": true,
        "listen": "0.0.0.0:9912"
    },
    "queue": {
        "sms": "/sms",
        "mail": "/mail"
    },
    "redis": {
        "addr": "172.16.230.167: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://172.16.230.169:5050",
        "uic": "http://172.16.230.169:1234",
        "links": "http://172.16.230.169:5090"
    }
}

dashboard配置文件

[root@openfalcon_master dashboard]# cat gunicorn.conf 
workers = 4
bind = ':8081'
proc_name = 'falcon-dashboard-opensource'
pidfile = '/tmp/falcon-dashboard-opensource.pid'
limit_request_field_size = 0
limit_request_line = 0



[root@openfalcon_master rrd]# cat config.py
#-*-coding:utf8-*-
import os

#-- dashboard db config --
DASHBOARD_DB_HOST = "172.16.230.168"
DASHBOARD_DB_PORT = 3306
DASHBOARD_DB_USER = "openfalcon"
DASHBOARD_DB_PASSWD = "123456"
DASHBOARD_DB_NAME = "dashboard"

#-- graph db config --
GRAPH_DB_HOST = "172.16.230.168"
GRAPH_DB_PORT = 3306
GRAPH_DB_USER = "openfalcon"
GRAPH_DB_PASSWD = "123456"
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://172.16.230.169:9966"

BASE_DIR = "/data/dashboard/"
LOG_PATH = os.path.join(BASE_DIR,"log/")

try:
    from rrd.local_config import *
except:
    pass

fe 配置文件

[root@openfalcon_master fe]# cat cfg.json 
{
    "log": "debug",
    "company": "公司名称",
    "http": {
        "enabled": true,
        "listen": "0.0.0.0:1234"
    },
    "cache": {
        "enabled": true,
        "redis": "172.16.230.167:6379",
        "idle": 10,
        "max": 1000,
        "timeout": {
            "conn": 10000,
            "read": 5000,
            "write": 5000
        }
    },
    "salt": "0i923fejfd3",
    "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": "openfalcon:123456@tcp(172.16.230.168:3306)/uic?charset=utf8&loc=Asia%2FChongqing",
        "idle": 10,
        "max": 100
    },
    "shortcut": {
        "falconPortal": "http://172.16.230.169:5050/",
        "falconDashboard": "http://172.16.230.169:8081/",
        "falconAlarm": "http://172.16.230.169:9912/"
    }
}

hbs配置文件

[root@openfalcon_master hbs]# cat cfg.json 
{
    "debug": true,
    "database": "openfalcon:123456@tcp(172.16.230.168:3306)/falcon_portal?loc=Local&parseTime=true",
    "hosts": "",
    "maxIdle": 100,
    "listen": ":6030",
    "trustable": [""],
    "http": {
        "enabled": true,
        "listen": "0.0.0.0:6031"
    }
}

sender配置文件

[root@openfalcon_master sender]# cat cfg.json 
{
    "debug": true,
    "http": {
        "enabled": true,
        "listen": "0.0.0.0:6066"
    },
    "redis": {
        "addr": "172.16.230.167:6379",
        "maxIdle": 5
    },
    "queue": {
        "mail": "/mail"
    },
    "worker": {
        "sms": 10,
        "mail": 50
    },
    "api": {
    "mail":"http://172.16.230.169:4000/sender/mail"
    }
}

mail_provider配置文件, sender通过mail_provider发送邮件

[root@openfalcon_master mail_provider]# cat cfg.json
{
    "debug": true,
    "http": {
        "listen": "0.0.0.0:4000",
        "token": ""
    },
    "smtp": {
        "addr": "smtp.163.com:25",
        "username": "fengjian1585@163.com",
        "password": "1111111111111111111111111111111",
        "from": "fengjian1585@163.com"
    }
}

 nodata配置文件,如果agent异常,图表上将显示-1

[root@openfalcon_master nodata]# cat cfg.json 
{
    "debug": false,
    "http": {
        "enabled": true,
        "listen": "0.0.0.0:6090"
    },
    "query":{
        "connectTimeout": 5000,
        "requestTimeout": 30000,
        "queryAddr": "172.16.230.169:9966"
    },
    "config": {
        "enabled": true,
        "dsn": "openfalcon:123456@tcp(172.16.230.168: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": "172.16.230.161:6060",
        "transferAddr": "172.16.230.162:6060",
        "batch": 500,
        "block": {
            "enabled": false,
            "threshold": 32
        }
    }
}

 配置情况

portal配置文件

[root@openfalcon_master portal]# cat gunicorn.conf 
workers = 4
bind = '0.0.0.0:5050'
proc_name = 'falcon-portal'
pidfile = 'var/app.pid'
limit_request_field_size = 0
limit_request_line = 0


[root@openfalcon_master portal]# cat frame/config.py
# -*- coding:utf-8 -*-
__author__ = 'Ulric Qin'

# -- app config --
DEBUG = True

# -- db config --
DB_HOST = "172.16.230.168"
DB_PORT = 3306
DB_USER = "openfalcon"
DB_PASS = "123456"
DB_NAME = "falcon_portal"

# -- cookie config --
SECRET_KEY = "4e.5tyg8-u9ioj"
SESSION_COOKIE_NAME = "falcon-portal"
PERMANENT_SESSION_LIFETIME = 3600 * 24 * 30

UIC_ADDRESS = {
    'internal': 'http://172.16.230.169:1234',
    'external': 'http://172.16.230.169: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

query配置文件

{
    "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" : "172.16.230.165:6070",
            "graph-01" : "172.16.230.166:6070"
        }
    },
    "api": {
        "query": "http://192.168.230.169:9966",
        "dashboard": "http://192.168.230.169:8081",
        "max": 500
    }
}

task 配置文件

[root@openfalcon_master task]# cat cfg.json 
{
    "debug": false,
    "http": {
        "enable": true,
        "listen": "0.0.0.0:8002"
    },
    "index": {
        "enable": true,
        "dsn": "openfalcon:senyint.rh@tcp(172.16.230.168:3306)/graph?loc=Local&parseTime=true",
        "maxIdle": 4,
        "autoDelete": false,
        "cluster":{
            "openfalcon_judge1:6071" : "0 0 0 ? * 0-5",
            "openfalcon_judge2: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,openfalcon_transfer1:6060",
            "transfer,openfalcon_transfer2:6060",
            "graph,openfalcon_graph1:6071",
            "graph,openfalcon_graph2:6071",
            "task,openfalcon_master:8001"
        ]
    }
}
原文地址:https://www.cnblogs.com/fengjian2016/p/5493300.html