Scraping targets behind NAT and firewalls with PushProx

PushProx lets Prometheus keep its pull model when hosts sit behind NAT or firewalls. This page covers the architecture, setup order, security trade-offs and what to confirm before you build it.

On this page

Scraping targets behind NAT and firewalls with PushProx: when you need it

Some hosts you need to monitor sit in other networks, behind NAT, or inside segments where inbound connections from your Prometheus server are blocked. In that situation the question is how to keep monitoring them without opening inbound holes in every firewall. PushProx is one answer, but the work starts with where Prometheus sits, because that decision determines whether a proxy is needed at all.

Prometheus pulls metrics over HTTP from its targets, which are found through service discovery or static configuration. A target that Prometheus cannot reach over the network is therefore the core problem, not a detail of the configuration. Before choosing a tool, map every target to a network path and ask which of three cases applies: the target is reachable from a Prometheus server you can place inside its network, the target can reach a Prometheus server you can place in a shared zone, or neither direction works. Each case leads to a different design, and the first case is often the simplest.

The Prometheus overview says the project values reliability over precision and is not a good fit where 100% accuracy is required. That framing matters here, because a proxy path adds a hop that can drop or delay scrapes. Confirm with your network and security teams which firewall rules, egress paths and credential rules apply to each segment, and decide how long a gap in a host's data is acceptable before you design the relay. Then compare that tolerance with the complexity of PushProx and the alternatives it replaces.

PushProx lets Prometheus scrape hosts that accept no inbound connections

The flow starts with Prometheus in the trusted network, which sends each scrape request to the PushProx proxy that it can reach. The PushProx client on the NATed host opens every connection itself, polling the proxy outbound and returning the metrics it fetched from the local exporter. Nothing crosses the firewall inbound. When you review this design, check that the client's outbound rule reaches only the proxy, and that the proxy accepts connections only from the client and from Prometheus.

Scrape requests reach NATed hosts only through an outbound client poll.

Choosing between PushProx, agent mode and direct scraping

Direct scraping is the default Prometheus model. The Prometheus server opens an HTTP connection to each target's exporter endpoint and pulls metrics on a schedule, so the network must allow inbound connections from the Prometheus host to every scraped port. This is the simplest design to reason about, and it needs no extra components beyond the exporters themselves.

  • Network requirement: a firewall rule from the Prometheus server to each exporter port, plus name resolution or a stable address for each target.
  • Who operates it: your platform team runs the Prometheus server, and the owner of each host maintains the exporter and its port.
  • What recurs: rule reviews whenever hosts move, scrape port changes, and certificate or basic authentication upkeep if the endpoints are protected.
  • Where it breaks: segmented networks where security policy forbids inbound flows from the monitoring zone, and hosts that roam between networks.
  • Dependency to note: target discovery through service discovery or static configuration, which must stay accurate as hosts change.

Before choosing this model, confirm with your network and security teams whether the required inbound flows are permitted and documented.

PushProx configuration options and when each fits

This table compares the main configuration choices for a PushProx setup: where the proxy sits, how clients poll and identify themselves, how components authenticate, how targets are labeled, and how Prometheus references the proxy. Read each row against your network zones, then confirm the current flags and defaults in the official PushProx documentation before writing any configuration.

DecisionOption and what it meansWhen it fitsWhat to confirm
Proxy placementProxy runs in the same zone as Prometheus, so it is reachable by Prometheus and by clients outside itClients sit in a separate network segment and Prometheus must stay inside the internal networkWhich direction of connections your firewall allows and which ports the proxy listens on
Proxy placementProxy runs in the client's zone, close to the targets it servesTargets sit behind a boundary that only allows outbound connectionsWhether the proxy needs an outbound route to Prometheus and which hosts it can reach
Client poll intervalShorter interval, so clients fetch scrape requests more oftenAlerts depend on fresh data and proxy load is acceptableInterval flag name, its default, and how it interacts with your Prometheus scrape interval
Client poll intervalLonger interval, so the proxy handles fewer requests per clientTargets are stable and the network or proxy has tight capacity limitsExpected added latency for each scrape and whether gaps appear in your graphs
Client identityEach client gets a unique identifier at startup, such as its hostnameHosts are managed individually and you need to trace each scrape back to a sourceHow the client sets its identity, and whether identities must be unique across the fleet
TLS between componentsTLS on the client to proxy and proxy to Prometheus pathsTraffic crosses a segment that carries sensitive metrics or any untrusted networkWhich certificate and key options exist for each component and how they are rotated
Authentication between componentsNetwork-level restriction only, with allow lists on the proxyThe network is already segmented and the proxy listens only on an internal interfaceWhether the release you deploy offers built-in authentication and what it covers
Target label schemeLabels such as job name, environment and host added through Prometheus relabelingSeveral clients serve the same job and dashboards need to filter by site or zoneWhich labels the proxy passes through and where relabeling should happen to keep cardinality low
Prometheus scrape config referenceScrape jobs point at the proxy with the proxy address and the target as a path or parameterPrometheus pulls from one proxy that fans out to many clientsThe exact proxy path and parameter format in the current documentation, and how a missing client is reported

