Skip to content

Monitoring

James58899 edited this page Oct 30, 2025 · 8 revisions

To enable the metrics endpoint, you must specify the --enable-metrics parameter,
which will provide metrics on the /metrics path using OpenMetrics text format.

Please note that there are currently no access restrictions, so anyone can access the /metrics path.
This is generally not a problem, as metrics do not contain any sensitive information.
If you would like to have access restrictions, please open an issue to let me know.

Metrics

List of the metrics exported from hath-rust.

Metrics Description
hath_uptime_seconds_total Uptime.
hath_cache_sent_total The number of files sent. (Request count)
hath_cache_sent_size_bytes The size of files sent. (Upload traffic)
hath_cache_sent_duration_seconds Histogram of time spent sending files. (Request latency)
hath_cache_received_total The number of downloads from the image server. (Cache miss count)
hath_cache_received_size_bytes The size of downloads from the image server. (Cache miss traffic)
hath_cache_received_duration_seconds Histogram of download times from the image server. (Proxy latency)
hath_connections The current number of connections.
hath_cache_count The number of cache files.
hath_cache_size_bytes The size of cache files.
hath_cache_capacity_bytes The maximum cache capacity setting.
hath_static_range The number of static ranges that actually contain the file.
hath_download_count_total The number of tasks received by H@H Downloader.
hath_download_file_count_total The number of files successfully downloaded by H@H Downloader.
hath_download_size_bytes The size of files successfully downloaded by H@H Downloader.
hath_download_duration_seconds Histogram of download times for H@H Downloader.

Example

This example uses Docker Compose to run Prometheus and Grafana and collect metrics from hath-rust.
A sample Grafana dashboard is available for download at the end of this page.

Screenshot H@H Status - Dashboards - Grafana

compose.yaml

Example of Docker Compose configuration.

The data will be stored in the Docker Volume and exposed on ports 9090 and 3000.
Please adjust the relevant settings according to your environment.

services:
  prometheus:
    image: prom/prometheus
    restart: unless-stopped
    ports:
      - "9090:9090"
    volumes:
      - type: bind
        source: ./prometheus.yml
        target: /etc/prometheus/prometheus.yml
      - promethous:/prometheus
    command:
      - "--config.file=/etc/prometheus/prometheus.yml"
      - "--storage.tsdb.path=/prometheus"
      - "--storage.tsdb.retention.size=30GB" # Modify to your available disk space
  grafana:
    image: grafana/grafana
    restart: unless-stopped
    ports:
      - "3000:3000"
    volumes:
      - grafana:/var/lib/grafana
    # Uncomment the following section if you want to change Grafana settings (for example, enable anonymous access).
    # environment:
    #   GF_AUTH_ANONYMOUS_ENABLED: "true"
    #   GF_AUTH_ANONYMOUS_HIDE_VERSION: "true"
volumes:
  # Modify this section if you want to change the storage location.
  promethous:
  grafana:

prometheus.yml

Example of Prometheus configuration.

global:
  scrape_interval: 5s # Increase this if Prometheus uses too much storage.
scrape_configs:
  - job_name: hath
    scheme: https
    tls_config:
      insecure_skip_verify: true # Because H@H uses dynamic hostnames, disabling certificate verification is needed.
    static_configs:
      - targets: ["127.0.0.1:443"] # Modify to hath-rust address.
        labels:
          instance: "host1" # The instance label is used for selection and display. It must be unique.

Grafana dashboard

Example: H@H Status.json

For older version

Clone this wiki locally