{"id":1607,"date":"2024-08-21T22:17:02","date_gmt":"2024-08-21T14:17:02","guid":{"rendered":"https:\/\/muidar.com\/blog\/?p=1607"},"modified":"2026-08-05T23:15:03","modified_gmt":"2026-08-05T15:15:03","slug":"monitor-websites-with-uptimeflare","status":"publish","type":"post","link":"https:\/\/muidar.com\/blog\/posts\/cmuidar\/monitor-websites-with-uptimeflare\/","title":{"rendered":"\u4f7f\u7528Uptimeflare\u76d1\u63a7\u7f51\u7ad9"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Uptimeflare\u53ef\u4ee5\u901a\u8fc7GitHub Actions\u81ea\u52a8\u521b\u5efa\u4e00\u4e2aKV\u7a7a\u95f4\u548cCloudflare Pages\uff0c\u4f7f\u7528Cloudflare\u7684\u8282\u70b9\u6765\u76d1\u63a7\u7f51\u7ad9\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7Telegram\u53d1\u901a\u77e5\u3002Repo\u4fe1\u606f\u5728\u4e0b\u65b9\u5361\u7247\u4e2d\u3002<\/p>\n\n\n\n<div class=\"wp-block-argon-github github-info-card card shadow-sm github-info-card-mini is-style-github-info-card-mini\" data-author=\"lyc8503\" data-project=\"UptimeFlare\"><div class=\"github-info-card-header\"><a href=\"https:\/\/github.com\/\" target=\"_blank\" title=\"Github\" rel=\"noopener\"><span><i class=\"fa fa-github\"><\/i>\u00a0GitHub<\/span><\/a><\/div><div class=\"github-info-card-body\"><div class=\"github-info-card-name-a\"><a href=\"https:\/\/github.com\/lyc8503\/UptimeFlare\" target=\"_blank\" rel=\"noopener\"><span class=\"github-info-card-name\">lyc8503\/UptimeFlare<\/span><\/a><\/div><div class=\"github-info-card-description\"><\/div><\/div><div class=\"github-info-card-bottom\"><span class=\"github-info-card-meta github-info-card-meta-stars\"><i class=\"fa fa-star\"><\/i>\u00a0<span class=\"github-info-card-stars\"><\/span><\/span><span class=\"github-info-card-meta github-info-card-meta-forks\"><i class=\"fa fa-code-fork\"><\/i>\u00a0<span class=\"github-info-card-forks\"><\/span><\/span><\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u7684\u6f14\u793a\u9875\u9762\u5728\u6b64\uff1a<a href=\"https:\/\/uptimeflare-ix4.pages.dev\/\" target=\"_blank\" rel=\"noreferrer noopener\">uptimeflare-ix4.pages.dev<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6253\u5f00GitHub\u4e4b\u540e\uff0c\u70b9\u51fb\u201cUse this template\u201d\u6309\u94ae\uff0c\u5e76\u201ccreate a new repository\u201d\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='\/wp-content\/uploads\/2024\/08\/image-1024x467.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"467\" data-original=\"\/wp-content\/uploads\/2024\/08\/image-1024x467.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-1621\" style=\"width:595px\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Repo name\u968f\u4fbf\u586b\uff0c\u4e0d\u548c\u4f60\u5176\u5b83\u7684repo\u91cd\u540d\u5c31\u884c\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5efa\u8bae\u9009\u62e9Private\uff0c\u6bd5\u7adf\u4f60\u4e0d\u60f3\u8ba9\u4f60\u7684\u670d\u52a1\u5668ip\u516c\u793a\u4e8e\u4f17\uff0c\u4e0d\u662f\u5417\uff1f<br>\u5982\u679c\u4f60\u4ec5\u4ec5\u76d1\u63a7\u7f51\u7ad9\u90a3\u5c31\u65e0\u6240\u8c13\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u5b9e\u73b0\u81ea\u52a8\u521b\u5efaWorkers\u548cKV\u7684\u529f\u80fd\uff0c\u6211\u4eec\u5148\u5f97\u5230<a href=\"https:\/\/dash.cloudflare.com\/profile\/api-tokens\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Cloudflare\u7528\u6237API\u4ee4\u724c<\/a>\u8fd9\u91cc\u521b\u5efa\u4e00\u4e2aToken\u3002<br>\u70b9\u51fb\u521b\u5efa\u4ee4\u724c\u540e\uff0c\u9009\u62e9\u201c\u7f16\u8f91 Cloudflare Workers\u201d\u3002\u4e4b\u540e\uff0c\u8d26\u6237\u8d44\u6e90\u3001\u533a\u57df\u8d44\u6e90\u5206\u522b\u9009\u62e9\u6240\u6709\u8d26\u6237\u3001\u6240\u6709\u533a\u57df\u5373\u53ef\u3002\u6700\u540e\u70b9\u51fb\u201c\u7ee7\u7eed\u4ee5\u663e\u793a\u6458\u8981\u201d\uff0c\u518d\u70b9\u51fb\u201c\u521b\u5efa\u4ee4\u724c\u201d\uff0c\u4fdd\u5b58\u597dtoken\uff0c\u4ee5\u514d\u4e22\u5931\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='\/wp-content\/uploads\/2024\/08\/image-1-1024x467.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"467\" data-original=\"\/wp-content\/uploads\/2024\/08\/image-1-1024x467.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-1623\" style=\"width:690px;height:auto\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u56de\u5230\u9879\u76ee\u9875\u9762\uff0c\u6253\u5f00Settings&gt;Secrets and variables&gt;Actions\uff0c\u518d\u70b9\u51fb\u65b0\u5efarepo secret\u3002<br>Name\u586b\u5199CLOUDFLARE_API_TOKEN\uff0cSecret\u586b\u5199\u521a\u521a\u5728Cloudflare\u521b\u5efa\u7684API\u4ee4\u724c\uff0c\u7136\u540e\u70b9\u201cAdd secret\u201d\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='\/wp-content\/uploads\/2024\/08\/image-2.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"767\" height=\"448\" data-original=\"\/wp-content\/uploads\/2024\/08\/image-2.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-1626\" style=\"width:580px\"  sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u9700\u8981\u901a\u8fc7\u4fee\u6539uptime.config.ts\u6765\u76d1\u63a7\u81ea\u5df1\u7684\u7f51\u7ad9\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">HTTP\u8bf7\u6c42\u9ed8\u8ba4\u572818-47\u884c\uff0c\u89e3\u91ca\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n      \/\/ `id` should be unique, history will be kept if the `id` remains constant\n      id: 'foo_monitor',\n      \/\/ `name` is used at status page and callback message \u663e\u793a\u5728\u72b6\u6001\u4e0a\u65b9\u7684\u540d\u79f0\n      name: 'My API Monitor',\n      \/\/ `method` should be a valid HTTP Method \u53ef\u4ee5\u662fPOST GET\u7b49\n      method: 'POST',\n      \/\/ `target` is a valid URL \u7f51\u5740\n      target: 'https:\/\/example.com',\n      \/\/ &#91;OPTIONAL] `tooltip` is ONLY used at status page to show a tooltip \u5bf9\u4e8e\u7f51\u7ad9\u7684\u63cf\u8ff0\n      tooltip: 'This is a tooltip for this monitor',\n      \/\/ &#91;OPTIONAL] `statusPageLink` is ONLY used for clickable link at status page\n      statusPageLink: 'https:\/\/example.com',\n      \/\/ &#91;OPTIONAL] `expectedCodes` is an array of acceptable HTTP response codes, if not specified, default to 2xx\n      expectedCodes: &#91;200],\n      \/\/ &#91;OPTIONAL] `timeout` in millisecond, if not specified, default to 10000\n      timeout: 10000,\n      \/\/ &#91;OPTIONAL] headers to be sent\n      headers: {\n        'User-Agent': 'Uptimeflare', \/\/ \u8bbe\u7f6e\u7528\u6237\u4ee3\u7406\uff0c\u7528\u4e8e\u5f00\u9632\u706b\u5899\n        Authorization: 'Bearer YOUR_TOKEN_HERE', \/\/ \u8fd9\u4e00\u884c\u53ef\u4ee5\u6ce8\u91ca\u6389\uff0c\u7528\u4e8eAPI\u9a8c\u8bc1\n      },\n      \/\/ &#91;OPTIONAL] body to be sent\n      body: 'Hello, world!', \/\/ \u8fd9\u884c\u53ef\u4ee5\u6ce8\u91ca\u6389\uff0c\u7528\u4e8eAPI\n      \/\/ &#91;OPTIONAL] if specified, the response must contains the keyword to be considered as operational.\n      responseKeyword: 'success', \/\/\u8fd9\u884c\u4e0d\u7528\u4e8eAPI\u7684\u8bdd\u5fc5\u987b\u6ce8\u91ca\u6389\uff0c\u4e0d\u7136\u65e0\u6cd5\u6b63\u5e38\u4f7f\u7528\n      \/\/ &#91;OPTIONAL] if specified, the check will run in your specified region,\n      \/\/ refer to docs https:\/\/github.com\/lyc8503\/UptimeFlare\/wiki\/Geo-specific-checks-setup before setting this value\n      checkLocationWorkerRoute: 'https:\/\/xxx.example.com', \/\/ \u8fd9\u4e2a\u53ef\u4ee5\u770b\u6587\u6863\uff0c\u611f\u89c9\u7528\u4e0d\u4e0a\u6ce8\u91ca\u6389\u5c31\u884c\u4e86\n    },<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6539\u5b8c\u4ee5\u540e\uff0c\u6211\u7684\u957f\u8fd9\u6837\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n      id: 'weblog',\n      name: 'My Weblog',\n      method: 'POST',\n      target: 'https:\/\/muidar.com',\n      tooltip: 'This is my weblog',\n      statusPageLink: 'https:\/\/muidar.com',\n      expectedCodes: &#91;200],\n      timeout: 10000,\n      headers: {\n        'User-Agent': 'Uptimeflare 114514',\n      },\n    },<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">TCP_PING\u7684\u683c\u5f0f\u957f\u8fd9\u4e2a\u6837\uff0c\u572850-59\u884c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> \/\/ Example TCP Monitor\n    {\n      id: 'test_tcp_monitor',\n      name: 'Example TCP Monitor',\n      \/\/ `method` should be `TCP_PING` for tcp monitors \u5fc5\u987b\u586bTCP_PING\n      method: 'TCP_PING',\n      \/\/ `target` should be `host:port` for tcp monitors \u683c\u5f0f\u4e3aIP:\u7aef\u53e3\n      target: '1.2.3.4:22',\n      tooltip: 'My production server SSH', \/\/ \u6807\u9898\n      statusPageLink: 'https:\/\/example.com', \/\/ \u6807\u9898\u8df3\u8f6c\u5230\u7684\u94fe\u63a5\n      timeout: 5000,\n    },<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u6539\u597d\u540e\u957f\u8fd9\u4e2a\u6837\u5b50\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n      id: 'tcp_HK',\n      name: 'RooVPS HK',\n      \/\/ `method` should be `TCP_PING` for tcp monitors\n      method: 'TCP_PING',\n      \/\/ `target` should be `host:port` for tcp monitors\n      target: 'xx.xx.xx.xx:80',\n      tooltip: 'My Hongkong Server',\n      statusPageLink: 'https:\/\/roovps.com',\n      timeout: 5000,\n    },\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b49\u4f60\u6539\u597d\u5e76\u4fdd\u5b58\u4ee5\u540e\uff0c\u4ee3\u7801\u5c31\u4f1a\u4f7f\u7528Actions\u81ea\u52a8\u5728Cloudflare\u521b\u5efaWorkers\u3002\u6253\u5f00\u5728\u7528\u6237\u754c\u9762&gt;\u5de6\u680f&gt;Workers &amp; Pages\uff0c\u4f60\u4f1a\u53d1\u73b0\u591a\u4e86\u4e24\u4e2a\u4e1c\u897f\uff0c\u4e00\u4e2a\u662fuptimeflare\u53e6\u4e00\u4e2a\u662fuptimeflare_workers\u3002<br>Uptimeflare\u4e2d\u4e0b\u8fb9\u4f1a\u6807\u6ce8\u51fa\u63d0\u4f9b\u8bbf\u95ee\u7684pages.dev\u5730\u5740\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u60f3\u8981\u81ea\u5b9a\u4e49\u57df\u540d\uff0c\u53ef\u4ee5\u70b9\u8fdb\u53bb\uff0c\u627e\u5230Custom domains\uff0c\u7136\u540e\u70b9\u51fb\u201cSet up a custom domain\u201d\uff0c\u6839\u636eCloudflare\u7684\u6307\u793a\uff0c\u6dfb\u52a0CNAME\u7b49\u5f85\u89e3\u6790\u751f\u6548\u5373\u53ef\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='\/wp-content\/uploads\/2024\/08\/image-3-1024x664.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"664\" data-original=\"\/wp-content\/uploads\/2024\/08\/image-3-1024x664.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-1631\" style=\"width:634px;height:auto\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Uptimeflare\u53ef\u4ee5\u901a\u8fc7GitHub Actions\u81ea\u52a8\u521b\u5efa\u4e00\u4e2aKV\u7a7a\u95f4\u548cCloudflare Page [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[103,84],"tags":[134,130,132,131],"class_list":["post-1607","post","type-post","status-publish","format-standard","hentry","category-cloudflare","category-mtools","tag-cloudflare","tag-uptimeflare","tag-132","tag-monitor"],"_links":{"self":[{"href":"https:\/\/muidar.com\/blog\/wp-json\/wp\/v2\/posts\/1607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/muidar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/muidar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/muidar.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/muidar.com\/blog\/wp-json\/wp\/v2\/comments?post=1607"}],"version-history":[{"count":13,"href":"https:\/\/muidar.com\/blog\/wp-json\/wp\/v2\/posts\/1607\/revisions"}],"predecessor-version":[{"id":1974,"href":"https:\/\/muidar.com\/blog\/wp-json\/wp\/v2\/posts\/1607\/revisions\/1974"}],"wp:attachment":[{"href":"https:\/\/muidar.com\/blog\/wp-json\/wp\/v2\/media?parent=1607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/muidar.com\/blog\/wp-json\/wp\/v2\/categories?post=1607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/muidar.com\/blog\/wp-json\/wp\/v2\/tags?post=1607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}