Skip to content
RU
← All articles

Monitoring private services without a public IP using heartbeat

In short:

Check a private endpoint from inside its network, then send a heartbeat only when the response meets your readiness contract. A failed local check must suppress the ping. This proves the path from the agent, not external customer reachability.

Private server sends an outbound heartbeat through a firewall
No public inbound port is needed for this check.

An external HTTP monitor cannot reach an endpoint hidden in a VPC or behind a VPN. You do not need to expose that endpoint to monitor it. Run a small probe on an internal host or container, inspect the response, and send a heartbeat to enterno.io after success. We tested that ordering with a local receiver: a failed private endpoint produced no heartbeat.

What you need

  • An internal host, container or CronJob that can reach the private URL and the heartbeat service.
  • A readiness contract. Our sample expects HTTP 200 plus "ready":true in the body.
  • A heartbeat monitor with an interval and a grace period longer than one probe run.
  • A secret store for the heartbeat URL, which can act as a sending token.

Step 1. Define readiness

A reverse proxy can return 200 while a database is unavailable. Give the application a lightweight /ready endpoint that checks the dependencies required for this particular user action. Keep the response small and free of secrets. Return a non-success status when the service cannot handle requests.

Measure how long the check takes before choosing the schedule. A 40-second probe on a one-minute interval can overlap with a retry or a slow container start. A probe should finish comfortably within its interval and have a timeout. If an endpoint needs expensive work, replace that work with a cheaper health signal tied to the same failure mode.

Step 2. Probe first, ping second

The included check_and_ping.sh checks the HTTP status and readiness marker with curl. The local probe has a timeout; curl retries the heartbeat request after the probe succeeds. The local test used an HTTP fixture and a receiver that counted pings.

PRIVATE_URL=http://service.internal/ready \
HEARTBEAT_URL=https://enterno.io/hb/EXAMPLE_TOKEN \
./check_and_ping.sh
# healthy fixture: exit 0, heartbeat received: 1
# failing fixture: exit 22, heartbeat received: 0

The token above is illustrative. Use the URL issued for your own monitor. Avoid shell tracing when the URL is in an environment variable: set -x can print it into logs. Store the local status and elapsed time for diagnosis, but redact the heartbeat address.

Step 3. Schedule the agent

A systemd timer every five minutes provides a clear detection bound. The heartbeat grace period should exceed the interval plus probe duration. As a starting configuration, a five-minute interval, 15-second timeout and roughly 12-minute grace allow a single missed launch. Change those values to match your incident response target.

[Timer]
OnBootSec=2min
OnUnitActiveSec=5min
Persistent=true
[Install]
WantedBy=timers.target

On Kubernetes, run the probe in a CronJob with its URL in a Secret. concurrencyPolicy: Forbid can prevent overlapping runs, but it can also skip a scheduled run while the previous one is active. Configure the grace period accordingly. CronJobs can occasionally start twice or miss a schedule, so the probe and its side effects should be safe to repeat.

Internal schedulers reporting completed checks to monitoring
A failed or skipped job must not emit a success pulse.

Test missing pings and the local contract

Create a heartbeat monitor in enterno.io with the intended cadence. Make a test endpoint fail. Confirm that the local process exits with an error, does not send a ping and the monitor marks the missed heartbeat after grace. Restore the endpoint and confirm the next successful signal. This negative test checks the entire chain, not only the happy path.

A heartbeat proves that the agent saw a successful response. It does not prove that an external customer can reach the public site. Add a separate external uptime monitor for that path, or a browser flow for user actions. Payment systems also need an independent order-state check.

When the heartbeat disappears

SignalInspectNext action
No local runTimer or CronJob eventsRestore scheduling and monitor the agent
Probe failedHTTP status, readiness marker, internal DNSRepair the service or route
Probe passed, ping failedOutbound DNS, TLS, firewallRestore the heartbeat path
Ping arrived, alert persistsURL token and grace windowMatch the monitor URL and cadence

Agent failures and application failures both appear as a missing ping. Keep local logs with exit code and timestamp, and monitor the host or scheduler separately. That second signal helps responders decide where to look first.

The scheduler and outbound network can fail separately

For systemd, create a separate Type=oneshot service unit with an unprivileged user and an execution time limit. The timer schedules the service; it does not prove the script succeeded. Check systemctl list-timers and then inspect the service journal for exit codes. After changing an interval, confirm the next actual trigger following daemon-reload. A persistent timer can catch a missed calendar event after reboot, but does not replace monitoring the host itself.

On Kubernetes, inspect the CronJob plus its Jobs and Pods. Image pull errors, resource pressure or a network policy can stop a probe before curl runs. Set a short active deadline and limit concurrency. Decide which zone the measurement represents: one pod in one zone cannot prove reachability from another. If both routes matter, use separate probes and label their monitors by zone.

The outbound route can fail as well. A ready private endpoint with broken public DNS will not reach the heartbeat service. That is a valid alert about missing evidence, but its cause is outside the application. Log the internal curl result and outbound ping result separately. Do not return success after a failed ping; a green scheduler job with no signal in the monitor would mislead responders.

Choose a grace window from a real failure test

Calculate the longest normal gap between pings. At a five-minute interval, one missed run means the next ping may arrive roughly ten minutes after the previous one, plus probe time. A 12-minute grace in our example tolerates that single miss but detects a sustained failure later. If the business needs notification in three minutes, this schedule cannot meet the target. Shorten the interval or add a direct external check where possible.

Run three probes. First, verify that a healthy endpoint advances the heartbeat timestamp. Next, make a test endpoint return 503 and confirm the script exits with an error and sends no ping. Finally, stop the scheduler and confirm the monitor detects a missing run. These produce similar alerts but have different causes; local logs and scheduler events tell responders which owner to call.

Never paste a real heartbeat URL into a public command example or issue. Rotate it after accidental disclosure because a third party might send a false healthy ping. Documentation should show only a placeholder token and tell operators where to retrieve the real URL in the protected account.

A separate background-job heartbeat example shows the same principle: send the signal only after checking the result. If two agents cover one service, assign separate tokens and define which failure should alert. Otherwise one healthy agent can hide a failure of the other.

How we made this

On 14 November 2026 we ran the Bash probe against a local HTTP readiness fixture and a local heartbeat receiver. The healthy case sent one ping and exited 0; the unhealthy case sent none and exited 22. We saved the script and results with the draft. We did not connect a real private service or create a production heartbeat monitor during this test.

FAQ

Must the private endpoint be exposed to the internet?

No. The agent reaches it inside the network and sends only a heartbeat outward. Restrict the agent's outbound access to the required destinations.

Can I ping before checking the endpoint?

That would prove only that the agent ran. Ping after the readiness check if you need a signal about the application.

How long should the grace period be?

Include the run interval, probe time and an allowance for at least one missed launch. Test the delay against your incident response requirement.

Sources

Check your website right now

Monitor your site continuously →
More articles: Monitoring
Monitoring
Check if Website Is Accessible from Russia: Blocks, TSPU, CDN
15.06.2026 · 2 840 views
Monitoring
How to Check if a Site Is Blocked in Russia (RKN)
15.06.2026 · 1 419 views
Monitoring
Website Not Loading: Why It Happens and a 10-Step Fix Checklist
23.06.2026 · 1 353 views
Monitoring
Top 10 Website Monitoring Services 2026: Features and Pricing
01.04.2026 · 1 193 views