1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/ctdb/config
Martin Schwenke 398116ff29 Eventscripts: clean up 60.nfs monitor event.
This adds a helper function called nfs_check_rpc_service() and uses it
to make the monitor event much more readable.  An example of usage is
as follows:

  nfs_check_rpc_service "mountd" \
    -ge 10 "verbose restart:b unhealthy" \
    -eq 5 "restart:b"

The first argument to nfs_check_rpc_service() is the name of the RPC
service to be checked.  The RPC service corresponding to this command
is checked for availability using the rpcinfo command.  If the service
is available then the function succeeds and subsequent arguments are
ignored.

If the rpcinfo check fails then a failure counter for that particular
RPC service is incremented and subsequent arguments are processed in
groups of 3:

1. An integer comparison operator supported by test.
2. An integer failure limit.
3. An action string.

The value of the failure counter is checked using (1) and (2) above.
The first check that succeeds has its action string processed - note
that this explains the somewhat curious reverse ordering of checks.

It the example above:

* If the counter is >= 10 then a verbose message is printed
  describing the failure, the service is restarted in the background
  and the node is marked as unhealthy (via an "exit 1" from the
  function).

* If the counter is == 5 then the service us restarted in the
  background.

For more action options please see the code.

This also changes the ctdb_check_rpc() function so that it no longer
takes a program number to check.  It now just takes a real RPC program
name that rpcinfo can resolve via /etc/rpc.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 9b66057964756a6245bafb436eb6106fb6a2866e)
2011-08-12 14:16:14 +10:00
..
events.d Eventscripts: clean up 60.nfs monitor event. 2011-08-12 14:16:14 +10:00
ctdb-crash-cleanup.sh In the example script to remove all ip addresses after a ctdb crash, 2010-04-23 09:08:26 +10:00
ctdb.init When starting and stopping ctdb through the init-script, make sure we first clear all public ips bvefore we start the daemon, in case they are still hanging around since a previous kill -9 and also make sure we drop them after we have stopped the deamon when shutting down 2011-08-11 11:48:04 +10:00
ctdb.sysconfig Add documentation for the new filesystem use monitoring 2011-08-11 10:07:50 +10:00
functions Eventscripts: clean up 60.nfs monitor event. 2011-08-12 14:16:14 +10:00
gdb_backtrace lib/util: import fault/backtrace handling from samba. 2010-01-20 09:44:36 +01:00
interface_modify.sh Scripts: remove absolute paths from interface_modify.sh. 2011-08-08 15:50:10 +10:00
notify.sh server: add "setup" event 2010-02-23 10:38:49 +01:00
README Scripts: add note about not using absolute command paths to README. 2011-08-09 16:36:37 +10:00
statd-callout Eventscripts: remove unnecessary absolute paths from external commands. 2011-08-03 17:19:15 +10:00

This directory contains run-time support scripts for CTDB.

Selected highlights:

  ctdb.init

    An initscript for starting ctdbd at boot time.

  events.d/

    Eventscripts.  See events.d/README for more details.

  functions

    Support functions, sourced by eventscripts and other scripts.

  interface_modify.sh

    Script to support add/remove IPs and other funky stuff.  Not sure
    why this is separate... but it certainly allows easy wrapping by
    flock.

  statd-callout

    rpc.statd high-availability callout to support lock migration on
    failover.

Notes:

* All of these scripts are written in POSIX Bourne shell.  Please
  avoid bash-isms, including the use of "local" variables (which are
  not available in POSIX shell).

* Do not use absolute paths for commands.  Unit tests attempt to
  replace many commands with stubs and can not do this if commands are
  specified with absolute paths.  The functions file controls $PATH so
  absolute paths should not be required.