Applications and Kubernetes — Hit Status docs
Besides being monitored from the outside (HTTP/SSL), an application can report its own health. It's the simplest way to give status visibility to pods…
Applications, containers and Kubernetes
Besides being *monitored from the outside* (HTTP/SSL), an application can report its own health. It's the simplest way to give status visibility to pods, workers, cron jobs and integrations — no open ports, no agent.
How it works
!The application calls the heartbeat URL on time; if the signal doesn't arrive, an incident opens
- Create a Heartbeat monitor on the application's asset. It generates a URL with a token:
https://hitstatus.pro/api/heartbeat/hb_…
- Your application calls that URL at the configured interval (GET or POST). No signal within the interval + grace period → incident.
- Optionally, send the state in the body (POST JSON) to open/close an incident right away:
{ "status": "down", "message": "Fila de pedidos travada" }
status: ok (default) · degraded · down. message appears on the incident, in the channels and on the status page.
One line, in any language
curl -fsS https://hitstatus.pro/api/heartbeat/hb_SEU_TOKEN
# reporting a problem
curl -fsS -X POST -H 'content-type: application/json' \
-d '{"status":"degraded","message":"latência do banco > 2s"}' \
https://hitstatus.pro/api/heartbeat/hb_SEU_TOKEN
Ready-made libraries (no dependencies)
- Node.js —
sdk/node/hitstatus.mjs
```js
import { HitStatus } from './hitstatus.mjs';
const hs = new HitStatus({ token: process.env.HIT_HEARTBEAT });
hs.every(60); // automatic heartbeat every 60 s
hs.down('Redis indisponível'); // reports a problem
hs.ok(); // back to normal
```
- Python —
sdk/python/hitstatus.py
```python
from hitstatus import HitStatus
hs = HitStatus(token=os.environ["HIT_HEARTBEAT"])
hs.every(60)
hs.degraded("fila com 10k mensagens")
```
Kubernetes / EKS
Three patterns, from simplest to most complete:
1. Heartbeat CronJob — proves the cluster and the network can reach the internet:
apiVersion: batch/v1
kind: CronJob
metadata: { name: hit-heartbeat }
spec:
schedule: "*/5 * * * *"
jobTemplate:
spec:
template:
spec:
restartPolicy: Never
containers:
- name: ping
image: curlimages/curl:8.8.0
args: ["-fsS", "https://hitstatus.pro/api/heartbeat/$(HIT_HEARTBEAT)"]
env:
- name: HIT_HEARTBEAT
valueFrom: { secretKeyRef: { name: hit-status, key: heartbeat } }
2. Health sidecar — reads your application's /health and reports ok/down with the message:
see sdk/kubernetes/sidecar.yaml.
3. Collector in the cluster — to monitor internal services (ClusterIP, databases, queues) with ping/port/HTTP:
see sdk/kubernetes/collector-deployment.yaml.
Store the token as a Secret; one token per application. For many applications, use the Assistant: "create heartbeats for services X, Y and Z in the Platform site, every 5 min".
Best practices
- Heartbeat interval = the job's real frequency + grace period (e.g. job every 15 min → interval 15 min, grace period 5 min).
- Report
degraded when the application still responds but with delays; down when it has stopped responding. - Combine it with an external HTTP monitor: the heartbeat says "I'm alive", HTTP says "I'm reachable".