参考

https://github.com/eidam/cf-workers-status-page

依赖

1
2
3
cloudflare 账号
GitHub 账号
GitHub Secrets 配置

开始

一键部署cloudflare

Deploy to Cloudflare Workers

配置 GitHub Action

GitHub repository > Settings > Secrets

Token选编辑 Cloudflare Workers,区域资源包括所有,区域账号包括你自己账号。

1
2
CF_API_TOKEN afaljsdfjalsjd11 (https://dash.cloudflare.com/profile/api-tokens)
CF_ACCOUNT_ID d6265287978826049fad0ec9b2bb5111 (Workers 帐户 ID)

配置参数 config.yaml

在根文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
settings:
title: 'Status Page'
url: 'https://status-page.eidam.dev' # used for Slack messages
logo: logo-192x192.png # image in ./public/ folder
daysInHistogram: 90 # number of days you want to display in histogram
collectResponseTimes: true # collects avg response times from CRON locations

allmonitorsOperational: 'All Systems Operational'
notAllmonitorsOperational: 'Not All Systems Operational'
monitorLabelOperational: 'Operational'
monitorLabelNotOperational: 'Not Operational'
monitorLabelNoData: 'No data'
dayInHistogramNoData: 'No data'
dayInHistogramOperational: 'All good'
dayInHistogramNotOperational: ' incident(s)' # xx incident(s) recorded

monitors:
- id: blog-weilining-cf
name: The weilining Blog
url: 'https://blog.weilining.cf/'
method: GET
expectStatus: 200

- id: workers-cloudflare-com # unique identifier
name: workers.cloudflare.com
description: 'You write code. They handle the rest.' # default=empty
url: 'https://workers.cloudflare.com/' # URL to fetch
method: GET # default=GET
expectStatus: 200 # operational status, default=200
followRedirect: false # should fetch follow redirects, default=false

- id: www-cloudflare-com
name: www.cloudflare.com
description: 'Built for anything connected to the Internet.'
url: 'https://www.cloudflare.com'
method: GET
expectStatus: 200

- id: blog-cloudflare-com
name: The Cloudflare Blog
url: 'https://blog.cloudflare.com/'
method: GET
expectStatus: 200

Cloudflare完成设置

编辑完config.yaml,你的 GitHub Action便会跑起来,等几分钟即可完成cloud flare一键设置,然后进入到你的Worker dash,点第一个Workers即可进入监视