Automated HTTP (microservices) supervisor
First you need to install Epazote:
cargo install epazote
Or download the latest release from the releases
services:
my_app:
url: http://0.0.0.0:8080
every: 1m
expect:
status: 200
if_not:
cmd: systemctl restart appservices:
vmagent_targets:
url: http://127.0.0.1:8429/api/v1/targets
every: 30s
expect:
status: 200
json:
status: success
data:
activeTargets:
- labels:
job: DBMI-lab-nico
health: upexpect.body still performs text or regex matching against the raw response body. Use expect.json for structured JSON subset matching.
services:
alloy_metrics:
url: http://127.0.0.1:12345/metrics
every: 30s
expect:
body_not: r"error|failure|Fatal"
if_not:
cmd: /script/when/failure.shexpect.body_not uses the same text or r"..." regex matching as expect.body, but the service fails when the pattern is found. HTTP checks may omit expect.status when another matcher such as body_not is configured.
services:
vmagent_targets:
url: http://127.0.0.1:8429/api/v1/targets
every: 30s
expect:
status: 200
json:
status: success
if_not:
threshold: 3
stop: 2
cmd: systemctl restart vmagentthreshold waits for N consecutive failures before running if_not actions. stop limits how many times those fallback actions execute during one outage; a healthy check resets the counter for the next outage.
Fallback commands receive service context through environment variables, which makes alert scripts easier to write:
services:
vmagent_targets:
url: http://127.0.0.1:8429/api/v1/targets
every: 30s
expect:
status: 200
json:
status: success
if_not:
threshold: 3
stop: 1
cmd: /usr/local/bin/send-alert.shAvailable variables:
EPAZOTE_SERVICE_NAMEEPAZOTE_SERVICE_TYPEEPAZOTE_URLfor HTTP checksEPAZOTE_TESTfor command checksEPAZOTE_EXPECTED_STATUSEPAZOTE_ACTUAL_STATUSwhen availableEPAZOTE_ERROREPAZOTE_FAILURE_COUNTEPAZOTE_THRESHOLD
epazote -c epazote.yml
default configuration file is
epazote.yml
Prometheus metrics are served on port 9080 by default (--port / EPAZOTE_PORT).
The metrics server binds to all interfaces ([::]) by default; use --bind /
EPAZOTE_BIND to restrict it, e.g. epazote -c epazote.yml --bind 127.0.0.1 to keep
/metrics local-only.
Logs are pretty-printed by default for easier debugging. Use --json-logs if you want structured JSON logs instead.