Setting up PushProx in order: server, proxy, clients, then checks

This sequence builds the scrape path from the inside out, so that each component is confirmed before the next one depends on it. The result is a Prometheus server that reaches a PushProx proxy, receives scrapes relayed from clients on NATed hosts, and drops those targets when the clients stop.

  1. Confirm Prometheus and its scrape path

    Start with the Prometheus server inside the network that can reach the proxy, and confirm it runs before adding anything else. Check that its web UI loads and that the built-in Prometheus job reports as up on the targets page. Also confirm which firewall rules allow Prometheus to open connections to the proxy address and port, since that is the only inbound path this design needs. Record the proxy hostname and port so later steps use the same values.

  2. Deploy the PushProx proxy

    Run the PushProx proxy on a host that Prometheus can reach over the network, and keep it separate from the NATed hosts it will serve. Configure it to listen on the chosen address and port, and confirm the version against the PushProx project's current release notes before you deploy. Check that the proxy process stays up and that its HTTP endpoint answers from the Prometheus host with curl. Until a client registers, the proxy should report no connected targets, which is the expected state at this step.

  3. Deploy PushProx clients on NATed hosts

    On each host that Prometheus cannot reach, run the PushProx client so that it makes outbound connections to the proxy only. Point the client at the proxy address and give each client a unique name, because that name becomes the identity Prometheus uses later. Confirm the host can open the outbound connection and that no inbound port is opened on the host. Check the proxy logs or its registered-clients view to see each client appear with its expected name.

  4. Add Prometheus scrape jobs that point at the proxy

    Edit the Prometheus configuration so that each scrape job targets the proxy and carries the client names as the path or label that PushProx needs to route the request. Keep the job and label naming consistent with your standards so dashboards and alert rules can filter on them. Validate the file with promtool check config before reloading, then reload Prometheus through the method your team uses. Confirm the new jobs appear on the targets page in the state you expect.

  5. Verify target health and labels

    On the Prometheus targets page, check that each relayed target reports as up and that its last scrape succeeded. Query the up metric in the expression browser for each target and confirm the value is 1. Check that the job, instance and any custom labels match the values you set in the configuration, because wrong labels cause dashboards and alerts to miss the target. If a target shows as down, check the client connection and the proxy logs before changing Prometheus.

  6. Confirm stale targets disappear when a client stops

    Stop the PushProx client on one NATed host deliberately, then watch the targets page and the up metric for that target over the following scrape intervals. The target should go to down and its series should stop updating, which proves Prometheus notices the lost connection. Then confirm the target no longer receives new samples and that any alert rule depending on up fires as designed. Restart the client afterward and confirm the target returns to up, so you know the recovery path works too.

Using Prometheus agent mode with remote write as an alternative

Agent mode is a workable alternative when you want the hosts behind the firewall to scrape and forward samples without running local query and alerting. In this setup, a Prometheus instance in agent mode discovers and scrapes the targets on its own network, writes the samples to a remote write endpoint, and does not evaluate rules or serve PromQL. The central Prometheus or long-term store that receives those samples takes on the query, dashboarding and alerting roles. Confirm the agent mode flag and its behavior against the Prometheus release you plan to run, since the feature set and flags have changed across the 3.x line.

