Skip to main content
Where do these monitoring programs run? In Bob’s lab it’s simple: each component is a standalone program he downloads, unpacks, and runs on the same node. Four programs, each listening on its own port, pass metrics and alerts along a clear path. Below we follow a metric from Elasticsearch to an alert receiver and show the configuration and commands Bob used.
A diagram titled "Four Programs, One Node" showing a controlplane node hosting four services: exporter (port 9114), Prometheus (9090), Grafana (3000), and Alertmanager (9093).
Quick reference: components and ports
  1. Elasticsearch exporter Bob starts with the Prometheus exporter for Elasticsearch. He downloads, unpacks, and runs it pointing at his local Elasticsearch instance (listening on port 3200 in this lab):
The exporter serves a metrics endpoint in Prometheus format on port 9114. Among many metrics it exposes are the JVM heap used and the JVM heap max; these two values are used later for alerting.
  1. Prometheus — scraping the exporter Next Bob runs Prometheus and tells it to scrape the exporter. Prometheus’s scrape_configs lists the jobs Prometheus polls; Bob adds an elasticsearch job that points at the exporter:
After starting Prometheus with this config, he verifies the targets from the Prometheus UI (Status → Targets). Both Prometheus itself and the Elasticsearch exporter should show as UP.
A Prometheus Targets status page screenshot showing both the prometheus and elasticsearch targets marked "UP." The entries list http://localhost:9090/metrics and http://localhost:9114/metrics with green UP badges.
  1. Grafana — visualizing metrics Bob installs Grafana and configures a Prometheus datasource that points to http://localhost:9090. Grafana runs on port 3000 and he logs in with the initial credentials admin / admin, then changes the password and adds the datasource.
A dark-themed UI for adding a Prometheus data source, showing the Prometheus option selected and an empty "Prometheus server URL" field. The left sidebar displays Prometheus and Grafana icons and the address bar shows localhost:3000/connections/datasources/new.
From Grafana’s Explore view Bob runs PromQL queries against Prometheus. For example, to see the number of active primary shards in his Elasticsearch cluster:
A stable, flat line indicates a healthy cluster.
  1. Alert rules — detecting high heap usage Because Bob doesn’t watch dashboards 24/7, he defines a Prometheus alert rule to notify him when Elasticsearch heap usage becomes problematic. The rule below computes heap usage as the ratio of used to max JVM memory (exported by the Elasticsearch exporter) and fires if the ratio exceeds a threshold for 2 minutes. For demonstration the threshold is intentionally low (5%) so the alert fires quickly; in production use a higher, realistic threshold.
The 5% threshold is intentionally low for demonstration so the alert fires quickly. In production set a realistic threshold (for example, 90%) and tune the for duration to reduce noisy alerts.
Add the rules file to Prometheus’s configuration:
Prometheus only reloads rule files when its configuration is reloaded. You can either restart Prometheus or trigger a hot-reload using the HTTP endpoint POST /-/reload (recommended when supported). Bob restarted Prometheus in his lab to pick up the changes:
Using kill -9 forcibly terminates a process and can prevent graceful shutdown and data flushing. Prefer a graceful reload (POST /-/reload) or a clean shutdown (kill <pid>), and use kill -9 only as a last resort.
Once the rule evaluates true for the configured for period, Prometheus shows the alert as FIRING in its Alerts page. Prometheus then forwards the alert to an external alert manager for routing and delivery.
  1. Alertmanager — routing alerts to receivers Bob installs Alertmanager and begins with a simple routing configuration that sends alerts to a webhook receiver running locally on port 5001:
He starts Alertmanager and points Prometheus to it (Prometheus alerting configuration should reference Alertmanager’s http://localhost:9093 endpoint). When Alertmanager receives an alert from Prometheus it delivers it to the configured webhook.
A dark infographic titled "The Alert Arrives" showing Prometheus firing an alert to Alertmanager, with a browser window open to localhost:9093/#/alerts and a service endpoint at localhost:5001. The diagram uses Prometheus icons and simple flow arrows to illustrate alert delivery.
  1. Webhook receiver — example notification endpoint For the demo Bob runs a small Python webhook receiver that listens on port 5001 and prints the payload it receives:
In production you would configure Alertmanager to route alerts to real notification systems such as Slack, PagerDuty, email, or other incident platforms. This simple webhook demonstrates the complete path: a metric left Elasticsearch, the exporter exposed it, Prometheus scraped and evaluated it, and Alertmanager delivered the alert to a receiver — all automatically.
A dark-themed infographic titled "That's the Check" showing a row of labeled icons: Elasticsearch, an exporter (purple mascot), Prometheus, Alertmanager, a Receiver (code panel), and a user labeled "Bob."
A few weeks later: from alerts to root cause A few weeks after increasing load and joining more apps, the heap alert begins firing regularly. Rather than restart and hope, Bob shifts from asking “what broke?” to “why is the heap growing?” He combines metrics, logs, and traces to identify the workloads or code changes that caused the growth and implements fixes to prevent future incidents.
An infographic titled "A Few Weeks Later" showing three happy server/process icons on the left and a large stressed process on a red platform in the center. To the right a vertical "Heap" bar is at 90% with a "firing" label and a smiling user avatar labeled "Bob."
References and further reading

Watch Video

Practice Lab