Monitoring self-hosted Medplum: which signals your on-call team needs
Monitoring must cover every layer of a self-hosted Medplum deployment, and it becomes necessary the day the first real users or integrations depend on it, which is well before go-live. Medplum is a Node.js and TypeScript server that uses PostgreSQL as its database and Redis as its cache. When you run it in your own cloud or data center, your team owns the whole path from the load balancer through the application containers to the data stores, and an outage or slow query shows up as a clinical access problem first. Your team owns the stack choice, including the metrics system, alert routing and dashboards. No vendor-provided alert set is assumed here, so the signals below are the ones to confirm and adapt in your own environment.
This page covers four groups of signals: Medplum server metrics, load balancer metrics, PostgreSQL and Redis metrics, and container runtime metrics. For the application tier, decide early whether you will use the optional OpenTelemetry support described in the sibling topic on Medplum metrics and traces, or whether you will scrape signals from other sources. Confirm in the Medplum documentation which metrics the version you deploy actually emits before you write any alert rule, because metric names differ between deployment routes. For the load balancer, you need request counts, target response time and 5xx rates per target group. For the databases and cache, you need connection usage, replication or failover state, and latency, since Medplum waits on these for almost every request.
Plan alerting thresholds from your own load baseline rather than copying numbers from a template. Run a representative load for a few weeks, record normal ranges for each signal, and set warning alerts that fire while there is still time to act, such as a connection pool nearing its limit or a rising error ratio. Reserve paging alerts for conditions that threaten access to records, such as no healthy application targets or a database that cannot accept connections. Also decide who receives each alert, how long your retention must hold metrics for incident review, and where dashboards live so that an on-call engineer can see the full request path in one view. Document these choices in your runbook so the next person on rotation can follow them.
How metrics flow from Medplum components to Prometheus, Alertmanager and Grafana
The diagram starts at the load balancer, the Medplum server instances, PostgreSQL, Redis and the container runtime, which all expose metrics that Prometheus pulls over HTTP. Prometheus evaluates alert rules and sends alerts to Alertmanager, which groups and routes them, and Grafana reads from Prometheus to draw the dashboards the on-call team watches. Prometheus local storage is a single node that is not replicated, so the diagram marks it that way. Remote write to long-term storage is optional and shown separately. Check that every source is scraped and that alerts reach the on-call channel.
Metrics are pulled into one Prometheus node, then routed to alerts and dashboards.
Which metric groups to watch for each layer
The Medplum server is a Node.js and TypeScript service that handles FHIR API requests, authentication, Bots and Subscriptions. Its signals are usually the first to show user-facing trouble, so latency and error rate on the API are the core pair to track. Confirm the exact metric names your deployed version exposes, and whether they come from Medplum's optional OpenTelemetry support, your logs or an exporter you add.
- Request latency: Track percentiles, not averages, per route group such as FHIR search, reads and writes. A rising tail usually points to slow queries or waiting on database connections.
- Error rate: Separate 5xx responses from 4xx responses. A sustained rise in 5xx values signals server or dependency trouble, while a spike in 429 responses points to rate limits being reached.
- Event loop and process saturation: Watch event loop lag and memory use of the Node.js process. A rising lag means the process cannot keep up with incoming work, even when CPU looks acceptable.
- Bot and Subscription execution: Track execution counts, failures and duration for Bots, since a backlog here can slow the rest of the platform.
- Authentication failures: Watch sign-in and token request failures. A sudden increase can reveal an identity provider problem or a client that lost its credentials.
Check that each alert names the route group and the deployed version, so a regression after an upgrade is easy to trace.
The load balancer in front of the Medplum application sees every request before the application does, so it is the best place to measure what clients actually experience. It also shows whether traffic is spread evenly across application instances. Confirm the metric names for your specific load balancer product, since cloud and self-managed options expose different counters.
- Client-facing latency and status codes: Compare the load balancer's view of response time and status codes with the application's view. A gap between them suggests queueing or connection handling outside the application.
- Healthy and unhealthy target counts: A falling count of healthy targets means instances are failing health checks, which can happen before users notice slower responses.
- Connection and request volume: Track active connections and requests per second. Sudden changes in volume help separate a traffic surge from a fault.
- Target response time and timeouts: Rising target response time or timeouts between the load balancer and application instances point to saturation or slow dependencies behind the service.
- Rejected or reset connections: Count connections the load balancer closes or resets. These often appear during deployments, scaling events or when instances run out of capacity.
Review whether health check settings match the application's actual startup and readiness behavior, since mismatched settings produce false alarms or hide real failures.
PostgreSQL holds the clinical data and is often the component that limits Medplum throughput. Its metrics show whether queries are slow, whether connections are exhausted and whether storage is keeping up. Exact metric names depend on the exporter and database service you use, so confirm them against your deployment before writing alert rules.
- Connection use: Compare active and idle connections with the configured maximum. Approaching the limit causes requests to wait for a pool connection, which appears in the application as latency.
- Query duration and slow query counts: Track the time spent in queries and the number of statements over your slow query threshold. A rising trend often follows a new search pattern or a missing index.
- Replication lag and failover state: If you run readers or standby instances, watch replication delay. Growing lag means reads may return stale data and failover could lose recent writes.
- Lock waits and deadlocks: Watch for growing lock wait time and deadlock counts, which can stall writes during data migrations or heavy bulk operations.
- Storage growth and free space: Track disk usage, growth rate and transaction log or WAL volume. Running out of space stops writes entirely.
Tie database alerts to the connection and latency signals in the application tab so the on-call engineer can see whether the database is the cause.
Redis serves as Medplum's cache. Its role is to reduce load on PostgreSQL, so a problem here often appears as a sudden rise in database load and application latency rather than as a visible Redis outage. Confirm the metric names exposed by your Redis service or exporter, and check whether your deployment uses a managed service or self-run instances.
- Memory use and evictions: Track memory consumption against the configured limit and count evicted keys. Rising evictions mean the cache is too small for the working set, which pushes more reads to PostgreSQL.
- Hit and miss ratio: A falling hit ratio after a change in traffic or an upgrade signals that cached data is no longer being reused as expected.
- Connected clients and rejected connections: Watch the number of clients and any connection rejections. Clients that cannot reach Redis may fall back to slower paths or fail.
- Command latency: Track latency for commands issued by the application. Rising values can reflect a busy instance or network delay between the application and Redis.
- Replication and failover status: If Redis runs with replicas, watch replication offset gaps and failover events, since a failover can briefly interrupt cache access.
When Redis alerts fire, check the PostgreSQL connection and query signals at the same time, because cache misses are the usual link between the two layers.
The container runtime or host operating system runs every Medplum component, so its signals explain failures that the application cannot report about itself, such as memory kills or disk pressure. The metrics and their names depend on your platform, whether that is Kubernetes, ECS, Docker on virtual machines or bare metal. Confirm them against the platform's documentation and your node exporter or agent.
- Restart counts: Track container or process restarts. Repeated restarts often follow out-of-memory kills, failed health checks or a bad configuration after a change.
- CPU throttling and headroom: Watch CPU usage and throttling counters. Throttling makes the application slow even when average CPU looks low.
- Memory and out-of-memory events: Track working set memory and kill events. A memory level that climbs steadily across restarts can indicate a leak in a component.
- Disk and inode use: Watch free space on volumes used for logs, temporary files and container images. Full disks stop logging, which removes evidence during an incident.
- Node and network health: Track node readiness, network errors and packet drops, since host problems often surface as intermittent timeouts in every other layer.
Confirm that resource alerts are set against the limits you configured for each container, so a limit change is reflected in the alert thresholds.
Monitoring tool options and when each fits
This table compares the main ways to collect and alert on metrics from a self-hosted Medplum deployment, including the open-source Prometheus and Grafana stack, Grafana Cloud, an existing monitoring platform and Medplum's OpenTelemetry route. Read each row against your team's operating capacity, data retention needs and high availability requirements. The main takeaway is that the self-managed options carry operating work that stays with your team, while managed options shift part of that work to a vendor under a separate contract.
| Option | Operating effort and HA | Storage and licensing or cost drivers | When it fits |
|---|---|---|---|
| Prometheus with Alertmanager | Your team runs the server. Local storage is single-node and not clustered or replicated, so plan a backup or remote write path. Alertmanager can run as a cluster using its --cluster flags. | Prometheus is Apache-2.0 with no paid edition. Costs are infrastructure, storage and the people who run it. Default retention is 15 days, set by time or size. | A team with on-call capacity that wants open-source collection, PromQL alert rules and control over where data lives. |
| Grafana for dashboards | Production and high availability need MySQL 8.0 or later or PostgreSQL 12 or later for configuration. SQLite does not scale for production. Run two or more active-active servers behind a load balancer. | Grafana is AGPLv3 since April 20, 2021 (Grafana Labs licensing). Enterprise is a separate commercial option. SAML and SCIM are Enterprise or Cloud features. | Teams that want dashboards on top of Prometheus and need SSO through a supported provider such as OIDC or LDAP. |
| Grafana Cloud | The vendor runs storage and the Grafana service. Your team still configures exporters, dashboards and alert routing, and confirms what the vendor operates. | Subscription-based with usage charges. The Pro tier starts with a platform fee plus usage, and Enterprise has a minimum annual commitment (Grafana pricing page). Ask for usage estimates from the metrics you send. | Teams that cannot staff a self-run metrics store but can send Medplum metrics outside their network under their data policies. |
| Existing monitoring platform | Depends on the platform. Confirm whether it can scrape Medplum's endpoints, send alerts to your on-call tool and run in your redundancy model. | Licensing and ingestion costs come from the vendor contract. Check which metric volume and retention tiers apply before you commit. | Organizations that already run a monitoring standard and want Medplum signals in the same operations workflow. |
| Medplum OpenTelemetry route | Optional and enabled in the Medplum configuration. Confirm the metric names and exporter settings in the Medplum docs for your version before building alerts on them. | Costs follow the collector and backend you choose. The backend decides retention, licensing and storage cost. | Teams that want standard OpenTelemetry metrics and traces and plan to send them to Prometheus or another backend. |
Setting up monitoring for a self-hosted Medplum in sequence
This sequence puts Medplum, its supporting services and an on-call team on one monitoring path, so that each layer is verified before the next one depends on it. The result is a scraped, alerted and documented setup that can be tested end to end before go-live.
Confirm the Medplum version and upgrade path
Record the exact Medplum server version, the PostgreSQL and Redis versions, and the container images in use, then check the Medplum upgrading guide to confirm which minor versions you must pass through before the version you run is current. Medplum's releases are published on GitHub, so match your tag against the release notes for the metrics you plan to scrape. Done means you have a written version inventory and a confirmed upgrade path that the monitoring rollout will not conflict with.
Deploy Prometheus with scrape targets
Install Prometheus on a host or workload separate from the Medplum application servers, so monitoring does not fail with the thing it watches. Define a scrape job for each component that exposes metrics: the Medplum server, the load balancer, PostgreSQL exporter, Redis exporter and container runtime. Confirm the targets page shows every job as up and that a sample query returns series for each one. Note that Prometheus local storage is single-node and not replicated, so plan retention and any remote write target before relying on it for history.
Deploy Alertmanager across every instance
Run Alertmanager, and if you need redundancy, run it as a cluster using its cluster flags. Point Prometheus at every Alertmanager instance directly rather than through a load balancer, as the Alertmanager documentation specifies. Configure the receivers for your on-call channel and confirm that each Alertmanager instance is reachable from Prometheus and shows in the Prometheus alerting configuration as an active endpoint.
Provision Grafana dashboards as code
Install Grafana with PostgreSQL as its configuration database, since SQLite is not suitable for production or high availability. Define the Prometheus data source, dashboards and alerting resources in provisioning files loaded at startup, or keep them in version control with Terraform or Git Sync. Store the dashboard JSON for Medplum server latency and errors, database connections and cache health in the same repository as the Prometheus configuration. Done means a fresh Grafana instance built from the repository shows the same dashboards with no manual edits.
Define alert rules for early warning
Write Prometheus alert rules for the signals described in the metrics section, such as sustained error rate, rising request latency, database connection saturation, Redis unavailability and scrape failures. Set each threshold against a baseline from your own environment during a test period, since the thresholds that fire before an outage depend on your traffic. Add a rule that fires when a scrape target disappears, because a silent exporter is itself an outage signal. Verify each rule loads without syntax errors and evaluates in the rules view.
Test alert routing and silences
Send a test alert through Prometheus and Alertmanager and confirm it reaches the on-call channel with the expected labels, grouping and severity. Create a silence for a test alert, confirm notifications stop, then expire it and confirm they resume. Check that inhibition rules suppress downstream alerts when a parent failure fires, such as a database outage hiding dependent application errors. Done means the on-call team has received a real test notification, and the runbook links in each alert resolve to current procedures.
Alert conditions that fire before users notice an outage
The conditions below sit upstream of user-visible failure: rising errors, slowing requests, exhausted connections, lost cache, restarting containers and filling metric storage. Each one gives the on-call team time to act before a clinician or integration partner notices. Set every threshold from your own baseline and load test results, not from a generic default.
Server error rate climbing
Alert on the share of 5xx responses from the Medplum application servers over a sustained window, not on a single spike. A slow rise often appears before a full failure, as one failing dependency starts returning errors to a growing share of requests. Pair the error rate with the load balancer's view of 5xx responses so you can tell whether errors come from the application or from upstream routing. Check recent deployments first, because a partial upgrade or config change is a common cause.
Latency trend, not latency peaks
Track p95 or p99 response time for FHIR search and write requests and alert on a sustained upward trend against your baseline. Medplum's own request handling depends on the database, so slow queries show up here first. Compare the trend with request volume to separate growth from a regression. Treat a steady climb over days as a capacity or query problem to investigate before it becomes a timeout.
PostgreSQL connection saturation
Watch the number of active PostgreSQL connections as a share of the maximum your pool and database allow. When connections approach the ceiling, requests begin waiting for a pooled connection, which raises latency before any error appears. Alert early enough to add capacity or fix a leak, and check whether a single workload, such as a Bot or integration, is holding connections open. Confirm the actual limits with your database configuration and pool settings.
Redis availability and reconnects
Alert on Redis being unreachable from the application servers and on repeated reconnect attempts, since Medplum uses Redis as its cache. A cache outage can push load onto PostgreSQL and slow every request at once. Also watch memory use and eviction counts, because evictions signal that the cache is too small for the working set. Confirm with your team how the application behaves when Redis is unavailable before you rely on this signal.
Container restart loops
Alert when an application container restarts more than once within a short period, rather than on any single restart. A repeating restart often means failed health checks, out-of-memory kills or a startup error after a configuration change. Restarts also reduce capacity behind the load balancer, so a looping container can degrade the service while every instance still appears to be running. Check exit codes and recent logs to decide whether the cause is memory, configuration or a dependency.
Disk growth in Prometheus storage
Monitor the disk used by the Prometheus time series database and project when it will fill, since local storage is not replicated and a full disk stops ingestion. Retention settings set how much data is kept, so compare actual growth with the configured retention by time or size. Losing the monitoring data during an incident removes the evidence you need for troubleshooting, so this alert protects your visibility as well as the metrics store.
Building dashboards an on-call engineer can use at 3 a.m.
An on-call dashboard should answer one question first: is self-hosted Medplum healthy right now? Build a top-level health view that shows the Medplum server's request rate, error rate and latency, the load balancer's target health and 5xx count, PostgreSQL connection usage and replication state, and Redis availability. Each panel should be one glance away from the layer it describes. Below that, create drill-down dashboards per layer: Medplum server instances, the load balancer, PostgreSQL, Redis and container resources. Every alert rule should carry a link to its dashboard panel and to a runbook entry describing the first checks and the escalation path. Confirm which metric names your Medplum version and exporter expose before you write panel queries, since they vary by how Medplum is deployed.
Keep dashboards in version control so a 3 a.m. change is reviewable and reproducible. Grafana provisioning loads data sources, dashboards and alerting resources from YAML or JSON files at startup, so the dashboard definitions can live in the same Git repository as the rest of your infrastructure code. Grafana also documents Terraform and Git Sync as further as-code options. Choose one approach, name an owner for the repository, and confirm with your team how dashboard changes are reviewed and deployed, because a dashboard edited by hand in the UI will drift from the stored copy.
If you run more than one Grafana server for high availability, plan alerting before you rely on it. The Grafana high availability documentation describes two or more active-active servers sharing a MySQL or PostgreSQL database behind a load balancer, and it notes that alerting needs additional configuration to avoid duplicate notifications. Test this before go-live by triggering a test alert and confirming that one notification reaches the on-call channel. Also note that Grafana Live has limitations in HA, so do not build the on-call view around live streaming panels without checking them first.
Securing the monitoring stack itself
Prometheus, Alertmanager and Grafana expose operational data about your Medplum deployment, and some of it can reveal patient-related context through labels, logs or query results. The controls below cover who can reach each endpoint, how Grafana is hardened and who can see what once they sign in.
Authenticate the metrics endpoint
Medplum, the load balancer exporters and Prometheus itself expose metrics over HTTP. Prometheus pulls from these targets without built-in user authentication, so the Prometheus security model places access control at the deployment level. Confirm that metrics endpoints are reachable only from the Prometheus network segment, use network policies or security groups to block everything else, and check that exporter ports are not published on public addresses. Test the rule from outside the network, not only from inside it.
Prometheus security modelHarden Grafana cookies and headers
The Grafana security hardening guide recommends secure and SameSite cookies, a Content Security Policy and Trusted Types. Set these in the server configuration, serve Grafana only over HTTPS, and verify the response headers after each upgrade. Also hide the Grafana version from unauthenticated users and require authentication for the metrics endpoint so that an attacker cannot match known version flaws to your instance.
Security hardening docsLimit access to patient-related data
Dashboards, Explore queries and log views can show patient identifiers if exporters or application logs put them in labels or messages. Review metric labels and log fields for identifiers before you build dashboards, and drop or hash any that appear. Then restrict data source permissions and folder access so that only the roles that need request-level detail can open those panels. Document the decision so auditors can trace who sees which data.
Choose sign-in options with license limits
Grafana authentication supports LDAP, generic OAuth, Entra ID, Okta, GitHub, GitLab, Google OAuth, auth proxy and JWT in all editions. SAML, team sync, active sync and SCIM provisioning are available only in Grafana Enterprise and Grafana Cloud. If your identity provider requires SAML or you need automated deprovisioning, confirm the license tier before design. Otherwise, plan manual offboarding and access reviews for Grafana accounts.
Authentication docsProtect alert routing and config
Alertmanager receives alerts from Prometheus and sends notifications to on-call tools, so its receivers, webhook tokens and silences are sensitive. Store notification credentials in files or a secrets manager rather than in plain configuration, and limit who can create silences, since a silence can hide a real outage. Restrict access to provisioning files in Git and record every change to alert rules.
Keep the monitoring stack patched
Prometheus, Grafana and Alertmanager each publish releases on their own schedules. Grafana states that patch releases come at least monthly and that each minor release is supported for 9 months. Prometheus LTS lines get bug fixes for one year. Choose a supported line for each component, subscribe to release notices and schedule upgrades in a maintenance window, so the tools watching Medplum do not become an unpatched entry point.
Grafana upgrade guidanceQuestions teams ask before monitoring a self-hosted Medplum
What does a self-hosted Medplum monitoring stack cost to run?
The core tools are open source, so the license fee is zero, but the stack still has real costs. Prometheus is licensed under Apache-2.0 and has no paid enterprise edition, so the money goes to infrastructure, storage, implementation and people. Prometheus stores data on a single local node with a default retention of 15 days, so longer history means more disk or a separate long-term storage system reached through remote write. Grafana has a free self-hosted edition, but its SAML and team sync features are limited to Grafana Enterprise and Grafana Cloud, so check which features your identity model needs before you commit. The largest recurring cost is usually staff time for upgrades, rule maintenance and on-call. Ask any implementation partner for a quote that separates one-time setup from recurring operations and lists the storage retention it assumes.
How long does it take to set up Medplum monitoring?
The duration depends on how many components you monitor, how many metrics endpoints you must expose, and whether dashboards and alert routing already exist. The scope usually includes Medplum server metrics, load balancer and container metrics, PostgreSQL, Redis, Alertmanager routing and Grafana dashboards. Each source needs network access, authentication for its metrics endpoint and a scrape configuration, and each alert needs a tested notification path. Teams that already run Prometheus and Alertmanager for other services can reuse most of the pipeline. Teams starting from nothing spend more time on storage sizing, retention decisions and access control. DeployOpen does not publish durations; a written scope will set out the components, environments and handover tasks that determine the timeline.
Can our internal platform team run Medplum monitoring alone?
A team with Kubernetes or cloud operations experience can usually run Prometheus, Alertmanager and Grafana alone, provided it has time to learn PromQL, alert design and the Medplum metrics that matter. The harder part is ongoing ownership. Prometheus is a single-node database that is not clustered or replicated, so someone must manage its storage, restarts and upgrades. Alertmanager should run as a cluster with Prometheus pointed at every instance, which is a design decision your team must own. Grafana high availability needs MySQL or PostgreSQL and extra alerting configuration to avoid duplicate notifications. Decide early which parts your staff will run and which you want to hand to a partner under a retainer.
What access and ownership does a monitoring project need from our team?
The project needs access in four areas: the network paths from the monitoring servers to each metrics endpoint, credentials or network rules that protect those endpoints, read access to the cloud or cluster APIs used for service discovery, and write access to the notification channels used by on-call. Grafana's hardening guidance recommends requiring authentication for the metrics endpoint, so expect a short security review of every exposed endpoint. Your team must also name owners for each alert, decide who is paged at night, and approve changes to thresholds. Confirm with your Medplum deployment owner which metrics are exposed by your version, because endpoint behavior can differ between releases.
Should we choose Prometheus or a managed monitoring platform for Medplum?
Choose Prometheus when you want open-source tooling you control, data that stays inside your cloud account, and the ability to change scrape targets and rules without a vendor's roadmap. Choose a managed platform when your team lacks the staff to run storage, upgrades and high availability, or when a vendor must carry the operating responsibility. Prometheus values reliability over precision, so it is not the right tool where every event must be counted exactly, such as per-request billing. Compare the total cost of your own time against the subscription, and check that a managed platform keeps data in the region your compliance program requires. The Medplum compliance documentation notes that compliance is a shared responsibility, so the choice must fit your own controls.
How do we keep alert rules current across Medplum upgrades?
Treat alert rules as versioned code and review them as part of every Medplum upgrade. Medplum ships patch versions weekly and minor versions two to three times a year, and each minor version must be applied in sequence, so metric names, log messages and dashboard panels can change between steps. Store rules and dashboards in Git, test them against a staging environment that runs the new version, and keep a changelog that links each alert to the component it watches. Grafana provisioning can load data sources, dashboards and alerting resources from files at startup, which makes that review easier. Prometheus and Grafana also release on their own schedules, so track their support windows too. Prometheus minor releases stop receiving bug fixes after six weeks, so plan the upgrades of the monitoring stack itself.
Which Medplum upgrade risks should our monitoring catch early?
Monitoring should catch three upgrade risks: a server that fails to start after skipping a minor version, a post-deploy data migration that runs far longer than expected, and a rise in database or cache latency after the change. Watch startup errors, restart counts and health check failures during the rollout window. Alert on migration progress or on the absence of expected log activity, because a long data migration can look like a hung service. Track PostgreSQL connection counts and query latency, which often shift after schema changes. Run these checks against a staging copy before production, and keep a rollback plan that your alerts can trigger.
How DeployOpen scopes and supports Medplum monitoring
DeployOpen plans, builds, documents and hands over monitoring for self-hosted Medplum inside infrastructure you control, so your team can see server, database, cache and load balancer health before users notice a problem. Engagements are agreed as a fixed scope in writing, and ongoing support is available as a retainer.
How we scope
- Written scope lists which Medplum, load balancer, PostgreSQL, Redis and container signals will be collected
- Scope names the alert routes, owners and on-call rotation that receive each alert
- We confirm which monitoring stack your organization already runs before choosing collection and storage
How we build
- We configure exporters and scrape targets for each component and verify that every planned metric arrives
- We write alert rules with thresholds agreed with your team and tested against controlled conditions
- We build dashboards for the on-call team, grouped by request path, database health and capacity
How we hand over
- Runbooks describe what each alert means, the first checks to run and when to escalate
- Configuration is stored as code so your team can review, version and redeploy monitoring changes
- A walkthrough with your engineers covers dashboards, alert tuning and the retention settings you chose
How we support
- Retainers cover upgrades to monitoring components and tuning of alerts after your traffic changes
- Periodic reviews check that alerts still fire on the signals that matter after each Medplum upgrade
- Support scope, response expectations and retainer terms are written into the agreement before work starts

