caarlos0 / domain_exporter

Exports the expiration time of your domains as prometheus metrics.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need to reduce request rate

karabanov opened this issue · comments

I need to monitor the status of quite a large number of domains, and therefore domain_exporter makes a lot of requests to the WHOIS server, which entails blocking:

domain-exporter  | 11:07AM ERR failed to probe {xxxxxx.ru } error="could not parse whois response:
You are not allowed to connect due to excessive querying of the WHOIS database.
See https://tcinet.ru/documents/whois_ru_rf.pdf (in Russian)
https://tcinet.ru/documents/whois_su.pdf (in Russian) for details.

Is it possible to limit domain_exporter to the number of requests per unit of time so that it does not overload the WHOIS service?

I remembered that in the Prometheus config you can configure the scrape_interval - I specified 20 minutes and this solved the problem:

  - job_name: 'domain_exporter'
    scrape_interval: 20m
    scrape_timeout: 15m
    metrics_path: /probe
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: domain-exporter:9222  # The domain exporter's real hostname:port.
    static_configs:
      - targets:
        - xxxxxx.ru
        - ...