Eventscript functions: new function ctdb_check_counter().
authorMartin Schwenke <martin@meltin.net>
Fri, 17 Dec 2010 05:10:56 +0000 (16:10 +1100)
committerMartin Schwenke <martin@meltin.net>
Thu, 11 Aug 2011 00:46:56 +0000 (10:46 +1000)
commit5b01b7233515669e995e037205796e265643b176
tree79ae6439a9f34f2b40ae2e97a93cb13ad29c886d
parent881af7c1417962b9b3ade6565b3e8eb9f9df7a97
Eventscript functions: new function ctdb_check_counter().

This should eventually be able to replace ctdb_check_counter_limit()
and ctdb_check_counter_equal(), although it doesn't issue warnings
like the former.

It takes 4 optional arguments:

1. _msg - If "error" then over limit causes an error message and and
   exit 1.  Anything else fails silently but the function returns 1.
   Default is "error".

2. _op - An integer operator supported by test (e.g. -eq, -ge, -gt).
   Default is -ge.

3. _limit - Limit for the counter to be used in comparison.  Default is
   $service_fail_limit.

4. _service_name - Used to identify the counter.  Default is
   $service_name.

For example:

  ctdb_check_counter error -ge 5 foo

will print a message and exit 1 if the counter for foo is >= 5,
whereas

  ctdb_check_counter check -ge 5 foo

will just return 1 if the counter for foo is >= 5, and

  ctdb_counter_check

with print a message and exit 1 if the counter for $service_name is >=
$service_fail_limit.

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