init, setup, startup, unhealthy, healthy
-To use notifications with this directory then you need to set:
-
- CTDB_NOTIFY_SCRIPT=/etc/ctdb/notify.sh
-
-in your CTDB configuration file.
-
An example script that sends SNMP traps for unhealthy/healthy might
look like this:
#!/bin/sh
-# This script is activated by setting CTDB_NOTIFY_SCRIPT=/etc/ctdb/notify.sh
-# in /etc/sysconfig/ctdb
-
# This is script is invoked from ctdb when certain events happen. See
# /etc/ctdb/notify.d/README for more details.
</refsect1>
<refsect1>
- <title>NOTIFICATION SCRIPT</title>
+ <title>NOTIFICATIONS</title>
<para>
When certain state changes occur in CTDB, it can be configured
- to perform arbitrary actions via a notification script. For
- example, sending SNMP traps or emails when a node becomes
- unhealthy or similar.
+ to perform arbitrary actions via notifications. For example,
+ sending SNMP traps or emails when a node becomes unhealthy or
+ similar.
</para>
+
<para>
- This is activated by setting the
- <varname>CTDB_NOTIFY_SCRIPT</varname> configuration variable.
- The specified script must be executable.
+ The default notification script is
+ <filename>/usr/local/etc/ctdb/notify.sh</filename>. It executes
+ files in <filename>/usr/local/etc/ctdb/notify.d/</filename>,
+ which must be executable.
</para>
+
<para>
- Use of the provided <filename>/usr/local/etc/ctdb/notify.sh</filename>
- script is recommended. It executes files in
- <filename>/usr/local/etc/ctdb/notify.d/</filename>.
+ This notification script can be changed via the
+ <varname>CTDB_NOTIFY_SCRIPT</varname> configuration variable.
+ The specified script must be executable.
</para>
+
<para>
CTDB currently generates notifications after CTDB changes to
these states:
certain state changes occur.
</para>
<para>
- This file is usually
+ The default is
<filename>/usr/local/etc/ctdb/notify.sh</filename>.
</para>
<para>
- Please see the <citetitle>NOTIFICATION SCRIPT</citetitle>
+ Please see the <citetitle>NOTIFICATIONS</citetitle>
section in <citerefentry><refentrytitle>ctdb</refentrytitle>
<manvolnum>7</manvolnum></citerefentry> for more
information.
<term>CTDB_NOTIFY_SCRIPT=<parameter>FILENAME</parameter></term>
<listitem>
<para>
- No default, usually
+ Default is
<filename>/usr/local/etc/ctdb/notify.sh</filename>. Corresponds to
<option>--notification-script</option>.
</para>
if (options.notification_script != NULL) {
ctdb->notification_script = talloc_strdup(
ctdb, options.notification_script);
- if (ctdb->notification_script == NULL) {
- D_ERR("Unable to set notification script\n");
- exit(1);
- }
+ } else {
+ ctdb->notification_script = talloc_asprintf(ctdb,
+ "%s/notify.sh",
+ ctdb_base);
+ }
+ if (ctdb->notification_script == NULL) {
+ D_ERR("Unable to set notification script\n");
+ exit(1);
}
ctdb->valgrinding = (options.valgrinding == 1);