{"id":6809,"date":"2020-05-10T21:15:31","date_gmt":"2020-05-10T13:15:31","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=6809"},"modified":"2020-05-10T21:15:32","modified_gmt":"2020-05-10T13:15:32","slug":"tsar","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/tsar","title":{"rendered":"tsar\u547d\u4ee4 – \u6536\u96c6\u670d\u52a1\u5668\u7cfb\u7edf\u4fe1\u606f"},"content":{"rendered":"\n

tsar\u662f\u6dd8\u5b9d\u81ea\u5df1\u5f00\u53d1\u7684\u4e00\u4e2a\u91c7\u96c6\u5de5\u5177\uff08\u7c7b\u4f3c\u4e8esar\u5de5\u5177\uff09\uff0c\u4e3b\u8981\u7528\u6765\u6536\u96c6\u670d\u52a1\u5668\u7684\u7cfb\u7edf\u4fe1\u606f\uff08\u5982cpu\uff0cio\uff0cmem\uff0ctcp\u7b49\uff09\uff0c\u4ee5\u53ca\u5e94\u7528\u6570\u636e\uff08\u5982squid haproxy nginx\u7b49\uff09\u3002<\/p>\n\n\n\n

\u6536\u96c6\u5230\u7684\u6570\u636e\u5b58\u50a8\u5728\u78c1\u76d8\u4e0a\uff0c\u53ef\u4ee5\u968f\u65f6\u67e5\u8be2\u5386\u53f2\u4fe1\u606f\uff0c\u8f93\u51fa\u65b9\u5f0f\u7075\u6d3b\u591a\u6837\uff0c\u53e6\u5916\u652f\u6301\u5c06\u6570\u636e\u5b58\u50a8\u5230mysql\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u5c06\u6570\u636e\u53d1\u9001\u5230nagios\u62a5\u8b66\u670d\u52a1\u5668\u3002<\/p>\n\n\n\n

tsar\u5728\u5c55\u793a\u6570\u636e\u65f6\uff0c\u53ef\u4ee5\u6307\u5b9a\u6a21\u5757\uff0c\u5e76\u4e14\u53ef\u4ee5\u5bf9\u591a\u6761\u4fe1\u606f\u7684\u6570\u636e\u8fdb\u884cmerge<\/em>\u8f93\u51fa\uff0c\u5e26-live\u53c2\u6570\u53ef\u4ee5\u8f93\u51fa\u79d2\u7ea7\u7684\u5b9e\u65f6\u4fe1\u606f\u3002<\/p>\n\n\n\n

tsar\u662f\u57fa\u4e8e\u6a21\u5757\u5316\u8bbe\u8ba1\u7684\u7a0b\u5e8f\uff0c\u7a0b\u5e8f\u6709\u4e24\u90e8\u5206\u7ec4\u6210\uff1a\u6846\u67b6\u548c\u6a21\u5757\u3002
\u6846\u67b6\u7a0b\u5e8f\u6e90\u4ee3\u7801\u4e3b\u8981\u5728src\u76ee\u5f55\uff0c\u800c\u6a21\u5757\u6e90\u4ee3\u7801\u4e3b\u8981\u5728modules\u76ee\u5f55\u4e2d\u3002
\u6846\u67b6\u63d0\u4f9b\u5bf9\u914d\u7f6e\u6587\u4ef6\u7684\u89e3\u6790\uff0c\u6a21\u5757\u7684\u52a0\u8f7d\uff0c\u547d\u4ee4\u884c\u53c2\u6570\u7684\u89e3\u6790\uff0c\u5e94\u7528\u6a21\u5757\u7684\u63a5\u53e3\u5bf9\u6a21\u5757\u539f\u59cb\u6570\u636e\u7684\u89e3\u6790\u4e0e\u8f93\u51fa\u3002 \u6a21\u5757\u63d0\u4f9b\u63a5\u53e3\u7ed9\u6846\u67b6\u8c03\u7528\u3002
tsar\u4f9d\u8d56\u4e0ecron\u6bcf\u5206\u949f\u6267\u884c\u91c7\u96c6\u6570\u636e\uff0c\u56e0\u6b64\u5b83\u9700\u8981\u7cfb\u7edf\u5b89\u88c5\u5e76\u542f\u7528crond\uff0c\u5b89\u88c5\u540e\uff0ctsar\u6bcf\u5206\u949f\u4f1a\u6267\u884ctsar \u2013cron\u6765\u5b9a\u65f6\u91c7\u96c6\u4fe1\u606f\uff0c\u5e76\u4e14\u8bb0\u5f55\u5230\u539f\u59cb\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>tsar [\u53c2\u6570]<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-check<\/td>\u67e5\u770b\u6700\u540e\u4e00\u6b21\u7684\u91c7\u96c6\u6570\u636e<\/td><\/tr>
--check\/-C<\/td>\u67e5\u770b\u6700\u540e\u4e00\u6b21tsar\u7684\u63d0\u9192\u4fe1\u606f<\/td><\/tr>
--cron\/-c<\/td>\u4f7f\u7528crond\u6a21\u5f0f\u6765\u8fdb\u884ctsar\u76d1\u63a7<\/td><\/tr>
--interval\/-i<\/td>\u6307\u660etsar\u7684\u95f4\u9694\u65f6\u95f4\uff0c\u9ed8\u8ba4\u5355\u4f4d\u5206\u949f,\u5e26\u4e0a--live\u53c2\u6570\u5219\u5355\u4f4d\u662f\u79d2<\/td><\/tr>
--list\/-L<\/td>\u5217\u51fa\u542f\u7528\u7684\u6a21\u5757<\/td><\/tr>
--live\/-l<\/td>\u67e5\u770b\u5b9e\u65f6\u6570\u636e<\/td><\/tr>
--file\/-f<\/td>\u6307\u5b9a\u8f93\u5165\u6587\u4ef6<\/td><\/tr>
--ndays\/-n<\/td>\u6307\u5b9a\u8fc7\u53bb\u7684\u6570\u636e\u5929\u6570\uff0c\u9ed8\u8ba41\u5929<\/td><\/tr>
--date\/-d<\/td>\u6307\u5b9a\u65e5\u671f,YYYYMMDD\u6216\u8005n\u4ee3\u8868n\u5929\u524d<\/td><\/tr>
--detail\/-D<\/td>\u80fd\u591f\u6307\u5b9a\u67e5\u770b\u4e3b\u8981\u5b57\u6bb5\u8fd8\u662f\u6a21\u5757\u7684\u6240\u6709\u5b57\u6bb5<\/td><\/tr>
--cpu<\/td>\u5217\u51facpu\u76f8\u5173\u7684\u76d1\u63a7\u8ba1\u6570<\/td><\/tr>
--tcp<\/td>TCP \u534f\u8bae IPV4\u7684\u4f7f\u7528\u60c5\u51b5<\/td><\/tr>
--mem<\/td>\u7269\u7406\u5185\u5b58\u7684\u4f7f\u7528\u60c5\u51b5<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/p>\n\n\n\n

cpu\u76d1\u63a7\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# tsar --cpu<\/pre>\n\n\n\n

\u76d1\u63a7\u865a\u5b58\u548cload\u60c5\u51b5\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# tsar --swap --load<\/pre>\n\n\n\n

\u5217\u51fa\u7cfb\u7edf\u5185\u5b58\u7684\u4f7f\u7528\u60c5\u51b5\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# tsar --mem<\/pre>\n\n\n\n

\u76d1\u63a7\u7cfb\u7edfIO\u60c5\u51b5\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# tsar --io<\/pre>\n\n\n\n

\u5386\u53f2\u6570\u636e\u56de\u6eaf\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# tsar -d 2 -i 1<\/pre>\n","protected":false},"excerpt":{"rendered":"

tsar\u662f\u6dd8\u5b9d\u81ea\u5df1\u5f00\u53d1\u7684\u4e00\u4e2a\u91c7\u96c6\u5de5\u5177\uff08\u7c7b\u4f3c\u4e8esar\u5de5\u5177\uff09\uff0c\u4e3b\u8981\u7528\u6765\u6536\u96c6\u670d\u52a1\u5668\u7684\u7cfb\u7edf\u4fe1\u606f\uff08\u5982cpu\uff0cio\uff0cmem […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6809"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=6809"}],"version-history":[{"count":4,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6809\/revisions"}],"predecessor-version":[{"id":7628,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6809\/revisions\/7628"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=6809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=6809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=6809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}