open-falcon搭建-創(chuàng)新互聯(lián)

環(huán)境準(zhǔn)備

我們擁有十多年網(wǎng)頁設(shè)計和網(wǎng)站建設(shè)經(jīng)驗,從網(wǎng)站策劃到網(wǎng)站制作,我們的網(wǎng)頁設(shè)計師為您提供的解決方案。為企業(yè)提供成都網(wǎng)站設(shè)計、成都網(wǎng)站建設(shè)、微信開發(fā)、重慶小程序開發(fā)成都手機(jī)網(wǎng)站制作、H5網(wǎng)站設(shè)計、等業(yè)務(wù)。無論您有什么樣的網(wǎng)站設(shè)計或者設(shè)計方案要求,我們都將富于創(chuàng)造性的提供專業(yè)設(shè)計服務(wù)并滿足您的需求。

yum install -y redis

yum install -y mysql-server
###安裝并開機(jī)自啟###

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

####數(shù)據(jù)庫密碼為空####

mkdir ./tmp

導(dǎo)入安裝包open-falcon-v0.1.0.tar.gz

Shell腳本執(zhí)行

        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環(huán)境

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(采集機(jī)器監(jiān)控指標(biāo))

cd $GOPATH/src/github.com/open-falcon/agent

###所有組件配置文件必須叫cfg.json,可以基于cfg.example.json修改

open-falcon搭建

./control start 啟動進(jìn)程
./control stop 停止進(jìn)程
./control restart 重啟進(jìn)程
./control status 查看進(jìn)程狀態(tài)
./control tail 用tail -f的方式查看var/app.log
./falcon-agent –check檢查是否可以正常跑在當(dāng)前機(jī)器


安裝Transfer(數(shù)據(jù)轉(zhuǎn)發(fā)服務(wù))
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
服務(wù)啟動后,可以通過日志查看服務(wù)的運(yùn)行狀態(tài),日志文件地址為./var/app.log。可以通過查詢腳本./scripts/query讀取繪圖數(shù)據(jù),如 運(yùn)行 bash ./scripts/query "ur.endpoint" "ur.counter"可以查詢Endpoint="ur.endpoint" & Counter="ur.counter"對應(yīng)的繪圖數(shù)據(jù)。

注意: 請確保 graph.replicas和graph.cluster 的內(nèi)容與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單獨(dú)安裝。參考地址: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

郵件短信接口這里需要單獨(dú)安裝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",==》這里有個授權(quán)碼問題。
        "from": "XXXX@qq.com"
    }
}
~  ./control start

發(fā)送一份測試郵件:curl http://10.0.0.60:4000/sender/mail -d tos=XXXX@qq.com&subject=helloworld&content=test

安裝sender(調(diào)用公司提供的郵件、短信接口)
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產(chǎn)生的報警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(定時任務(wù))
{
    "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(監(jiān)測監(jiān)控數(shù)據(jù)的上報異常)
{
    "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已經(jīng)搭建完成?,F(xiàn)在open-falcon剛發(fā)布不久plus版,有時間再去看看吧!
            祝玩的開心?。。?            
    官網(wǎng)地址:
                https://github.com/open-falcon-archive/of-release

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

本文題目:open-falcon搭建-創(chuàng)新互聯(lián)
網(wǎng)站鏈接:http://bm7419.com/article8/gdsop.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈域名注冊、響應(yīng)式網(wǎng)站、ChatGPT品牌網(wǎng)站制作、網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

綿陽服務(wù)器托管