{"id":247845,"date":"2022-07-27T10:34:26","date_gmt":"2022-07-27T02:34:26","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=247845"},"modified":"2022-07-22T10:39:07","modified_gmt":"2022-07-22T02:39:07","slug":"microservice-monitoring","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/microservice-monitoring.html","title":{"rendered":"\u600e\u6837\u76d1\u6d4b\u5fae\u578b\u7684\u7f51\u7ad9\u670d\u52a1"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6700\u7ec8\u6211\u610f\u8bc6\u5230\uff0c\u6211\u6240\u8981\u5199\u7684\u4efb\u4f55\u670d\u52a1\u5668\u7684\u98ce\u9669\u90fd\u5f88\u4f4e\uff0c\u5982\u679c\u5b83\u4eec\u5076\u5c14\u5b95\u673a 2 \u5c0f\u65f6\u4e5f\u6ca1\u4ec0\u4e48\u5927\u4e0d\u4e86\u7684\uff0c\u6211\u53ea\u9700\u8bbe\u7f6e\u4e00\u4e9b\u975e\u5e38\u7b80\u5355\u7684\u76d1\u63a7\u6765\u5e2e\u52a9\u5b83\u4eec\u4fdd\u6301\u8fd0\u884c\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u4f60\u597d! \u6211\u6700\u8fd1\u53c8\u5f00\u59cb\u8fd0\u884c\u4e00\u4e9b\u670d\u52a1\u5668\uff08\u200b\u200bnginx playground\u200b\u200b\u200b\u3001\u200b\u200bmess with dns\u200b\u200b\u200b\u3001\u200b\u200bdns lookup\u200b\u200b\uff09\uff0c\u6240\u4ee5\u6211\u4e00\u76f4\u5728\u8003\u8651\u76d1\u63a7\u95ee\u9898\u3002<\/p>\n

\u6700\u521d\u6211\u5e76\u4e0d\u5b8c\u5168\u6e05\u695a\u5982\u4f55\u76d1\u63a7\u8fd9\u4e9b\u7f51\u7ad9\uff0c\u6240\u4ee5\u6211\u60f3\u5feb\u901f\u5199\u4e0b\u6211\u662f\u5982\u4f55\u505a\u5230\u7684\u3002<\/p>\n

\u6211\u6839\u672c\u4e0d\u6253\u7b97\u8c08\u5982\u4f55\u76d1\u63a7\u5927\u578b\u7684\u3001\u4e25\u8083\u7684\u5173\u952e\u4efb\u52a1\u7f51\u7ad9\uff0c\u53ea\u8c08\u5fae\u578b\u7684\u4e0d\u91cd\u8981\u7684\u7f51\u7ad9\u3002<\/p>\n

\"\"<\/p>\n

\u76ee\u6807\uff1a\u5728\u64cd\u4f5c\u4e0a\u51e0\u4e4e\u4e0d\u82b1\u65f6\u95f4<\/strong><\/div>\n

\u6211\u5e0c\u671b\u7f51\u7ad9\u5927\u90e8\u5206\u65f6\u95f4\u90fd\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u4f46\u6211\u4e5f\u5e0c\u671b\u4e0d\u7528\u5728\u6301\u7eed\u7684\u8fd0\u8425\u4e0a\u82b1\u8d39\u65f6\u95f4\u3002<\/p>\n

\u6211\u6700\u521d\u5bf9\u8fd0\u884c\u670d\u52a1\u5668\u975e\u5e38\u8b66\u60d5\uff0c\u56e0\u4e3a\u5728\u6211\u7684\u4e0a\u4e00\u4efd\u5de5\u4f5c\u4e2d\uff0c\u6211\u662f 24\/7 \u8f6e\u6d41\u503c\u73ed\uff0c\u8d1f\u8d23\u4e00\u4e9b\u5173\u952e\u7684\u670d\u52a1\uff0c\u5728\u6211\u7684\u5370\u8c61\u4e2d\uff0c\u201c\u8d1f\u8d23\u670d\u52a1\u5668\u201d\u610f\u5473\u7740\u201c\u5728\u51cc\u6668 2 \u70b9\u88ab\u53eb\u8d77\u6765\u4fee\u7406\u670d\u52a1\u5668\u201d\u548c\u201c\u6709\u5f88\u591a\u590d\u6742\u7684\u4eea\u8868\u76d8\u201d\u3002<\/p>\n

\u6240\u4ee5\u6709\u4e00\u6bb5\u65f6\u95f4\u6211\u53ea\u505a\u9759\u6001\u7f51\u7ad9\uff0c\u8fd9\u6837\u6211\u5c31\u4e0d\u7528\u8003\u8651\u670d\u52a1\u5668\u7684\u95ee\u9898\u3002<\/p>\n

\u4f46\u6700\u7ec8\u6211\u610f\u8bc6\u5230\uff0c\u6211\u6240\u8981\u5199\u7684\u4efb\u4f55\u670d\u52a1\u5668\u7684\u98ce\u9669\u90fd\u5f88\u4f4e\uff0c\u5982\u679c\u5b83\u4eec\u5076\u5c14\u5b95\u673a 2 \u5c0f\u65f6\u4e5f\u6ca1\u4ec0\u4e48\u5927\u4e0d\u4e86\u7684\uff0c\u6211\u53ea\u9700\u8bbe\u7f6e\u4e00\u4e9b\u975e\u5e38\u7b80\u5355\u7684\u76d1\u63a7\u6765\u5e2e\u52a9\u5b83\u4eec\u4fdd\u6301\u8fd0\u884c\u3002<\/p>\n

\u6ca1\u6709\u76d1\u63a7\u5f88\u7cdf\u7cd5<\/strong><\/div>\n

\u8d77\u521d\uff0c\u6211\u6839\u672c\u6ca1\u6709\u4e3a\u6211\u7684\u670d\u52a1\u5668\u8bbe\u7f6e\u4efb\u4f55\u76d1\u63a7\u3002\u8fd9\u6837\u505a\u7684\u7ed3\u679c\u662f\u975e\u5e38\u53ef\u9884\u89c1\u7684\uff1a\u6709\u65f6\u7f51\u7ad9\u574f\u4e86\uff0c\u800c\u6211\u5374\u6ca1\u6709\u53d1\u73b0\uff0c\u76f4\u5230\u6709\u4eba\u544a\u8bc9\u6211\uff01<\/p>\n

\u6b65\u9aa4 1\uff1auptime \u68c0\u67e5\u5668<\/strong><\/span><\/div>\n

\u7b2c\u4e00\u6b65\u662f\u5efa\u7acb\u4e00\u4e2a uptime \u68c0\u67e5\u5668\u3002\u5916\u9762\u6709\u5f88\u591a\u8fd9\u6837\u7684\u4e1c\u897f\uff0c\u6211\u73b0\u5728\u4f7f\u7528\u7684\u662f \u200b\u200bupdown.io\u200b\u200b \u548c \u200b\u200buptime robot\u200b\u200b\u3002\u6211\u66f4\u559c\u6b22 updown \u7684\u7528\u6237\u754c\u9762\u548c \u200b\u200b\u5b9a\u4ef7\u200b\u200b \u7ed3\u6784\uff08\u5b83\u662f\u6309\u8bf7\u6c42\u800c\u4e0d\u662f\u6309\u6708\u6536\u8d39\uff09\uff0c\u4f46 uptime \u673a\u5668\u4eba\u6709\u4e00\u4e2a\u66f4\u6177\u6168\u7684\u514d\u8d39\u5957\u9910\u3002<\/p>\n

\u5b83\u4eec\u4f1a\uff1a<\/p>\n

    \n\u68c0\u67e5\u7f51\u7ad9\u662f\u5426\u6b63\u5e38
    \n\u5982\u679c\u51fa\u73b0\u6545\u969c\uff0c\u5b83\u4f1a\u7ed9\u6211\u53d1\u7535\u5b50\u90ae\u4ef6\n<\/ol>\n

    \u6211\u53d1\u73b0\u7535\u5b50\u90ae\u4ef6\u901a\u77e5\u5bf9\u6211\u6765\u8bf4\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u901a\u77e5\u7ea7\u522b\uff0c\u5982\u679c\u7f51\u7ad9\u5b95\u673a\uff0c\u6211\u4f1a\u5f88\u5feb\u53d1\u73b0\uff0c\u4f46\u5b83\u4e0d\u4f1a\u5435\u9192\u6211\u6216\u505a\u5176\u5b83\u7684\u4ec0\u4e48\u6253\u6270\u3002<\/p>\n

    \u6b65\u9aa4 2\uff1a\u7aef\u5230\u7aef\u7684\u5065\u5eb7\u68c0\u67e5<\/strong><\/span><\/div>\n

    \u63a5\u4e0b\u6765\uff0c\u8ba9\u6211\u4eec\u8c08\u8c08\u201c\u68c0\u67e5\u7f51\u7ad9\u662f\u5426\u6b63\u5e38\u201d\u5230\u5e95\u662f\u4ec0\u4e48\u610f\u601d\u3002<\/p>\n

    \u8d77\u521d\uff0c\u6211\u53ea\u662f\u628a\u6211\u7684\u5065\u5eb7\u68c0\u67e5\u7aef\u70b9\u4e4b\u4e00\u53d8\u6210\u4e00\u4e2a\u51fd\u6570\uff0c\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u8fd4\u56de \u200b\u200b200 OK\u200b\u200b\u3002<\/p>\n

    \u8fd9\u5012\u662f\u633a\u6709\u7528\u7684 \u2013 \u5b83\u544a\u8bc9\u6211\u670d\u52a1\u5668\u662f\u542f\u52a8\u7740\u7684\uff01<\/p>\n

    \u4f46\u4e0d\u51fa\u6240\u6599\uff0c\u6211\u9047\u5230\u4e86\u95ee\u9898\uff0c\u56e0\u4e3a\u5b83\u6ca1\u6709\u68c0\u67e5 API \u662f\u5426\u771f\u7684\u5728 \u5de5\u4f5c \u2013 \u6709\u65f6\u5065\u5eb7\u68c0\u67e5\u6210\u529f\u4e86\uff0c\u5c3d\u7ba1\u670d\u52a1\u7684\u5176\u4ed6\u90e8\u5206\u5b9e\u9645\u4e0a\u5df2\u7ecf\u8fdb\u5165\u4e86\u4e00\u4e2a\u7cdf\u7cd5\u7684\u72b6\u6001\u3002<\/p>\n

    \u6240\u4ee5\u6211\u66f4\u65b0\u4e86\u5b83\uff0c\u8ba9\u5b83\u771f\u6b63\u5730\u53d1\u51fa API \u8bf7\u6c42\uff0c\u5e76\u786e\u4fdd\u5b83\u6210\u529f\u4e86\u3002<\/p>\n

    \u6211\u6240\u6709\u7684\u670d\u52a1\u90fd\u53ea\u505a\u4e86\u5f88\u5c11\u7684\u4e8b\u60c5\uff08nginx playground \u53ea\u6709\u4e00\u4e2a\u7aef\u70b9\uff09\uff0c\u6240\u4ee5\u8bbe\u7f6e\u4e00\u4e2a\u5065\u5eb7\u68c0\u67e5\u662f\u975e\u5e38\u5bb9\u6613\u7684\uff0c\u5b83\u5b9e\u9645\u4e0a\u8d2f\u7a7f\u4e86\u670d\u52a1\u5e94\u8be5\u505a\u7684\u5927\u90e8\u5206\u52a8\u4f5c\u3002<\/p>\n

    \u4e0b\u9762\u662f nginx playground \u7684\u7aef\u5230\u7aef\u5065\u5eb7\u68c0\u67e5\u5904\u7406\u7a0b\u5e8f\u7684\u6837\u5b50\u3002\u5b83\u975e\u5e38\u57fa\u672c\uff1a\u5b83\u53ea\u662f\u53d1\u51fa\u4e00\u4e2a POST \u8bf7\u6c42\uff08\u7ed9\u81ea\u5df1\uff09\uff0c\u5e76\u68c0\u67e5\u8be5\u8bf7\u6c42\u662f\u6210\u529f\u8fd8\u662f\u5931\u8d25\u3002<\/p>\n

    \r\n        func healthHandler(w http.ResponseWriter, r *http.Request) {\r\n            \/\/ make a request to localhost:8080 with `healthcheckJSON` as the body\r\n            \/\/ if it works, return 200\r\n            \/\/ if it doesn't, return 500\r\n            client := http.Client{}\r\n            resp, err := client.Post(\"http:\/\/localhost:8080\/\", \"application\/json\", strings.NewReader(healthcheckJSON))\r\n            if err != nil {\r\n                log.Println(err)\r\n                w.WriteHeader(http.StatusInternalServerError)\r\n                return\r\n            }\r\n            if resp.StatusCode != http.StatusOK {\r\n                log.Println(resp.StatusCode)\r\n                w.WriteHeader(http.StatusInternalServerError)\r\n                return\r\n            }\r\n            w.WriteHeader(http.StatusOK)\r\n        }\r\n\r\n<\/pre>\n

    \u73b0\u5728\uff0c\u6211\u5927\u90e8\u5206\u5065\u5eb7\u68c0\u67e5\u6bcf\u5c0f\u65f6\u8fd0\u884c\u4e00\u6b21\uff0c\u6709\u4e9b\u6bcf 30 \u5206\u949f\u8fd0\u884c\u4e00\u6b21\u3002<\/p>\n

    \u6211\u6bcf\u5c0f\u65f6\u8fd0\u884c\u4e00\u6b21\uff0c\u56e0\u4e3a \u200b\u200bupdown.io\u200b\u200b \u7684\u5b9a\u4ef7\u662f\u6309\u5065\u5eb7\u68c0\u67e5\u6b21\u6570\u8ba1\u7b97\u7684\uff0c\u6211\u6b63\u5728\u76d1\u63a7 18 \u4e2a\u4e0d\u540c\u7684 URL\uff0c\u800c\u4e14\u6211\u60f3\u628a\u6211\u7684\u5065\u5eb7\u68c0\u67e5\u9884\u7b97\u4fdd\u6301\u5728 5 \u7f8e\u5143\/\u5e74\u7684\u6700\u4f4e\u6c34\u5e73\u3002<\/p>\n

    \u82b1\u4e00\u4e2a\u5c0f\u65f6\u6765\u53d1\u73b0\u8fd9\u4e9b\u7f51\u7ad9\u4e2d\u7684\u4e00\u4e2a\u51fa\u73b0\u6545\u969c\uff0c\u5bf9\u6211\u6765\u8bf4\u662f\u53ef\u4ee5\u7684 \u2013 \u5982\u679c\u6709\u95ee\u9898\uff0c\u6211\u4e5f\u4e0d\u80fd\u4fdd\u8bc1\u80fd\u5f88\u5feb\u4fee\u590d\u5b83\u3002<\/p>\n

    \u5982\u679c\u53ef\u4ee5\u66f4\u9891\u7e41\u5730\u8fd0\u884c\u5b83\u4eec\uff0c\u6211\u53ef\u80fd\u4f1a\u6bcf 5-10 \u5206\u949f\u8fd0\u884c\u4e00\u6b21\u3002<\/p>\n

    \u6b65\u9aa4 3\uff1a\u7b2c\u4e09\u6b65\uff1a\u5982\u679c\u5065\u5eb7\u68c0\u67e5\u5931\u8d25\uff0c\u81ea\u52a8\u91cd\u65b0\u542f\u52a8<\/strong><\/span><\/div>\n

    \u6211\u7684\u4e00\u4e9b\u7f51\u7ad9\u5728 \u200b\u200bfly.io\u200b\u200b \u4e0a\uff0cfly \u6709\u4e00\u4e2a\u76f8\u5f53\u6807\u51c6\u7684\u529f\u80fd\uff0c\u6211\u53ef\u4ee5\u4e3a\u4e00\u4e2a\u670d\u52a1\u914d\u7f6e\u4e00\u4e2a HTTP \u5065\u5eb7\u68c0\u67e5\uff0c\u5982\u679c\u5065\u5eb7\u68c0\u67e5\u5931\u8d25\uff0c\u5c31\u91cd\u65b0\u542f\u52a8\u670d\u52a1\u3002<\/p>\n

    \u201c\u7ecf\u5e38\u91cd\u542f\u201d\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u7b56\u7565\u6765\u5f25\u8865\u6211\u5c1a\u672a\u4fee\u590d\u7684 bug\uff0c\u6709\u4e00\u6bb5\u65f6\u95f4\uff0cnginx playground \u6709\u4e00\u4e2a\u8fdb\u7a0b\u6cc4\u6f0f\uff0c\u200b\u200bnginx\u200b\u200b \u8fdb\u7a0b\u6ca1\u6709\u88ab\u7ec8\u6b62\uff0c\u6240\u4ee5\u670d\u52a1\u5668\u7684\u5185\u5b58\u4e00\u76f4\u5728\u8017\u5c3d\u3002<\/p>\n

    \u901a\u8fc7\u5065\u5eb7\u68c0\u67e5\uff0c\u5176\u7ed3\u679c\u662f\uff0c\u6bcf\u9694\u4e00\u5929\u5de6\u53f3\u5c31\u4f1a\u53d1\u751f\u8fd9\u6837\u7684\u60c5\u51b5\uff1a<\/p>\n

      \n\u670d\u52a1\u5668\u7684\u5185\u5b58\u7528\u5b8c\u4e86
      \n\u5065\u5eb7\u68c0\u67e5\u5f00\u59cb\u5931\u8d25
      \n\u5b83\u88ab\u91cd\u65b0\u542f\u52a8
      \n\u4e00\u5207\u53c8\u6b63\u5e38\u4e86
      \n\u51e0\u4e2a\u5c0f\u65f6\u540e\u518d\u6b21\u91cd\u590d\u6574\u4e2a\u4f20\u5947\n<\/ol>\n

      \u6700\u7ec8\uff0c\u6211\u5f00\u59cb\u5b9e\u9645\u4fee\u590d\u8fdb\u7a0b\u6cc4\u6f0f\uff0c\u4f46\u5f88\u9ad8\u5174\u6709\u4e00\u4e2a\u89e3\u51b3\u65b9\u6cd5\u53ef\u4ee5\u5728\u6211\u62d6\u5ef6\u4fee\u590d bug \u65f6\u4fdd\u6301\u8fd0\u884c\u3002<\/p>\n

      \u8fd9\u4e9b\u7528\u4e8e\u51b3\u5b9a\u662f\u5426\u91cd\u65b0\u542f\u52a8\u670d\u52a1\u7684\u8fd0\u884c\u72b6\u51b5\u68c0\u67e5\u66f4\u9891\u7e41\u5730\u8fd0\u884c\uff1a\u6bcf 5 \u5206\u949f\u5de6\u53f3\u3002<\/p>\n

      \u8fd9\u4e0d\u662f\u76d1\u63a7\u5927\u578b\u670d\u52a1\u7684\u6700\u4f73\u65b9\u5f0f<\/strong><\/span><\/div>\n

      \u8fd9\u53ef\u80fd\u5f88\u660e\u663e\uff0c\u6211\u5728\u4e00\u5f00\u59cb\u5c31\u5df2\u7ecf\u8bf4\u8fc7\u4e86\uff0c\u4f46\u662f\u201c\u7f16\u5199\u4e00\u4e2a HTTP \u5065\u5eb7\u68c0\u67e5\u201d\u5e76\u4e0d\u662f\u76d1\u63a7\u5927\u578b\u590d\u6742\u670d\u52a1\u7684\u6700\u4f73\u65b9\u6cd5\u3002 \u4f46\u6211\u4e0d\u4f1a\u6df1\u5165\u8ba8\u8bba\uff0c\u56e0\u4e3a\u8fd9\u4e0d\u662f\u8fd9\u7bc7\u6587\u7ae0\u7684\u4e3b\u9898\u3002<\/p>\n

      \u5230\u76ee\u524d\u4e3a\u6b62\u4e00\u76f4\u8fd0\u884c\u826f\u597d\uff01<\/strong><\/span><\/div>\n

      \u6211\u6700\u521d\u5728 3 \u4e2a\u6708\u524d\u7684\u56db\u6708\u5199\u4e86\u8fd9\u7bc7\u6587\u7ae0\uff0c\u4f46\u6211\u4e00\u76f4\u7b49\u5230\u73b0\u5728\u624d\u53d1\u5e03\u5b83\u4ee5\u786e\u4fdd\u6574\u4e2a\u8bbe\u7f6e\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n

      \u8fd9\u5e26\u6765\u4e86\u5f88\u5927\u7684\u4e0d\u540c \u2013 \u5728\u6211\u9047\u5230\u4e00\u4e9b\u975e\u5e38\u611a\u8822\u7684\u505c\u673a\u95ee\u9898\u4e4b\u524d\uff0c\u73b0\u5728\u5728\u8fc7\u53bb\u7684\u51e0\u4e2a\u6708\u91cc\uff0c\u7f51\u7ad9\u7684\u8fd0\u884c\u65f6\u95f4\u8fbe\u5230\u4e86 99.95%\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

      \u4f60\u597d! \u6211\u6700\u8fd1\u53c8\u5f00\u59cb\u8fd0\u884c\u4e00\u4e9b\u670d\u52a1\u5668\uff08\u200b\u200bnginx playground\u200b\u200b\u200b\u3001\u200b\u200bmess with dns […]<\/p>\n","protected":false},"author":370,"featured_media":198179,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-247845","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/247845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/370"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=247845"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/247845\/revisions"}],"predecessor-version":[{"id":247849,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/247845\/revisions\/247849"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/198179"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=247845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=247845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=247845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}