Glanceway Glanceway
すべてのソース

Service Health Check

開発者 v1.0.0

Monitor service endpoints and get notified when they go down

@codytseng #monitoring #health-check

Install and configure this source

  1. Install Glanceway and open it on your Mac before using the install link above.
  2. Choose Install in Glanceway. If the browser cannot open the app, download the .gwsrc file and import it through source management.
  3. Complete the required fields below, save, and choose a refresh interval. Check the source after its first successful fetch.

Configuration checklist

  • URLS — Required. URLs to monitor (e.g. https://example.com) Add each value as a separate list item.

If items are missing

  • Verify the field names, list entries, and credentials against the current version’s configuration table. Sample values below are examples, not active credentials.
  • Check network access and upstream service availability. Authentication failures and rate limits can prevent a refresh; use a slower interval when the provider limits requests.
  • An empty result can also mean there are no matching items. Fetched content and update timing depend on the provider and source implementation.

設定項目

名前 キー タイプ 必須 デフォルト 説明
Service URLs URLS list はい — URLs to monitor (e.g. https://example.com)

ソースコード

id: codytseng/service-health-check
version: 1.0.0
name: Service Health Check
description: Monitor service endpoints and get notified when they go down
author: codytseng
author_url: https://github.com/codytseng
category: Developer
tags:
  - monitoring
  - health-check

config:
  - key: URLS
    name: Service URLs
    type: list
    required: true
    description: URLs to monitor (e.g. https://example.com)
module.exports = async (api) => {
  const urls = api.config.get("URLS");

  async function fetchData() {
    if (!urls || urls.length === 0) return;

    const previousDownUrls = new Set(
      JSON.parse(api.storage.get("downUrls") ?? `[]`),
    );
    const currentDownUrls = new Set();

    await Promise.allSettled(
      urls.map(async (url) => {
        const res = await api.fetch(url);
        if (!res.ok) {
          currentDownUrls.add(url);
          if (!previousDownUrls.has(url)) {
            api.emit([
              {
                id: `${url}-${Date.now()}`,
                title: `Failed to fetch ${url}`,
                subtitle: `HTTP ${res.status}, error: ${res.error || "unknown"}`,
                url,
                timestamp: Date.now(),
              },
            ]);
          }
        }
      }),
    );

    // Store the current down URLs for the next refresh
    api.storage.set("downUrls", JSON.stringify(Array.from(currentDownUrls)));
  }

  await fetchData();

  return {
    refresh: fetchData,
  };
};

関連ソース