<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>探针 &#8211; cmWeblog</title>
	<atom:link href="https://www.muidar.com/tags/%E6%8E%A2%E9%92%88/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.muidar.com</link>
	<description></description>
	<lastBuildDate>Sat, 01 Mar 2025 07:09:22 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2025/01/cropped-favicon-512x512-1-32x32.png</url>
	<title>探针 &#8211; cmWeblog</title>
	<link>https://www.muidar.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>使用Uptimeflare监控网站</title>
		<link>https://www.muidar.com/posts/cmuidar/monitor-websites-with-uptimeflare/</link>
					<comments>https://www.muidar.com/posts/cmuidar/monitor-websites-with-uptimeflare/#comments</comments>
		
		<dc:creator><![CDATA[CMuidar]]></dc:creator>
		<pubDate>Wed, 21 Aug 2024 14:17:02 +0000</pubDate>
				<category><![CDATA[Cloudflare]]></category>
		<category><![CDATA[工具]]></category>
		<category><![CDATA[Uptimeflare]]></category>
		<category><![CDATA[探针]]></category>
		<category><![CDATA[监控]]></category>
		<guid isPermaLink="false">https://muidar.com/?p=1607</guid>

					<description><![CDATA[Uptimeflare可以通过GitHub Actions自动创建一个KV空间和Cloudflare Page [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Uptimeflare可以通过GitHub Actions自动创建一个KV空间和Cloudflare Pages，使用Cloudflare的节点来监控网站，还可以通过Telegram发通知。Repo信息在下方卡片中。</p>



<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> GitHub</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> <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> <span class="github-info-card-forks"></span></span></div></div>



<p class="wp-block-paragraph">我的演示页面在此：<a href="https://uptimeflare-ix4.pages.dev/" target="_blank" rel="noreferrer noopener">uptimeflare-ix4.pages.dev</a></p>



<p class="wp-block-paragraph">打开GitHub之后，点击“Use this template”按钮，并“create a new repository”。</p>



<figure class="wp-block-image size-large is-resized"><img fetchpriority="high" decoding="async" width="1024" height="467" src="/wp-content/uploads/2024/08/image-1024x467.png" alt="" class="wp-image-1621" style="width:595px" srcset="/wp-content/uploads/2024/08/image-1024x467.png 1024w, /wp-content/uploads/2024/08/image-300x137.png 300w, /wp-content/uploads/2024/08/image-768x350.png 768w, /wp-content/uploads/2024/08/image-1536x700.png 1536w, /wp-content/uploads/2024/08/image.png 1915w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">Repo name随便填，不和你其它的repo重名就行了。</p>



<p class="wp-block-paragraph">建议选择Private，毕竟你不想让你的服务器ip公示于众，不是吗？<br>如果你仅仅监控网站那就无所谓了。</p>



<p class="wp-block-paragraph">为了实现自动创建Workers和KV的功能，我们先得到<a href="https://dash.cloudflare.com/profile/api-tokens" target="_blank" rel="noreferrer noopener nofollow">Cloudflare用户API令牌</a>这里创建一个Token。<br>点击创建令牌后，选择“编辑 Cloudflare Workers”。之后，账户资源、区域资源分别选择所有账户、所有区域即可。最后点击“继续以显示摘要”，再点击“创建令牌”，保存好token，以免丢失。</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="467" src="/wp-content/uploads/2024/08/image-1-1024x467.png" alt="" class="wp-image-1623" style="width:690px;height:auto" srcset="/wp-content/uploads/2024/08/image-1-1024x467.png 1024w, /wp-content/uploads/2024/08/image-1-300x137.png 300w, /wp-content/uploads/2024/08/image-1-768x351.png 768w, /wp-content/uploads/2024/08/image-1-1536x701.png 1536w, /wp-content/uploads/2024/08/image-1.png 1919w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">回到项目页面，打开Settings&gt;Secrets and variables&gt;Actions，再点击新建repo secret。<br>Name填写CLOUDFLARE_API_TOKEN，Secret填写刚刚在Cloudflare创建的API令牌，然后点“Add secret”。</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="767" height="448" src="/wp-content/uploads/2024/08/image-2.png" alt="" class="wp-image-1626" style="width:580px" srcset="/wp-content/uploads/2024/08/image-2.png 767w, /wp-content/uploads/2024/08/image-2-300x175.png 300w" sizes="(max-width: 767px) 100vw, 767px" /></figure>



<p class="wp-block-paragraph">我们需要通过修改uptime.config.ts来监控自己的网站。</p>



<p class="wp-block-paragraph">HTTP请求默认在18-47行，解释如下。</p>



<pre class="wp-block-code"><code>{
      // `id` should be unique, history will be kept if the `id` remains constant
      id: 'foo_monitor',
      // `name` is used at status page and callback message 显示在状态上方的名称
      name: 'My API Monitor',
      // `method` should be a valid HTTP Method 可以是POST GET等
      method: 'POST',
      // `target` is a valid URL 网址
      target: 'https://example.com',
      // &#91;OPTIONAL] `tooltip` is ONLY used at status page to show a tooltip 对于网站的描述
      tooltip: 'This is a tooltip for this monitor',
      // &#91;OPTIONAL] `statusPageLink` is ONLY used for clickable link at status page
      statusPageLink: 'https://example.com',
      // &#91;OPTIONAL] `expectedCodes` is an array of acceptable HTTP response codes, if not specified, default to 2xx
      expectedCodes: &#91;200],
      // &#91;OPTIONAL] `timeout` in millisecond, if not specified, default to 10000
      timeout: 10000,
      // &#91;OPTIONAL] headers to be sent
      headers: {
        'User-Agent': 'Uptimeflare', // 设置用户代理，用于开防火墙
        Authorization: 'Bearer YOUR_TOKEN_HERE', // 这一行可以注释掉，用于API验证
      },
      // &#91;OPTIONAL] body to be sent
      body: 'Hello, world!', // 这行可以注释掉，用于API
      // &#91;OPTIONAL] if specified, the response must contains the keyword to be considered as operational.
      responseKeyword: 'success', //这行不用于API的话必须注释掉，不然无法正常使用
      // &#91;OPTIONAL] if specified, the check will run in your specified region,
      // refer to docs https://github.com/lyc8503/UptimeFlare/wiki/Geo-specific-checks-setup before setting this value
      checkLocationWorkerRoute: 'https://xxx.example.com', // 这个可以看文档，感觉用不上注释掉就行了
    },</code></pre>



<p class="wp-block-paragraph">改完以后，我的长这样。</p>



<pre class="wp-block-code"><code>{
      id: 'weblog',
      name: 'My Weblog',
      method: 'POST',
      target: 'https://muidar.com',
      tooltip: 'This is my weblog',
      statusPageLink: 'https://muidar.com',
      expectedCodes: &#91;200],
      timeout: 10000,
      headers: {
        'User-Agent': 'Uptimeflare 114514',
      },
    },</code></pre>



<p class="wp-block-paragraph">TCP_PING的格式长这个样，在50-59行。</p>



<pre class="wp-block-code"><code> // Example TCP Monitor
    {
      id: 'test_tcp_monitor',
      name: 'Example TCP Monitor',
      // `method` should be `TCP_PING` for tcp monitors 必须填TCP_PING
      method: 'TCP_PING',
      // `target` should be `host:port` for tcp monitors 格式为IP:端口
      target: '1.2.3.4:22',
      tooltip: 'My production server SSH', // 标题
      statusPageLink: 'https://example.com', // 标题跳转到的链接
      timeout: 5000,
    },</code></pre>



<p class="wp-block-paragraph">我改好后长这个样子：</p>



<pre class="wp-block-code"><code>{
      id: 'tcp_HK',
      name: 'RooVPS HK',
      // `method` should be `TCP_PING` for tcp monitors
      method: 'TCP_PING',
      // `target` should be `host:port` for tcp monitors
      target: 'xx.xx.xx.xx:80',
      tooltip: 'My Hongkong Server',
      statusPageLink: 'https://roovps.com',
      timeout: 5000,
    },
</code></pre>



<p class="wp-block-paragraph">等你改好并保存以后，代码就会使用Actions自动在Cloudflare创建Workers。打开在用户界面&gt;左栏&gt;Workers &amp; Pages，你会发现多了两个东西，一个是uptimeflare另一个是uptimeflare_workers。<br>Uptimeflare中下边会标注出提供访问的pages.dev地址。</p>



<p class="wp-block-paragraph">如果想要自定义域名，可以点进去，找到Custom domains，然后点击“Set up a custom domain”，根据Cloudflare的指示，添加CNAME等待解析生效即可。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="664" src="/wp-content/uploads/2024/08/image-3-1024x664.png" alt="" class="wp-image-1631" style="width:634px;height:auto" srcset="/wp-content/uploads/2024/08/image-3-1024x664.png 1024w, /wp-content/uploads/2024/08/image-3-300x195.png 300w, /wp-content/uploads/2024/08/image-3-768x498.png 768w, /wp-content/uploads/2024/08/image-3.png 1290w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://www.muidar.com/posts/cmuidar/monitor-websites-with-uptimeflare/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

使用页面缓存 Disk: Enhanced 
CDN 全站传输通过 cloudflare
数据库缓存21/31 查询，在0.011秒内使用 Memcached

Served from: muidar.com @ 2026-04-25 20:12:56 by W3 Total Cache
-->