From 381104cbc1d1ef5afcc9fb70158b11a2bdb5e51c Mon Sep 17 00:00:00 2001 From: Antonis Kouzoupis Date: Fri, 14 Mar 2025 08:56:38 +0100 Subject: [PATCH] Update instructions for exporting Prometheus metrics (#446) --- .../admin/monitoring/export-metrics.md | 122 ++++++++++++------ 1 file changed, 83 insertions(+), 39 deletions(-) diff --git a/docs/setup_installation/admin/monitoring/export-metrics.md b/docs/setup_installation/admin/monitoring/export-metrics.md index 26d10e794..dd94d72fc 100644 --- a/docs/setup_installation/admin/monitoring/export-metrics.md +++ b/docs/setup_installation/admin/monitoring/export-metrics.md @@ -2,78 +2,122 @@ ## Introduction Hopsworks services produce metrics which are centrally gathered by [Prometheus](https://prometheus.io/) and visualized in [Grafana](../grafana). -Although the system is self-contained, it is possible to export these metrics to third-party services or another Prometheus instance. +Although the system is self-contained, it is possible for another *federated* Prometheus instance to scrape these metrics or directly push them to another system. This is useful if you have a centralized monitoring system with already configured alerts. ## Prerequisites -In order to configure Prometheus to export metrics you need `root` SSH access to either Hopsworks or to the target server depending on the export method you choose below. +In order to configure Prometheus to export metrics you need to have the right to change the remote Prometheus configuration. ## Exporting metrics Prometheus can be configured to export metrics to another Prometheus instance (cross-service federation) or to a custom service which knows how to handle them. ### Prometheus federation -Prometheus servers can be federated to scale better or to just clone all metrics (cross-service federation). Prometheus federation is well [documented](https://prometheus.io/docs/prometheus/latest/federation/#cross-service-federation) -but there are some specificities to Hopsworks. +Prometheus servers can be federated to scale better or to just clone all metrics (cross-service federation). In the guide below we assume **Prometheus A** is the service running in Hopsworks and **Prometheus B** is the server you want to clone metrics to. #### Step 1 -**Prometheus B** needs to be able to connect to TCP port `9089` of **Prometheus B** to scrape metrics. If you have any firewall (or Security Group) in place, allow ingress for that port. +**Prometheus B** needs to be able to connect to TCP port `9090` of **Prometheus A** to scrape metrics. If you have any firewall (or Security Group) in place, allow ingress for that port. #### Step 2 -SSH into **Prometheus B** server, edit Prometheus configuration file and add the following under the `scrape_configs` +The next step is to expose **Prometheus A** running inside Hopsworks Kubernetes cluster. If **Prometheus B** has direct access to **Prometheus A** then you can skip this step. + +We will create a Kubernetes *Service* of type *LoadBalancer* to expose port `9090` + +!!!Warning + If you need to apply custom **annotations**, then modify the Manifest below + The example below assumes Hopsworks is **installed** at Namespace *hopsworks* + +```bash +kubectl apply -f - <