### Detailed Monitor Configuration Example Source: https://github.com/lyc8503/uptimeflare/wiki/Configuration A comprehensive example of a single monitor's configuration, detailing optional fields for advanced settings like timeouts, headers, and response validation. ```typescript { // `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 method: 'POST', // `target` is a valid URL target: 'https://example.com', // [OPTIONAL] `tooltip` is ONLY used at status page to show a tooltip tooltip: 'This is a tooltip for this monitor', // [OPTIONAL] `statusPageLink` is ONLY used for clickable link at status page statusPageLink: 'https://example.com', // [OPTIONAL] `hideLatencyChart` will hide status page latency chart if set to true hideLatencyChart: false, // [OPTIONAL] `expectedCodes` is an array of acceptable HTTP response codes, if not specified, default to 2xx expectedCodes: [200], // [OPTIONAL] `timeout` in millisecond, if not specified, default to 10000 timeout: 10000, // [OPTIONAL] headers to be sent headers: { 'User-Agent': 'Uptimeflare', Authorization: 'Bearer YOUR_TOKEN_HERE', }, // [OPTIONAL] body to be sent body: 'Hello, world!', // [OPTIONAL] if specified, the response must contains the keyword to be considered as operational. responseKeyword: 'success', // [OPTIONAL] if specified, the response must NOT contains the keyword to be considered as operational. responseForbiddenKeyword: 'bad gateway', // [OPTIONAL] if specified, will call the check proxy to check the monitor, mainly for geo-specific checks // refer to docs https://github.com/lyc8503/UptimeFlare/wiki/Check-proxy-setup before setting this value checkProxy: 'https://xxx.example.com OR worker://weur', // [OPTIONAL] if true, the check will fallback to local if the specified proxy is down checkProxyFallback: true, } ``` -------------------------------- ### Get Data Source: https://github.com/lyc8503/uptimeflare/wiki/Fetch-data-in-JSON-format Retrieves the current status of all monitors, including overall uptime and individual monitor details. ```APIDOC ## GET /api/data ### Description Fetches system status data in JSON format, including overall uptime and individual monitor states. ### Method GET ### Endpoint /api/data ### Response #### Success Response (200) - **up** (integer) - The number of currently up monitors. - **down** (integer) - The number of currently down monitors. - **updatedAt** (integer) - The timestamp of the last data update. - **monitors** (object) - An object containing the status of each individual monitor. - **[monitor_id]** (object) - Details for a specific monitor. - **up** (boolean) - The current status of the monitor (true for up, false for down). - **latency** (integer) - The latency recorded at the last monitor check. - **location** (string) - The datacenter location used for the last monitor check. - **message** (string) - The status message (e.g., "OK" or an error description). ### Response Example { "up": 6, "down": 1, "updatedAt": 1719764731, "monitors": { "www": { "up": true, "latency": 65, "location": "SIN", "message": "OK" }, "homelab": { "up": false, "latency": 1896, "location": "SJC", "message": "HTTP response doesn't contain the configured keyword" } } } ``` -------------------------------- ### Deploy Node.js Check Proxy on VPS Source: https://github.com/lyc8503/uptimeflare/wiki/Check-proxy-setup Steps to clone the UptimeFlare proxy, install dependencies, and run the Node.js API on a Linux server. This exposes an HTTP service on port 3000. ```bash git clone https://github.com/lyc8503/UptimeFlare cd UptimeFlare/proxy npm install node api/index.js ``` -------------------------------- ### Globalping Proxy Configuration with Region Filter Source: https://github.com/lyc8503/uptimeflare/wiki/Check-proxy-setup Specify a region for Globalping monitoring using the 'magic' parameter. For example, to use a probe from mainland China (CN), append '?magic=CN'. ```javascript { id: 'google', name: 'Google', method: 'GET', target: 'https://www.google.com/', checkProxy: 'globalping://abcdef123456/?magic=CN' } ``` -------------------------------- ### Worker Monitoring Configuration Source: https://github.com/lyc8503/uptimeflare/wiki/Configuration Set up password protection for your status page and define monitors. Includes examples for HTTP GET and TCP PING methods. ```typescript const workerConfig: WorkerConfig = { passwordProtection: 'username:password', monitors: [ { id: 'foo_monitor', name: 'My API Monitor', method: 'GET', target: 'https://www.google.com' }, { id: 'test_tcp_monitor', name: 'Example TCP Monitor', method: 'TCP_PING', target: '1.2.3.4:22' }, // You can continue to define more monitors here... ], notification: { //... }, } ``` -------------------------------- ### Configure a Scheduled Maintenance Event Source: https://github.com/lyc8503/uptimeflare/wiki/Configuration Example of how to configure a single scheduled maintenance event. Multiple events can be added without deleting previous ones. Ensure start time is provided; end time is optional. ```typescript const maintenances: MaintenanceConfig[] = [ { // [Optional] Monitor IDs to be affected by this maintenance monitors: ['foo_monitor', 'bar_monitor'], // [Optional] default to "Scheduled Maintenance" if not specified title: 'Test Maintenance', // Description of the maintenance, will be shown at status page body: 'This is a test maintenance, server software upgrade', // Start time of the maintenance, in UNIX timestamp or ISO 8601 format start: '2025-04-27T00:00:00+08:00', // [Optional] end time of the maintenance, in UNIX timestamp or ISO 8601 format // if not specified, the maintenance will be considered as on-going end: '2025-04-30T00:00:00+08:00', // [Optional] color of the maintenance alert at status page, default to "yellow" color: 'blue', }, } ``` -------------------------------- ### JSON Response Structure for Monitor Data Source: https://github.com/lyc8503/uptimeflare/wiki/Fetch-data-in-JSON-format This is an example of the JSON response received from the /api/data endpoint. It details the overall status of monitors and individual monitor details including latency and location. ```json { "up": 6, // There're currently 6 up monitors... "down": 1, // ...and 1 down monitors "updatedAt": 1719764731, // Last updated timestamp "monitors": { "www": { // Key is `id` in config "up": true, // Current status (boolean) "latency": 65, // Latency at last monitor "location": "SIN", // Datacenter used at last monitor "message": "OK" // Description of current status (Error message in case of DOWN) }, "homelab": { "up": false, "latency": 1896, "location": "SJC", "message": "HTTP response doesn't contain the configured keyword" }, "//......" } } ``` -------------------------------- ### Apprise Webhook Configuration for Matrix Source: https://github.com/lyc8503/uptimeflare/wiki/Setup-notification Configure UptimeFlare to use Apprise for notifications, particularly useful if your notification channel lacks direct HTTPS API support or if you prefer this method. This example shows configuration for Matrix notifications. ```typescript webhook: { url: 'https://testapprise-lyc8503s-projects.vercel.app/notify', payloadType: 'json', payload: { urls: 'matrix://{user}:{password}@{matrixhost}/#{room_alias}', body: '$MSG' }, } ``` -------------------------------- ### Globalping Proxy Configuration with Multiple Filters and URL Encoding Source: https://github.com/lyc8503/uptimeflare/wiki/Check-proxy-setup Combine multiple filters for Globalping probes, such as network type and city. Special characters like '+' must be URL-encoded. Example: 'CN+shanghai+eyeball-network'. ```javascript { id: 'google', name: 'Google', method: 'GET', target: 'https://www.google.com/', checkProxy: 'globalping://abcdef123456/?magic=CN%2Bshanghai%2Beyeball-network' } ``` -------------------------------- ### Filtering Cloudflare IP Ranges Source: https://github.com/lyc8503/uptimeflare/wiki/Geo-specific-checks-setup Filters a CSV file to find Cloudflare IP ranges associated with a specific country and ASN. This helps identify potential geo-specific IPs for worker setup. ```bash grep '^8\.[0-9]*\.[0-9]*\.0,.*AS13335' country_asn.csv ``` -------------------------------- ### Globalping Experimental Proxy Configuration Source: https://github.com/lyc8503/uptimeflare/wiki/Check-proxy-setup Use Globalping for worldwide monitoring probes. Obtain a token from Globalping and use it with the 'globalping://' prefix. Note that 'checkProxyFallback' and HTTP POST monitoring are not supported with this option. ```javascript { id: 'google', name: 'Google', method: 'GET', target: 'https://www.google.com/', checkProxy: 'globalping://abcdef123456/' } ``` -------------------------------- ### Globalping Proxy Configuration for IPv6 Target Source: https://github.com/lyc8503/uptimeflare/wiki/Check-proxy-setup When monitoring an IPv6-only target, manually specify 'ipVersion' as 6 to select a compatible Globalping probe. Failure to do so may result in DNS lookup errors. ```javascript { id: 'google', name: 'Google', method: 'GET', target: 'https://www.google.com/', checkProxy: 'globalping://abcdef123456/?magic=CN&ipVersion=6' } ``` -------------------------------- ### Status Page Configuration Source: https://github.com/lyc8503/uptimeflare/wiki/Configuration Configure the title and links for your status page. Links can be highlighted. ```typescript const pageConfig: PageConfig = { title: "lyc8503's Status Page", links: [ { link: 'https://github.com/lyc8503', label: 'GitHub' }, { link: 'https://blog.lyc8503.site/', label: 'Blog' }, { link: 'mailto:me@lyc8503.site', label: 'Email Me', highlight: true }, ], } ``` -------------------------------- ### Initialize MaintenanceConfig Array Source: https://github.com/lyc8503/uptimeflare/wiki/Configuration This is a required line for the Scheduled Maintenance feature, even if not actively used. It ensures the deployment does not fail. ```typescript const maintenances: MaintenanceConfig[] = [] ``` -------------------------------- ### Pushover Custom Webhook Configuration Source: https://github.com/lyc8503/uptimeflare/wiki/Setup-notification Configure a webhook for Pushover notifications using its API endpoint and an x-www-form-urlencoded payload. Replace 'YOUR_TOKEN_HERE' and 'YOUR_USER_KEY' with your actual Pushover credentials. ```typescript webhook: { url: 'https://api.pushover.net/1/messages.json', payloadType: 'x-www-form-urlencoded', payload: { token: 'YOUR_TOKEN_HERE', user: 'YOUR_USER_KEY', message: '$MSG', }, } ``` -------------------------------- ### Scan for Live Hosts with Nmap Source: https://github.com/lyc8503/uptimeflare/wiki/Geo-specific-checks-setup Use Nmap to perform a ping scan on a /24 subnet to identify active IP addresses. This is useful for discovering available hosts in a specific geographic region before configuring Cloudflare. ```bash root@server:~# nmap -sP 8.34.201.0/24 Starting Nmap 7.80 ( https://nmap.org ) at 2023-12-08 14:57 CST Nmap scan report for 8.34.201.1 Host is up (0.12s latency). Nmap scan report for 8.34.201.3 Host is up (0.10s latency). Nmap scan report for 8.34.201.5 Host is up (0.12s latency). Nmap scan report for 8.34.201.6 Host is up (0.11s latency). Nmap scan report for 8.34.201.7 Host is up (0.10s latency). Nmap scan report for 8.34.201.8 Host is up (0.10s latency). Nmap scan report for 8.34.201.9 Host is up (0.10s latency). Nmap scan report for 8.34.201.10 Host is up (0.10s latency). Nmap scan report for 8.34.201.11 Host is up (0.12s latency). Nmap scan report for 8.34.201.12 Host is up (0.11s latency). Nmap done: 256 IP addresses (10 hosts up) scanned in 6.22 seconds ``` -------------------------------- ### Wecom Bot (Wechat) Custom Webhook Configuration Source: https://github.com/lyc8503/uptimeflare/wiki/Setup-notification Set up a webhook for Wecom Bot (Wechat) notifications using its specific API endpoint and a JSON payload. Obtain the webhook URL by following the provided documentation. ```typescript webhook: { url: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=abcd', payloadType: 'json', payload: { msgtype: 'text', text: { content: '$MSG' } } } ``` -------------------------------- ### Scanning IP Range with Nmap Source: https://github.com/lyc8503/uptimeflare/wiki/Geo-specific-checks-setup Scans a given IP range using Nmap with ICMP ping to identify active hosts. This is used to find available geo-specific IPs within a Cloudflare AS13335 range. ```bash sudo nmap -sP 8.34.71.0/24 ``` -------------------------------- ### Telegram Custom Webhook Configuration Source: https://github.com/lyc8503/uptimeflare/wiki/Setup-notification Configure a webhook for Telegram notifications by providing the Telegram API endpoint URL and the desired payload format. Ensure you have obtained your bot token and chat ID from Telegram. ```typescript webhook: { url: 'https://api.telegram.org/bot123456:ABCDEF/sendMessage', payloadType: 'param', payload: { chat_id: 5678, text: '$MSG' }, } ``` -------------------------------- ### Cloudflare Durable Objects Proxy Configuration Source: https://github.com/lyc8503/uptimeflare/wiki/Check-proxy-setup Configure UptimeFlare to use Cloudflare Durable Objects for geo-specific monitoring. Select a Cloudflare location and use its parameter prefixed with 'worker://'. ```javascript { id: 'google', name: 'Google', method: 'GET', target: 'https://www.google.com/', checkProxy: 'worker://weur' } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.