diff --git a/hc/front/views.py b/hc/front/views.py index d157856f..9d793a4b 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -38,7 +38,13 @@ from hc.api.transports import Telegram from hc.front.decorators import require_setting from hc.front import forms from hc.front.schemas import telegram_callback -from hc.front.templatetags.hc_extras import num_down_title, down_title, sortchecks +from hc.front.templatetags.hc_extras import ( + num_down_title, + down_title, + sortchecks, + site_hostname, + site_scheme, +) from hc.lib import jsonschema from hc.lib.badges import get_badge_url import pytz @@ -282,6 +288,8 @@ def serve_doc(request, doc="introduction"): "{{ default_grace }}": str(int(DEFAULT_GRACE.total_seconds())), "SITE_NAME": settings.SITE_NAME, "SITE_ROOT": settings.SITE_ROOT, + "SITE_HOSTNAME": site_hostname(), + "SITE_SCHEME": site_scheme(), "PING_ENDPOINT": settings.PING_ENDPOINT, "PING_URL": settings.PING_ENDPOINT + "your-uuid-here", "IMG_URL": os.path.join(settings.STATIC_URL, "img/docs"), diff --git a/static/img/docs/prometheus_endpoint.png b/static/img/docs/prometheus_endpoint.png new file mode 100644 index 00000000..4a5ab427 Binary files /dev/null and b/static/img/docs/prometheus_endpoint.png differ diff --git a/templates/docs/configuring_prometheus.html b/templates/docs/configuring_prometheus.html index 31c8ce80..c21a858c 100644 --- a/templates/docs/configuring_prometheus.html +++ b/templates/docs/configuring_prometheus.html @@ -1,20 +1,20 @@

Configuring Prometheus

-

Healthchecks.io supports exporting metrics and check statuses to Prometheus, for use with Grafana.

-

You can generate the metrics export endpoint by going to your project settings (last tab up top) and clicking "Create API Keys". You will then see the link to the prometheus endpoint, which looks like this:

-
https://healthchecks.io/projects/45sd78-eeee-dddd-8888-b25a9887ecfd/metrics/NXyGzks4s8xcF1J-wzoaioyoqXIANGD0
-
- - +

Healthchecks.io supports exporting metrics and check statuses to +Prometheus, for use with Grafana.

+

You can generate the metrics export endpoint by going to your project settings +and clicking "Create API Keys". You will then see the link to +the Prometheus endpoint:

+

Project's API Keys

Update the prometheus.yml

-

You can take that link and add it to the prometheus config:

-
  - job_name: "healthchecks"
-    scrape_interval: 60s
-    scheme: https
-    metrics_path: /projects/45sd78-eeee-dddd-8888-b25a9887ecfd/metrics/NXyGzks4s8xcF1J-wzoaioyoqXIANGD0
-    static_configs:
-      - targets: ["healthchecks.io"]
-
+

You can copy the Prometheus endpoint URL and add it to the Prometheus configuration:

+
  - job_name: "healthchecks"
+    scrape_interval: 60s
+    scheme: SITE_SCHEME
+    metrics_path: /projects/45sd78-eeee-dddd-8888-b25a9887ecfd/metrics/NXyGzks4s8xcF1J-wzoaioyoqXIANGD0
+    static_configs:
+      - targets: ["SITE_HOSTNAME"]
+
-

Notice how we split up the URL and paste in the scheme, domain, and path separately.

-

Reload promethus and your changes should be live, coming in under the hc_ prefix.

\ No newline at end of file +

Notice how we split up the URL and paste in the scheme, domain, and path separately.

+

Reload Prometheus and your changes should be live, coming in under the hc_ prefix.

\ No newline at end of file diff --git a/templates/docs/configuring_prometheus.md b/templates/docs/configuring_prometheus.md index d28aa46f..1d25f8b2 100644 --- a/templates/docs/configuring_prometheus.md +++ b/templates/docs/configuring_prometheus.md @@ -1,26 +1,27 @@ # Configuring Prometheus -Healthchecks.io supports exporting metrics and check statuses to [Prometheus](https://prometheus.io/), for use with [Grafana](https://grafana.com/). +Healthchecks.io supports exporting metrics and check statuses to +[Prometheus](https://prometheus.io/), for use with [Grafana](https://grafana.com/). -You can generate the metrics export endpoint by going to your project settings (last tab up top) and clicking "Create API Keys". You will then see the link to the prometheus endpoint, which looks like this: +You can generate the metrics export endpoint by going to your project settings +and clicking "Create API Keys". You will then see the link to +the Prometheus endpoint: -``` -https://healthchecks.io/projects/45sd78-eeee-dddd-8888-b25a9887ecfd/metrics/NXyGzks4s8xcF1J-wzoaioyoqXIANGD0 -``` +![Project's API Keys](IMG_URL/prometheus_endpoint.png) ## Update the prometheus.yml -You can take that link and add it to the prometheus config: +You can copy the Prometheus endpoint URL and add it to the Prometheus configuration: ```yaml - job_name: "healthchecks" scrape_interval: 60s - scheme: https + scheme: SITE_SCHEME metrics_path: /projects/45sd78-eeee-dddd-8888-b25a9887ecfd/metrics/NXyGzks4s8xcF1J-wzoaioyoqXIANGD0 static_configs: - - targets: ["healthchecks.io"] + - targets: ["SITE_HOSTNAME"] ``` -Notice how we split up the URL and paste in the scheme, domain, and path separately. +Notice how we split up the URL and paste in the scheme, domain, and path separately. -Reload promethus and your changes should be live, coming in under the `hc_` prefix. +Reload Prometheus and your changes should be live, coming in under the `hc_` prefix.