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 master 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 Helix Core Command-Line (P4) Reference)

heartbeat-missing

resumes its response

(see the net.heartbeat.resumed and net.heartbeat.missing.wait configurables in Helix Core Command-Line (P4) Reference)

heartbeat-resumed

misses consecutive responses that reach the maximum count

(see the net.heartbeat.missing.count configurable in Helix Core Command-Line (P4) 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 failed-over trigger definition:

Field Meaning

name

The name of your trigger script, such as hm

type

Must be heartbeat-missing, heartbeat-resumed, or heartbeat-dead

path

Must be heartbeat

command

The trigger for Helix 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 Helix Server trigger variables.