{"id":3939,"date":"2018-06-02T18:30:48","date_gmt":"2018-06-02T10:30:48","guid":{"rendered":"https:\/\/ixyzero.com\/blog\/?p=3939"},"modified":"2018-06-02T18:30:48","modified_gmt":"2018-06-02T10:30:48","slug":"linux%e4%b8%8b%e5%ba%94%e7%94%a8-%e8%bf%9b%e7%a8%8b%e7%9a%84%e5%ad%98%e6%b4%bb%e6%80%a7%e7%9b%91%e6%8e%a7","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/3939.html","title":{"rendered":"Linux\u4e0b\u5e94\u7528\/\u8fdb\u7a0b\u7684\u5b58\u6d3b\u6027\u76d1\u63a7"},"content":{"rendered":"<p>=Start=<\/p>\n<h4 id=\"id-\u6a21\u677f-\u7f18\u7531\uff1a\">\u7f18\u7531\uff1a<\/h4>\n<p>\u5f88\u65e9\u4e4b\u524d\u5c31\u60f3\u4e86\u89e3\u7684\u4e00\u4e2a\u95ee\u9898\uff0c\u81ea\u5df1\u4e5f\u591a\u5c11\u77e5\u9053\u4e00\u4e9b\u65b9\u6cd5\uff0c\u4f46\u603b\u89c9\u5f97\u5e94\u8be5\u6709\u591a\u79cd\u5b9e\u73b0\u65b9\u5f0f\/\u65b9\u6cd5\uff0c\u4e0d\u8fc7\u4e00\u76f4\u6ca1\u673a\u4f1a\u6574\u7406\u3001\u603b\u7ed3\uff0c\u6240\u4ee5\u8fd9\u6b21\u5148\u6574\u7406\u4e00\u4e0b\uff0c\u7b49\u4ee5\u540e\u5404\u79cd\u65b9\u6cd5\u90fd\u5b9e\u8df5\u4e86\u4e00\u904d\u518d\u66f4\u65b0\u4e00\u4e0b\uff0c\u6216\u662f\u518d\u5199\u4e00\u7bc7\u3002<\/p>\n<h4 id=\"id-\u6a21\u677f-\u6b63\u6587\uff1a\">\u6b63\u6587\uff1a<\/h4>\n<h5 id=\"id-\u6a21\u677f-\u53c2\u8003\u89e3\u7b54\uff1a\">\u53c2\u8003\u89e3\u7b54\uff1a<\/h5>\n<p>\u5b9e\u73b0\u300c\u8fdb\u7a0b\u76d1\u63a7\u300d\u53ef\u4ee5\u4f7f\u7528\u7684\u4e00\u4e9b\u73b0\u6210\u5de5\u5177\uff08Bluepill\u3001eye\u3001god\u3001supervisor\u3001Open-Falcon\uff09<\/p>\n<p>Process monitoring tool. Inspired from Bluepill and God. (Ruby)<br \/>\n<a href=\"https:\/\/github.com\/kostya\/eye\">https:\/\/github.com\/kostya\/eye<\/a><\/p>\n<p>simple process monitoring tool (Ruby)<br \/>\n<a href=\"https:\/\/github.com\/bluepill-rb\/bluepill\">https:\/\/github.com\/bluepill-rb\/bluepill<\/a><\/p>\n<p>Ruby process monitor (Ruby)<br \/>\n<a href=\"https:\/\/github.com\/mojombo\/god\">https:\/\/github.com\/mojombo\/god<\/a><br \/>\n<a href=\"http:\/\/godrb.com\/\">http:\/\/godrb.com\/<\/a><\/p>\n<p>monit (C)<br \/>\n<a href=\"https:\/\/github.com\/arnaudsj\/monit\">https:\/\/github.com\/arnaudsj\/monit<\/a><\/p>\n<p>supervisor (Python)<br \/>\n<a href=\"https:\/\/github.com\/Supervisor\/supervisor\">https:\/\/github.com\/Supervisor\/supervisor<\/a><\/p>\n<p>Open-Falcon<br \/>\n<a href=\"http:\/\/book.open-falcon.org\/zh\/usage\/proc-port-monitor.html\">http:\/\/book.open-falcon.org\/zh\/usage\/proc-port-monitor.html<\/a><\/p>\n<pre class=\"lang:default decode:true \"># \u7aef\u53e3\u76d1\u63a7\r\n\u673a\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53ef\u80fd\u5f88\u591a\u5f88\u591a\uff0c\u4f46\u662f\u771f\u6b63\u60f3\u505a\u76d1\u63a7\u7684\u7aef\u53e3\u53ef\u80fd\u4e0d\u591a\uff0c\u8fd9\u4f1a\u9020\u6210\u8d44\u6e90\u6d6a\u8d39\r\n\u76ee\u524dOpen-Falcon\u8fd8\u4e0d\u652f\u6301nodata\u76d1\u63a7\uff0c\u7aef\u53e3\u6302\u4e86\u4e0d\u4e0a\u62a5\u6570\u636e\u4e86\uff0c\u6ca1\u6709nodata\u673a\u5236\uff0c\u662f\u53d1\u73b0\u4e0d\u4e86\u7684\r\n\r\nagent\u901a\u8fc7 ss -tln \u547d\u4ee4\u62ff\u5230\u5f53\u524d\u6709\u54ea\u4e9b\u7aef\u53e3\u5728\u76d1\u542c\uff0c\u5982\u679c8080\u5728\u76d1\u542c\uff0c\u5c31\u8bbe\u7f6evalue=1\uff0c\u6c47\u62a5\u7ed9transfer\uff0c\u5982\u679c\u53d1\u73b08081\u6ca1\u5728\u76d1\u542c\uff0c\u5c31\u8bbe\u7f6evalue=0\uff0c\u6c47\u62a5\u7ed9transfer\u3002\r\n\r\n# \u8fdb\u7a0b\u76d1\u63a7\r\nname\u662f\u4ece\/proc\/$pid\/status\u6587\u4ef6\u91c7\u96c6\u7684\uff0ccmdline\u662f\u4ece\/proc\/$pid\/cmdline\u91c7\u96c6\u7684\u3002\u8fd9\u4e2a\u6587\u4ef6\u5b58\u653e\u7684\u662f\u4f60\u542f\u52a8\u8fdb\u7a0b\u7684\u65f6\u5019\u7528\u5230\u7684\u547d\u4ee4\uff0c\u6bd4\u5982\u4f60\u7528java -c uic.properties\u542f\u52a8\u4e86\u4e00\u4e2aJava\u8fdb\u7a0b\uff0c\u8fdb\u7a0b\u540d\u662fjava\uff0c\u5176\u5b9e\u6240\u6709\u7684java\u8fdb\u7a0b\uff0c\u8fdb\u7a0b\u540d\u90fd\u662fjava\uff0c\u90a3\u6211\u4eec\u662f\u6ca1\u6cd5\u901a\u8fc7name\u5b57\u6bb5\u505a\u533a\u5206\u7684\u3002\u600e\u4e48\u529e\u5462\uff1f\u6b64\u65f6\u5c31\u8981\u6c42\u52a9\u4e8e\u8fd9\u4e2a\/proc\/$pid\/cmdline\u6587\u4ef6\u7684\u5185\u5bb9\u4e86\u3002\r\n\r\n\u542c\u8d77\u6765\u662f\u4e0d\u662f\u633a\u590d\u6742\u7684\uff1f\u5475\u5475\uff0c\u5982\u679c\u4f60\u7684\u8fdb\u7a0b\u6709\u7aef\u53e3\u5728\u76d1\u542c\uff0c\u5c31\u914d\u7f6e\u4e00\u4e2a\u7aef\u53e3\u76d1\u63a7\u5c31\u53ef\u4ee5\u4e86\uff0c\u65e0\u9700\u65e2\u914d\u7f6e\u7aef\u53e3\u76d1\u63a7\u3001\u53c8\u914d\u7f6e\u8fdb\u7a0b\u76d1\u63a7\uff0c\u6bd5\u7adf\u5982\u679c\u8fdb\u7a0b\u6302\u4e86\uff0c\u7aef\u53e3\u80af\u5b9a\u5c31\u4e0d\u4f1a\u76d1\u542c\u4e86\u3002\r\n<\/pre>\n<p>==<\/p>\n<p>\u9664\u4e86\u4f7f\u7528\u4e0a\u9762\u7684\u5de5\u5177\u4e4b\u5916\uff0c\u5176\u5b9e\u81ea\u5df1\u4e5f\u53ef\u4ee5\u5199\u4e00\u4e2alow\u4e00\u70b9\u7684\uff0c\u6bd4\u5982\uff1a<\/p>\n<ul>\n<li>\u7528C\u8bed\u8a00\u5148fork()\u518dwaitpid()\uff0c\u5982\u679c\u6709\u8fd4\u56de\u5219\u8bf4\u660e\u8fdb\u7a0b\u6302\u6389\u4e86\uff0c\u5219\u8fdb\u884c\u901a\u77e5\u5e76\u518d\u6b21\u5c06\u8fdb\u7a0b\u62c9\u8d77\uff1b<\/li>\n<li>\u5199\u4e2acrontab\u4efb\u52a1\uff0c\u5b9a\u671f\u68c0\u67e5\uff1b<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u4e0a\u9762\u8bf4\u7684\u662f\u4e00\u4e9b\u5de5\u5177\u548c\u65b9\u6cd5\uff0c\u539f\u7406\u57fa\u672c\u4e0a\u90fd\u662f\u6839\u636e\u8fdb\u7a0b\u540d\u53bb\/proc\u76ee\u5f55\u4e0b\u67e5\u627e\u3001\u6bd4\u5bf9status\/cmdline\u8fd9\u4e9b\u6587\u4ef6\uff0c\u5982\u679c\u68c0\u67e5\u7684\u65f6\u5019\u6709\uff0c\u5219\u8bf4\u660e\u8fdb\u7a0b\u8fd8\u5b58\u6d3b\uff1b\u5982\u679c\u68c0\u67e5\u7684\u65f6\u5019\u6ca1\u6709\uff0c\u5219\u8bf4\u660e\u8fdb\u7a0b\u6302\u6389\u4e86\u3002<\/p>\n<p>\u6709\u4e0d\u5c11\u5730\u65b9\u9700\u8981\u7528\u5230\u8fd9\u4e9b\u7279\u6027\uff1a<\/p>\n<ul>\n<li>\u76d1\u63a7\u91cd\u8981\u8fdb\u7a0b\u7684\u542f\u505c\u60c5\u51b5\uff08\u6bd4\u5982\uff1arsyslogd\u2026\u2026\uff09\uff0c\u8981\u5b9e\u73b0\u5b89\u5168\uff0c\u9996\u5148\u9700\u8981\u6709\u8db3\u591f\u5f3a\u7684\u611f\u77e5\u80fd\u529b\uff1b<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h5 id=\"id-\u6a21\u677f-\u53c2\u8003\u94fe\u63a5\uff1a\">\u53c2\u8003\u94fe\u63a5\uff1a<\/h5>\n<ul>\n<li><a href=\"https:\/\/github.com\/kostya\/eye\">Process monitoring tool. Inspired from Bluepill and God. (Ruby)<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/bluepill-rb\/bluepill\">simple process monitoring tool (Ruby)<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/mojombo\/god\">Ruby process monitor<\/a><br \/>\n<a href=\"http:\/\/godrb.com\/\">http:\/\/godrb.com\/<\/a><\/li>\n<li><a href=\"http:\/\/book.open-falcon.org\/zh\/usage\/proc-port-monitor.html\">Open-Falcon<\/a><\/li>\n<li><a href=\"http:\/\/noops.me\/?p=133\">God\u8fdb\u7a0b\u76d1\u63a7\u6846\u67b6<\/a><\/li>\n<\/ul>\n<p>=END=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u7f18\u7531\uff1a \u5f88\u65e9\u4e4b\u524d\u5c31\u60f3\u4e86\u89e3\u7684\u4e00\u4e2a\u95ee\u9898\uff0c\u81ea\u5df1\u4e5f\u591a\u5c11\u77e5\u9053\u4e00\u4e9b\u65b9\u6cd5\uff0c\u4f46\u603b\u89c9\u5f97\u5e94\u8be5\u6709\u591a\u79cd\u5b9e\u73b0\u65b9\u5f0f\/\u65b9\u6cd5\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,11,12],"tags":[589,1138,30,646],"class_list":["post-3939","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-linux","category-tools","tag-proc","tag-falcon","tag-linux","tag-pid"],"views":12706,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=3939"}],"version-history":[{"count":2,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3939\/revisions"}],"predecessor-version":[{"id":3943,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3939\/revisions\/3943"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=3939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=3939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=3939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}