Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 Server Administration Documentation | 2025.1

# Triggering on heartbeat (server responsiveness)

A heartbeat-related trigger can be part of a solution to monitor whether a server is responsive. One use case might be to alert an administration to evaluate whether to fail over from the target server The immediately upstream server for replica servers, edge servers, standby servers, proxies and brokers. See also 'upstream server' and 'central server'. to a standby server. (See Failover and Triggering on failed-over.)

If the target server ... | the monitoring server can fire a trigger or extension of type ...
--- | ---
misses a response to the heartbeat for the first time (see the `net.heartbeat.missing` and net.heartbeat.interval configurables in the P4 CLI Reference) | `heartbeat-missing`
resumes its response (see the `net.heartbeat.resumed` and net.heartbeat.missing.wait configurables in the P4 CLI Reference) | `heartbeat-resumed`
misses consecutive responses that reach the maximum count (see `the net.heartbeat.missing.count` configurable in the P4 CLI Reference) | `heartbeat-dead`

The special variable, %targetport%, specifies the serverport of the target server being monitored. This corresponds to the P4TARGET or the `-t target` value that the p4 heartbeat command uses.

To define any of these trigger types, use the p4 triggers command to set up the triggers form.

For example:

- `hm heartbeat-missing heartbeat "perl hm.pl %targetport%"`
- `hr heartbeat-resumed heartbeat "perl hr.pl %targetport%"`
- `hd heartbeat-dead heartbeat "perl hd.pl %targetport%"`

You can have zero, one, or more heartbeat-related triggers.

The following table describes the fields for a trigger definition:

Field | Meaning
--- | ---
name | The name of the trigger, such as hm
`type` | Must be heartbeat-missing, `heartbeat-resumed`, or `heartbeat-dead`
`path` | Must be heartbeat
`command` | The trigger for P4 Server to run when the trigger fires. The command is typically a call to a script. The command must be quoted. The command can take any arguments that your trigger can parse, including P4 Server trigger variables.

Your search for returned results