The central side must accept remote write requests from the agent, and it must be configured to do so. For a plain Prometheus server, that means enabling the remote write receiver and restricting who can post to it, since an open write endpoint lets anyone inject samples into your data. Check that the receiver's authentication, TLS and network path match your firewall rules, and that the agent can reach it outbound from the segment where the targets live. Alert rules and PromQL queries then run where the data lands, so any alert that depends on local-only series, or on a query that must see every target at once, needs to be designed and tested against the central instance.

Remote write buffers samples in a write-ahead log on the agent while the remote endpoint is unreachable, then sends the backlog when the link recovers. This protects against short outages, but the buffer is finite, so a long outage can lose the oldest samples. Ask your team to size the agent's disk for the outage window you need to survive, and to alert on remote write failures and queue growth, because an agent that silently stops forwarding looks healthy from its own process. Read the Prometheus storage documentation for remote write semantics before you commit to this design, and treat the buffering limits as a requirement to test, not an assumption.

Why the Pushgateway is the wrong tool for this job

The Pushgateway exists for short-lived jobs that cannot be scraped. Hosts behind NAT and firewalls are long-running, so the gateway solves a different problem and adds risks that PushProx avoids. The cards below cover what the gateway does, where it misleads, and what it leaves unsolved.

Built for short-lived jobs

The Prometheus overview describes pushing short-lived job metrics through an intermediary gateway. That is the intended use: a batch job that exits before Prometheus can scrape it. A host running node_exporter for months is a long-running target, so the job-oriented design does not match. Check each target: if it stays up between scrapes, it should be scraped or pulled through PushProx rather than pushed.

Prometheus overview

Stale metrics persist

The gateway keeps the last pushed value for each grouping key until someone deletes it. If a host stops reporting, its metrics can keep looking current, so alerts built on them may never fire. Plan a cleanup step, such as deleting series when a host is decommissioned, and test what a silent host looks like in your queries.

Up and instance lose meaning

Prometheus creates the up series for each scrape it performs. With the gateway, the up and instance labels describe the gateway, not the monitored host, so a dead host does not appear as down. Dashboards and rules that assume one up series per host will report wrong results. Confirm which labels your dashboards and alert rules depend on before migrating any host to the gateway.

A single point holding state

The gateway stores pushed samples in memory and does not replicate them, so a restart or failure loses what it held. Prometheus then scrapes an empty gateway until the next push. Compare this with PushProx, where the proxy only relays scrape requests and the client keeps no metric state. Ask who owns gateway availability and how its loss would show up.

Reachability stays unsolved

Pushing metrics from a host still needs a route out of that host's network to a destination. The gateway does not change which side opens connections, and the host exporters on the private network still cannot be reached by Prometheus. PushProx addresses this directly: the client inside the network polls a proxy that Prometheus can reach, and the scrape then runs through it. Map each network boundary before choosing a pattern.

Questions buyers ask about PushProx and cost, effort and ownership

What drives the effort of a PushProx rollout?

The main drivers are how many hosts sit behind NAT or firewalls, how many network changes need approval, how long the security review takes, and how many exporters each host already runs. Each host needs a PushProx client, and the proxy placement must match your network zones. Hosts that already expose a working exporter port take less work, because the scrape job and client can often reuse the existing exporter configuration. Ask any partner to size the work from a host inventory and a network diagram, not from a headcount guess.

Can our own team run a PushProx rollout without a partner?

A capable platform or SRE team can run a small rollout alone, provided it has someone who understands Prometheus scrape configuration, TLS, and the firewall change process. Teams usually struggle most with network approvals and certificate handling, not with the software itself. A partner is most useful when the rollout spans many network zones, when the security review requires documented evidence, or when your team cannot spare people for the build and test cycle. Decide this by comparing your available hours and skills against the written scope.

What does the work need from our side?

Expect to provide a current network diagram showing which segments can reach which, a host inventory with operating systems and existing exporters, and access to the certificate authority that will issue client and proxy certificates. You will also need named contacts who can schedule firewall change windows and approve rules. Missing any of these usually adds waiting time rather than technical work, so gather them before the scope is written. Ask the partner to list every input it needs in the statement of work.

How long does a PushProx rollout take?

