{"id":498,"date":"2016-01-17T20:37:47","date_gmt":"2016-01-17T12:37:47","guid":{"rendered":"http:\/\/www.ipcpu.com\/?p=498"},"modified":"2016-01-17T20:37:47","modified_gmt":"2016-01-17T12:37:47","slug":"open-falcon","status":"publish","type":"post","link":"https:\/\/c.ipcpu.com\/2016\/01\/open-falcon\/","title":{"rendered":"open-falcon\u7684\u4f7f\u7528\u4e00"},"content":{"rendered":"
<\/div>\n

open-falcon\u7684\u4f7f\u7528\u4e00.md<\/p>\n

\u4e00\u3001\u6982\u8ff0<\/h2>\n

open-falcon\u662f\u5c0f\u7c73\u516c\u53f8\u8fd0\u7ef4\u90e8\u5f00\u6e90\u7684\u76d1\u63a7\u4ea7\u54c1\uff0copen-falcon \u662f\u4e00\u5957\u5b8c\u6574\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u5728\u4e0d\u540c\u7684\u516c\u53f8\u6765\u90e8\u7f72\u4f7f\u7528,\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u76d1\u63a710\u53f0\u670d\u52a1\uff0c\u4e5f\u53ef\u4ee5\u6269\u5c55\u523010\u4e07\u53f0\u670d\u52a1\u5668\u3002<\/p>\n

\u4e8c\u3001\u67b6\u6784\u56fe<\/h2>\n

\"\"<\/p>\n

open-falcon \u5bf9\u76d1\u63a7\u7cfb\u7edf\u7684\u5404\u4e2a\u7ec4\u4ef6\u8fdb\u884c\u4e86\u62c6\u5206\uff0c\u8fd9\u6837\u505a\u7684\u597d\u5904\u662f\u53ef\u4ee5\u8fc5\u901f\u6269\u5145\u6269\u5c55\uff0c\u4f46\u574f\u5904\u4e5f\u968f\u4e4b\u800c\u6765\u2013\u592a\u8fc7\u5e9e\u5927\u4e0e\u590d\u6742\u3002<\/p>\n

\u4e0a\u56fe\u5c55\u793a\u4e86\u4e3b\u8981\u7ec4\u4ef6\u7684\u5de5\u4f5c\u793a\u610f\u56fe\u3002\u56e0\u4e3a\u7cfb\u7edf\u592a\u590d\u6742\uff0c\u6211\u4eec\u5206\u6210\u4e86\u591a\u4e2a\u90e8\u5206\uff0c\u8fd9\u6b21\u53ea\u4ecb\u7ecd\u5982\u4f55\u642d\u5efa\u4e00\u4e2a\u7c7b\u4f3c\u4e8ecacti\u7684\u7cfb\u7edf\uff08\u53ea\u6709\u76d1\u63a7\u56fe\u6807\u6570\u636e\uff0c\u53ef\u4ee5\u5c55\u793a\uff0c\u4f46\u4e0d\u80fd\u62a5\u8b66\uff09<\/p>\n

\u4e09\u3001\u5b89\u88c5\uff08\u53ea\u6709\u76d1\u63a7\u529f\u80fd\uff0c\u65e0\u62a5\u8b66\u529f\u80fd\uff09<\/h2>\n

\u5982\u679c\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u7c7b\u4f3ccacti\u7684\u7cfb\u7edf\uff0c\u6211\u4eec\u9700\u8981\u4ee5\u4e0b\u7ec4\u4ef6\uff1a<\/p>\n

\n

agent
\n transfer
\n graph
\n query
\n dashboard
\n hbs<\/p>\n<\/blockquote>\n

\u6570\u636e\u57fa\u672c\u6d41\u5411\u5982\u4e0b\uff1a
\nagent\u2013>transfer\u2013>graph\u2013>query\u2013>dashboard<\/p>\n

\u56e0\u4e3agraph\u3001hbs\u3001dashborad\u9700\u8981\u8fde\u63a5mysql\u6570\u636e\uff0c\u56e0\u6b64\u9700\u8981\u5b89\u88c5mysql\u6570\u636e\u5e93<\/p>\n

3.1 \u5b89\u88c5mysql-server<\/h4>\n
  1. #@install mysql-server<\/span><\/code><\/li>
  2. yum install mysql<\/span>-<\/span>server <\/span>-<\/span>y<\/span><\/code><\/li>
  3. \/<\/span>etc<\/span>\/<\/span>init<\/span>.<\/span>d<\/span>\/<\/span>mysqld start<\/span><\/code><\/li>
  4. #@checkout code<\/span><\/code><\/li>
  5. git clone https<\/span>:<\/span>\/\/github.com\/open-falcon\/scripts.git<\/span><\/code><\/li>
  6. cd <\/span>.\/<\/span>scripts<\/span>\/<\/span><\/code><\/li>
  7. #@init mysql tables<\/span><\/code><\/li>
  8. mysql <\/span>-<\/span>u root <\/span>--<\/span>password<\/span>=<\/span>\"\"<\/span> <\/span><<\/span> db_schema<\/span>\/<\/span>graph<\/span>-<\/span>db<\/span>-<\/span>schema<\/span>.<\/span>sql<\/span><\/code><\/li>
  9. mysql <\/span>-<\/span>u root <\/span>--<\/span>password<\/span>=<\/span>\"\"<\/span> <\/span><<\/span> db_schema<\/span>\/<\/span>dashboard<\/span>-<\/span>db<\/span>-<\/span>schema<\/span>.<\/span>sql<\/span><\/code><\/li>
  10. mysql <\/span>-<\/span>u root <\/span>--<\/span>password<\/span>=<\/span>\"\"<\/span> <\/span><<\/span> db_schema<\/span>\/<\/span>portal<\/span>-<\/span>db<\/span>-<\/span>schema<\/span>.<\/span>sql<\/span><\/code><\/li>
  11. mysql <\/span>-<\/span>u root <\/span>--<\/span>password<\/span>=<\/span>\"\"<\/span> <\/span><<\/span> db_schema<\/span>\/<\/span>links<\/span>-<\/span>db<\/span>-<\/span>schema<\/span>.<\/span>sql<\/span><\/code><\/li>
  12. mysql <\/span>-<\/span>u root <\/span>--<\/span>password<\/span>=<\/span>\"\"<\/span> <\/span><<\/span> db_schema<\/span>\/<\/span>uic<\/span>-<\/span>db<\/span>-<\/span>schema<\/span>.<\/span>sql<\/span><\/code><\/li><\/ol><\/pre>\n

    \u5f00\u901amysql\u6388\u6743<\/p>\n

    1. mysql<\/span>><\/span> grant all privileges on <\/span>*.*<\/span> to root@<\/span>'10.127.68.7'<\/span>;<\/span><\/code><\/li>
    2. mysql<\/span>><\/span> flush privileges<\/span>;<\/span><\/code><\/li><\/ol><\/pre>\n

      3.2 \u542f\u52a8agent\u3001transfer\u3001graph\u3001query<\/h3>\n

      open-falcon\u7ec4\u4ef6\u5927\u90e8\u5206\u662f\u7528go\u8bed\u8a00\u5f00\u53d1\uff0c\u5c0f\u90e8\u5206web\u7ec4\u4ef6\u662fpython\u5f00\u53d1\uff0cgo\u8bed\u8a00\u7684\u597d\u5904\u5c31\u662f\u7f16\u8bd1\u6210\u4e8c\u8fdb\u5236\u7a0b\u5e8f\uff0c\u653e\u5230\u673a\u5668\u4e0a\u5c31\u80fd\u8fd0\u884c\u3002\u5b98\u65b9\u5df2\u7ecf\u5e2e\u6211\u4eec\u7f16\u8bd1\u597d\u4e86\u4e8c\u8fdb\u5236\u7248\u672c\uff0c\u53ef\u4ee5\u76f4\u63a5\u4e0b\u8f7d\u4f7f\u7528\u3002<\/p>\n

      1. wget <\/span>\"https:\/\/github.com\/XiaoMi\/open-falcon\/releases\/download\/0.0.5\/open-falcon-0.0.5.tar.gz\"<\/span><\/code><\/li><\/ol><\/pre>\n

        \u56e0\u4e3a\u6211\u4eec\u662f\u5355\u673a\u90e8\u7f72\uff0c\u56e0\u6b64\u4fee\u6539\u914d\u7f6e\u6587\u4ef6cfg.json\uff0c\u628a\u76d1\u542c\u7aef\u53e3\u6539\u6210\u672c\u673aIP\uff0c\u7136\u540e\u540e\u4f7f\u7528control\u811a\u672c\u542f\u52a8\u5373\u53ef\u3002<\/p>\n

        \u8fd0\u884c\u5b8c\u6bd5\u540e\u53ef\u4ee5\u4f7f\u7528ps\u547d\u4ee4\u770b\u5230\u8fdb\u7a0b\uff0c\u901a\u8fc7netstat\u53ef\u4ee5\u770b\u5230\u76d1\u542c\u7684\u7aef\u53e3\uff0c\u5426\u5219\u5c31\u4ee3\u8868\u542f\u52a8\u5931\u8d25\uff0c\u53ef\u4ee5\u53bb\u5404\u4e2a\u7ec4\u4ef6\u7684var\u76ee\u5f55\u4e0b\u67e5\u770bapp.log\u65e5\u5fd7\uff0c\u6392\u67e5\u95ee\u9898\u3002<\/p>\n

        1. .\/<\/span>control start<\/span><\/code><\/li><\/ol><\/pre>\n

          3.3 \u542f\u52a8dashborad<\/h3>\n

          dadhborad\u662fPython\u7a0b\u5e8f\uff0c\u9700\u8981\u5148\u5b89\u88c5virtualenv<\/p>\n

          1. yum install <\/span>-<\/span>y python<\/span>-<\/span>virtualenv<\/span><\/code><\/li><\/ol><\/pre>\n

            dashborad\u7684\u914d\u7f6e\u6587\u4ef6\u662frrd\/config.py \uff0c\u4fee\u6539\u5b8c\u6bd5\u540e\u53ef\u4ee5\u542f\u52a8<\/p>\n

            1. $ cd $HOME<\/span>\/<\/span>open<\/span>-<\/span>falcon<\/span>\/<\/span>dashboard<\/span>\/<\/span><\/code><\/li>
            2. $ virtualenv <\/span>.\/<\/span>env<\/span><\/code><\/li>
            3. $ .\/env\/bin\/pip install -r pip_requirements.txt<\/code><\/li>
            4. ##@@ Run with gunicorn<\/span><\/code><\/li>
            5. $ bash control start<\/span><\/code><\/li><\/ol><\/pre>\n

              3.4 hbs<\/h3>\n

              hbs\u5728\u54b1\u4eec\u8bbe\u8ba1\u7684\u573a\u666f\u4e2d\u6ca1\u6709\u7528\u5230\uff0c\u88c5\u6216\u8005\u4e0d\u88c5\u90fd\u53ef\u4ee5\uff0c\u5efa\u8bae\u5b89\u88c5\u4e0a\uff0c\u4e0d\u5b89\u88c5\u7684\u8bddagent\u4f1a\u4e00\u76f4\u6709\u9519\u8bef\u65e5\u5fd7\u3002<\/p>\n

              \u56db\u3001dashborad\u9762\u677f\u7684\u4f7f\u7528<\/h2>\n

              \u6211\u4eec\u5df2\u7ecf\u5b89\u88c5\u5b8c\u6210\u4e86\uff0c\u6253\u5f00http:\/\/$<\/a>{MY_HOST_IP}:8081\/ \u5373\u53ef\u770b\u5230dashborad\u9875\u9762\u3002<\/p>\n

              \"\"<\/p>\n

              \u6982\u5ff5\u89e3\u91ca<\/strong><\/p>\n

              \n

              Endpoint \u8fb9\u7f18\u8282\u70b9\uff0c\u4e5f\u5c31\u662f\u5b89\u88c5\u4e86agent\u7684\u670d\u52a1\u5668\u6216\u8005\u865a\u62df\u673a
              \n Counter \u8ba1\u6570\u5668\uff0c\u4e5f\u5c31\u662f\u88ab\u76d1\u63a7\u7684\u6307\u6807\u9879\uff0c\u4f8b\u5982\u5185\u5b58\u4f7f\u7528\u7387<\/p>\n<\/blockquote>\n

              \u5de6\u4fa7\u53ef\u4ee5\u641c\u7d22Endpoint\uff0c\u4e5f\u5c31\u662f\u5b89\u88c5\u4e86agent\u5ba2\u6237\u7aef\u7684\u673a\u5668\u540d\u3002\u8fd9\u91cc\u652f\u6301\u6a21\u7cca\u641c\u7d22\uff0c\u6211\u4eec\u8f93\u5165\u201c1\u201d\uff0c\u53ef\u4ee5\u641c\u7d22\u5230\u597d\u591a\u5b89\u88c5\u4e86agent\u7684\u673a\u5668\u3002<\/p>\n

              \u6211\u4eec\u9009\u4e2d\u5176\u4e2d2\u4e2a\u673a\u5668\uff0c\u5e76\u70b9\u51fb\u201c\u5237\u65b0counter\u5217\u8868\u201d\uff0c\u5728\u53f3\u9762\u7684counter\u5217\u8868\u91cc\u9762\u5c31\u4f1a\u51fa\u73b0\u8fd9\u4e2aagent\u6ce8\u518c\u8fdb\u6765\u7684\u5404\u79cd\u76d1\u63a7\u6570\u636e\u3002<\/p>\n

              \u6211\u4eec\u9009\u4e2d\u76d1\u63a7\u6570\u636e\u4f8b\u5982\u201ccpu.idle\u201d \uff0c\u7136\u540e\u70b9\u51fb\u201c\u770b\u56fe\u201d-\u201cEndpoint\u89c6\u89d2\u201d\u5c31\u53ef\u4ee5\u67e5\u770b\u5b83\u7684\u56fe\u50cf\u3002<\/p>\n

              \"\"<\/p>\n

              \u4e94\u3001screen\u7684\u4f7f\u7528<\/h2>\n

              \u6211\u4eec\u53ef\u4ee5\u4f7f\u7528screen\u63d0\u524d\u5c06\u56fe\u50cf\u5b9a\u5236\u597d\uff0c\u800c\u4e0d\u7528\u6bcf\u6b21\u90fd\u53bb\u641c\u7d22\u51fa\u56fe\uff0c\u8fd9\u6837\u5c31\u5b9e\u73b0\u4e86\u7c7b\u4f3c\u7684cacti\u56fe\u50cf\u5c55\u793a\u529f\u80fd\u3002<\/p>\n

              \u70b9\u51fbscreen\u540e\uff0c\u65b0\u589e\u51e0\u4e2ascreen\uff0cscreen\u6709\u7c7b\u4f3c\u76842\u7ea7\u76ee\u5f55\uff0c\u8fdb\u5165\u6700\u5e95\u5c42\u540e\uff0c\u4f1a\u663e\u793a\u5982\u4e0b\uff1a<\/p>\n

              \"\"<\/p>\n

              \u70b9\u51fb\u201c+graph\u201d\u53ef\u4ee5\u6dfb\u52a0\u81ea\u5b9a\u4e49\u7684\u56fe\u50cf<\/p>\n

              \"\"<\/p>\n

              \u516d\u3001\u53c2\u8003\u8d44\u6599<\/h2>\n

              http:\/\/book.open-falcon.com\/zh\/quick_install\/index.html<\/a>
              \n
              http:\/\/www.jikexueyuan.com\/course\/1651_4.html?ss=1<\/a><\/p>\n

              \u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def<\/a> » open-falcon\u7684\u4f7f\u7528\u4e00<\/a><\/p>","protected":false},"excerpt":{"rendered":"

              open-falcon\u7684\u4f7f\u7528\u4e00.md \u4e00\u3001\u6982\u8ff0 open-falcon\u662f\u5c0f\u7c73\u516c\u53f8\u8fd0\u7ef4\u90e8\u5f00\u6e90\u7684\u76d1\u63a7\u4ea7\u54c1\uff0copen-falcon \u662f\u4e00\u5957\u5b8c\u6574\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u5728\u4e0d\u540c\u7684\u516c\u53f8\u6765\u90e8\u7f72\u4f7f\u7528,\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u76d1\u63a710\u53f0\u670d\u52a1\uff0c\u4e5f\u53ef\u4ee5\u6269\u5c55\u523010\u4e07\u53f0\u670d\u52a1\u5668\u3002 \u4e8c\u3001\u67b6\u6784\u56fe open-falcon \u5bf9\u76d1\u63a7\u7cfb\u7edf\u7684\u5404\u4e2a\u7ec4\u4ef6\u8fdb\u884c\u4e86\u62c6\u5206\uff0c\u8fd9\u6837\u505a\u7684\u597d\u5904\u662f\u53ef\u4ee5\u8fc5\u901f\u6269\u5145\u6269\u5c55\uff0c\u4f46\u574f\u5904\u4e5f\u968f\u4e4b\u800c\u6765\u2013\u592a\u8fc7\u5e9e\u5927\u4e0e\u590d\u6742\u3002 \u4e0a\u56fe\u5c55\u793a\u4e86\u4e3b\u8981\u7ec4\u4ef6\u7684\u5de5\u4f5c\u793a\u610f\u56fe\u3002\u56e0\u4e3a\u7cfb\u7edf\u592a\u590d\u6742\uff0c\u6211\u4eec\u5206\u6210\u4e86\u591a\u4e2a\u90e8\u5206\uff0c\u8fd9\u6b21\u53ea\u4ecb\u7ecd\u5982\u4f55\u642d\u5efa\u4e00\u4e2a\u7c7b\u4f3c\u4e8ecacti\u7684\u7cfb\u7edf\uff08\u53ea\u6709\u76d1\u63a7\u56fe\u6807\u6570\u636e\uff0c\u53ef\u4ee5\u5c55\u793a\uff0c\u4f46\u4e0d\u80fd\u62a5\u8b66\uff09 \u4e09\u3001\u5b89\u88c5\uff08\u53ea\u6709\u76d1\u63a7\u529f\u80fd\uff0c\u65e0\u62a5\u8b66\u529f\u80fd\uff09 \u5982\u679c\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u7c7b\u4f3ccacti\u7684\u7cfb\u7edf\uff0c\u6211\u4eec\u9700\u8981\u4ee5\u4e0b\u7ec4\u4ef6\uff1a agent transfer graph query dashboard hbs \u6570\u636e\u57fa\u672c\u6d41\u5411\u5982\u4e0b\uff1a agent\u2013>transfer\u2013>graph\u2013>query\u2013>dashboard \u56e0\u4e3agraph\u3001hbs\u3001dashborad\u9700\u8981\u8fde\u63a5mysql\u6570\u636e\uff0c\u56e0\u6b64\u9700\u8981\u5b89\u88c5mysql\u6570\u636e\u5e93 3.1 \u5b89\u88c5mysql-server #@install mysql-serveryum install mysql-server -y\/etc\/init.d\/mysqld start#@checkout codegit clone https:\/\/github.com\/open-falcon\/scripts.gitcd .\/scripts\/#@init mysql tablesmysql -u root –password=”” < db_schema\/graph-db-schema.sqlmysql -u root –password=”” < db_schema\/dashboard-db-schema.sqlmysql -u root –password=”” < db_schema\/portal-db-schema.sqlmysql -u root –password=”” < db_schema\/links-db-schema.sqlmysql -u root […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[17,55,56,57,32],"_links":{"self":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/498"}],"collection":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/comments?post=498"}],"version-history":[{"count":0,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/498\/revisions"}],"wp:attachment":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/media?parent=498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/categories?post=498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/tags?post=498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}