open-falcon安裝(一)

來源:互聯網
上載者:User
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。

1、二進位包安裝
2、源碼安裝

前提:推薦使用普通帳號安裝
1、安裝redis:yum install redis -y
2、安裝mysql(二進位mariadb包安裝)
3、初始化mysql資料庫與表結構

export HOME=/home/workexport WORKSPACE=$HOME/open-falconmkdir -p $WORKSPACEcd  $WORKSPACEgit clone https://github.com/open-falcon/scripts.git     cd ./scripts/mysql -h localhost -u root -p < db_schema/graph-db-schema.sqlmysql -h localhost -u root -p < db_schema/dashboard-db-schema.sqlmysql -h localhost -u root -p < db_schema/portal-db-schema.sqlmysql -h localhost -u root -p < db_schema/links-db-schema.sqlmysql -h localhost -u root -p < db_schema/uic-db-schema.sql

4、初始化go語言環境
golang包下載:https://golang.org/dl/

cd ~ && tar xf go1.4.1.linux-amd64.tar.gzecho "export HOME=/home/work" >> .bashrcecho "export GOROOT=$HOME/go" >> .bashrcecho "export GOPATH=$HOME/workspace" >> .bashrcecho "export WORKSPACE=$HOME/open-falcon" >> .bashrcecho "export PATH=$GOROOT/bin:$GOPATH/bin:$PATH" >> .bashrcsource .bashrcmkdir -p $GOPATH/src/github.com/git clone --recursive https://github.com/open-falcon/of-release.git

注意:如果是rpm包安裝的golang(centos6是1.7的版本)GOROOT環境變數設定需要改變:

# echo "export GOROOT=/usr/lib/golang" >> .bashrc

一、安裝agent

cd $GOPATH/src/github.com/of-release/agentgo get ./...報錯:# github.com/of-release/agent./main.go:34: undefined: g.InitLocalIps1、yum 安裝go環境是1.7報錯2、go二進位包安裝環境版本是1.4.1依然爆這個錯誤

這是在逗我嗎?

go get ./..../control build./control pack最後一步會出一個.tar.gz包,拿去安裝即可。

agent設定檔:基於cfg.example.json修改

{    "debug": true, # 控制一些debug資訊的輸出,生產環境通常設定為false    "hostname": "", # agent採集了資料發給transfer,endpoint就設定為了hostname,預設通過`hostname`擷取,如果配置中配置了hostname,就用配置中的    "ip": "", # agent與hbs心跳的時候會把自己的ip地址發給hbs,agent會自動探測本機ip,如果不想讓agent自動探測,可以手工修改該配置    "plugin": {        "enabled": false, # 預設不開啟外掛程式機制        "dir": "./plugin", # 把放置外掛程式指令碼的git repo clone到這個目錄        "git": "https://github.com/open-falcon/plugin.git", # 放置外掛程式指令碼的git repo地址        "logs": "./logs" # 外掛程式執行的log,如果外掛程式執行有問題,可以去這個目錄看log    },    "heartbeat": {        "enabled": true, # 此處enabled要設定為true        "addr": "127.0.0.1:6030", # hbs的地址,連接埠是hbs的rpc連接埠        "interval": 60, # 心跳周期,單位是秒        "timeout": 1000 # 串連hbs的逾時時間,單位是毫秒    },    "transfer": {        "enabled": true, # 此處enabled要設定為true        "addrs": [            "127.0.0.1:8433",            "127.0.0.1:8433"        ], # transfer的地址,連接埠是transfer的rpc連接埠, 可以支援寫多個transfer的地址,agent會保證HA        "interval": 60, # 採集周期,單位是秒,即agent一分鐘採集一次資料發給transfer        "timeout": 1000 # 串連transfer的逾時時間,單位是毫秒    },    "http": {        "enabled": true, # 是否要監聽http連接埠        "listen": ":1988" # 如果監聽的話,監聽的地址,收集到資料通過agent的v1/push介面轉寄    },    "collector": {        "ifacePrefix": ["eth", "em"] # 預設配置只會採集網卡名稱首碼是eth、em的網卡流量,配置為空白就會採集所有的,lo的也會採集。可以從/proc/net/dev看到各個網卡的流量資訊    },    "ignore": { # 預設採集了200多個metric,可以通過ignore設定為不採集        "cpu.busy": true,        "mem.swapfree": true    }}介面使用範式:ts=`date +%s`; curl -X POST -d "[{\"metric\": \"metric.demo\", \"endpoint\": \"qd-open-falcon-judge01.hd\", \"timestamp\": $ts,\"step\": 60,\"value\": 9,\"counterType\": \"GAUGE\",\"tags\": \"project=falcon,module=judge\"}]" http://127.0.0.1:1988/v1/push必要的資料結構:metric: 最核心的欄位,代表這個採集項具體度量的是什麼, 比如是cpu_idle呢,還是memory_free, 還是qpsendpoint: 標明Metric的主體(屬主),比如metric是cpu_idle,那麼Endpoint就表示這是哪台機器的cpu_idletimestamp: 表示彙報該資料時的unix時間戳記,注意是整數,代表的是秒value: 代表該metric在目前時間點的值,float64step: 表示該資料擷取項的彙報周期,這對於後續的配置監控策略很重要,必須明確指定。counterType: 只能是COUNTER或者GAUGE二選一,前者表示該資料擷取項為計時器類型,後者表示其為原值 (注意大小寫)GAUGE:即使用者上傳什麼樣的值,就原封不動的儲存COUNTER:指標在儲存和展現的時候,會被計算為speed,即(當前值 - 上次值)/ 時間間隔tags: 一組逗號分割的索引值對, 對metric進一步描述和細化, 可以是Null 字元串. 比如idc=lg,比如service=xbox等,多個tag之間用逗號分割

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.