This site best when viewed with a modern standards-compliant browser. We recommend Firefox Get Firefox!.

Linux-HA project logo
Providing Open Source High-Availability Software for Linux and other OSes since 1999.

USA Flag UK Flag

Japanese Flag

Homepage

About Us

Contact Us

Legal Info

How To Contribute

Security Issues

21 December 2007 Heartbeat release 2.1.3 is now out Download it and install it!

11 October 2007 NEW educational HA/DR Blog hosted by Alan Robertson

9 April 2007 Check out the Cool Heartbeat Screencasts: Installation, Intro to the GUI Part of the Heartbeat Education project

Last site update:
2008-05-17 11:25:30

Heartbeat Resource Agents

The Classic Heartbeat resource agents (scripts) are basically LSB init scripts - with slightly odd status operations. The only operations on the resource scripts which Heartbeat performs are:

  • start
  • stop
  • status

These operations are as follows:

start operation

Activate the given resource.

According to the LSB, it is never an error to start an already active resource. Exit with 0 on success, nonzero on failure. Heartbeat will only start a resource if it wants it to be running on the current machine, and status shows it's not already running. Heartbeat will never start the same resource at the same time in different nodes in the cluster.

stop operation

Deactivate the given resource.

Performed when we want to make sure a resource is not running. Although there are occasions when we check to see if a resource is running before stopping it, during shutdown, we will stop all resources whether or not we think they're running.

According to the LSB, stopping a resource which is already stopped is always permissible. Heartbeat will DEFINITELY stop resources it doesn't know is running. Stop failures can result in the machine being rebooted to clear up the error. Note that some Red Hat init scripts are not LSB-compliant and complain when trying to stop resources which are not running.

status operation

Determine running status of the given resource.

The status operation has to really report status correctly, AND, it has to print either OK or running when the resource is active, and it CANNOT print either of those when it's inactive. For the status operation, we ignore the return code.

This sounds quite odd, but it's a historical hangover for compatibility with earlier versions of Linux which didn't reliably give proper status exit codes, but they did print OK or running reliably.

Heartbeat calls the status operation in many places. We do it before starting any resource, and also (IIRC) when releasing resources.

After repeated stop failures, we will do a status on the resource. If the status reports that the resource is still running, then we will reboot the machine to make sure things are really stopped. Note that this behaviour is only with the old resource manager of v1 (haresources based) clusters. CRM/v2 clusters use stonith.

Concurrency

Start, stop and status operations are NEVER overlapped on a given resource on a given machine. You don't have to worry about concurrency of an operation on a resource.

Parameters

Unlike an LSBResourceAgent, a HeartbeatResourceAgent can be passed a list of positional parameters. The parameters go before the operation name, like this:

IPaddr 10.10.10.1 start

The haresources line which corresponds to this set of parameters is:

IPaddr::10.10.10.1

and invoked with the start operation.

Location

Heartbeat looks for resource scripts in /etc/ha.d/resource.d and /etc/init.d.

See Also

ResourceAgent, HeartbeatProgram, haresources, LSBResourceAgent, OCFResourceAgent