Duration depends mainly on the scope and on how long network approvals take in your organization, so no fixed timeline applies to every environment. A pilot with a few hosts in one zone moves faster than a rollout across several segments that each need their own change window. Ask for a timeline that shows which steps depend on your approvals, so you can see where delays would come from. Any timeline should be treated as an estimate until the scope and approvals are confirmed in writing.

What recurs after the PushProx rollout goes live?

Several items recur: rotating client and proxy certificates before they expire, upgrading PushProx clients and the proxy when you adopt new releases, and monitoring the proxy itself so a failure there does not silently remove many hosts from monitoring. Alerts should cover target health and certificate expiry. Ask for a written runbook that names the owner of each recurring task, since these tasks are easy to forget after the project team leaves.

How is a fixed-scope quote built from written scope?

A fixed-scope quote follows from a written scope that lists the hosts and network zones in scope, the components to deploy, the security review and testing expected, the documentation to hand over, and the client inputs the work depends on. Changes to any of these items would change the quote, so the scope should name them. The Apache-2.0 license for Prometheus carries no license fee, so the cost is infrastructure, storage, and people. DeployOpen does not publish a price list, and a quote is issued only after the scope is agreed.

Does the project have a license cost or a paid edition?

Prometheus is licensed under Apache-2.0, so there is no license fee for the project itself and no paid enterprise edition. Your costs come from the infrastructure that runs Prometheus and the proxy, storage, the implementation work, and the people who operate it. Before budgeting, confirm the hosting and network costs for your environment with your own infrastructure team, since those depend on your platform choices.

What DeployOpen plans, builds and hands over for this pattern

DeployOpen starts with the placement and network paths, because most NAT and firewall problems are decided there before any configuration is written. The work maps which hosts Prometheus must reach, which direction each connection can travel, and where a Prometheus server inside the network can sit so that it scrapes hosts directly and only the PushProx proxy needs a reachable address. The same review settles whether agent mode with remote write fits a given host group, and it records the firewall rules, ports and DNS names each path depends on so the client's network team can approve them as written.

On the implementation side, DeployOpen builds the PushProx client and proxy components, or the agent mode configuration, in the client's own infrastructure. Each path gets TLS and access controls: certificates issued from the client's CA, restricted client identities, and limits on which networks may reach the proxy. The build also covers service discovery entries, labels that identify the originating network segment, and tests that confirm a target stops reporting when its client is stopped, so silent gaps do not hide behind a healthy-looking dashboard.

Every engagement ends with a runbook written for the team that will operate the setup, covering certificate rotation, adding a host to a segment, diagnosing a target that stops reporting, and what to check after a firewall change. Scope, deliverables and timelines are agreed in writing before work starts, and the client receives the configuration, documentation and test results. Ongoing support, upgrades and retesting after Prometheus releases are available as a retainer. Before requesting a quote, ask which network segments and hosts are in scope, who approves firewall changes, and which Prometheus release line the client intends to run.

How DeployOpen scopes and supports PushProx deployments

DeployOpen plans, builds, documents and supports self-hosted Prometheus inside your own infrastructure, including the Prometheus side of a PushProx design for hosts it cannot reach directly. Work starts with a written scope that names the network paths, hosts and failure cases involved.

How we scope

  • Inventory the hosts that Prometheus cannot reach directly and record which network boundary blocks each one.
  • Decide where the Prometheus server, PushProx proxy and clients will run, and which firewall rules each path needs.
  • Agree in writing whether the design uses PushProx, agent mode with remote write, or a mix for each host group.

How we build

  • Deploy Prometheus inside the network first, with configuration managed as code and validated before each reload.
  • Install and configure the PushProx proxy and clients with TLS and access restrictions, so only approved clients can register.
  • Test scrape success, stale target handling and behavior during a network interruption before the design goes live.

How we hand over

  • Document the network paths, certificates, service accounts and firewall rules that the design depends on.
  • Provide runbooks for adding a host, rotating credentials, and diagnosing a client that stops reporting.
  • Walk your platform and security teams through the design so they can review and operate it without us.

How we support

  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
  • Ongoing upgrades, configuration changes and continuous testing of the monitoring path are available as a retainer.
  • Ask any provider to confirm which PushProx version and Prometheus release line their design will track, and who patches each component.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.