The cmannotifyd daemon talks to CMAN and provides a mechanism to notify external entities about cluster changes.
CMAN dispatches 3 kind of notifications:
- CMAN_REASON_TRY_SHUTDOWN when cman requests to all clients if it is allowed to shutdown.
- CMAN_REASON_STATECHANGE when cman detects a node joining or leaving the cluster.
- CMAN_REASON_CONFIG_UPDATE when a configuration change event has been detected/requested.
These notifications are then dispatched to the shell script cman_notify in the environment variable CMAN_NOTIFICATION.
cman_notify will then execute all the scripts in the configured notification directory (default: /etc/cluster/cman-notify.d) passing a very minimal set of envvars including, of course, the CMAN_NOTIFICATION= type. The execution order is set by the filename as shown by "LC_ALL=C ls -las".
cmannotifyd logs are stored in the default log file (/var/log/cluster/cmannotifyd.log).
cman_notify logs are stored in the default log file (/var/log/cluster/cman_notify.log). By default the output from the scripts executed by cman_notify is redirected to /dev/null. Users can either set CMAN_NOTIFICATION_DEBUG=1 in their environment or set proper debug configuration in cluster.conf to redirect scripts output to the cman_notify log file.
Notifications are dispatched in the same order as they arrive, one by one.
CMAN_REASON_TRY_SHUTDOWN is passed to scripts for information only, they can not influence cman's decsion about whether or not to shut down.
CMAN_REASON_STATECHANGE also implies CMAN_NOTIFICATION_QUORUM exported in the environment. CMAN_NOTIFICATION_QUORUM will be set to 1 (when the node is part of a quorate cluster) or 0 (otherwise).
A template for cman_notify scripts can be found in the doc/ directory.