summaryrefslogtreecommitdiff
path: root/ctdb/config/events.d
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2015-08-18 15:22:23 +1000
committerAmitay Isaacs <amitay@samba.org>2015-08-29 20:08:47 +0200
commit4164d7bf3153a2fd9081b4d073bfa88fec1507ad (patch)
tree0118d9bde3609c44a36902af91e2ee298251522c /ctdb/config/events.d
parent0f28ccf87af4e90867eaab213a640f6d0cdaa12d (diff)
downloadsamba-4164d7bf3153a2fd9081b4d073bfa88fec1507ad.tar.gz
ctdb-scripts: Add default filesystem usage warnings
Always check filesystem usage for the database directories. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Sat Aug 29 20:08:48 CEST 2015 on sn-devel-104
Diffstat (limited to 'ctdb/config/events.d')
-rwxr-xr-xctdb/config/events.d/05.system22
1 files changed, 22 insertions, 0 deletions
diff --git a/ctdb/config/events.d/05.system b/ctdb/config/events.d/05.system
index c305c4b1548..69fcec2e854 100755
--- a/ctdb/config/events.d/05.system
+++ b/ctdb/config/events.d/05.system
@@ -67,8 +67,30 @@ check_thresholds ()
fi
}
+set_monitor_filsystem_usage_defaults ()
+{
+ _fs_defaults_cache="${service_state_dir}/cache_monitor_filsystem_usage_defaults"
+
+ if [ ! -r "$_fs_defaults_cache" ] ; then
+ # Determine filesystem for each database directory, generate
+ # an entry to warn at 90%, de-duplicate entries, put all items
+ # on 1 line (so the read below gets everything)
+ for _t in "${CTDB_DBDIR:-${CTDB_VARDIR}}" \
+ "${CTDB_DBDIR_PERSISTENT:-${CTDB_VARDIR}/persistent}" \
+ "${CTDB_DBDIR_STATE:-${CTDB_VARDIR}/state}" ; do
+ df -kP "$_t" | awk 'NR == 2 { printf "%s:90\n", $6 }'
+ done | sort -u | xargs >"$_fs_defaults_cache"
+ fi
+
+ read CTDB_MONITOR_FILESYSTEM_USAGE <"$_fs_defaults_cache"
+}
+
monitor_filesystem_usage ()
{
+ if [ -z "$CTDB_MONITOR_FILESYSTEM_USAGE" ] ; then
+ set_monitor_filsystem_usage_defaults
+ fi
+
# Check each specified filesystem, specified in format
# <fs_mount>:<fs_warn_threshold>[:fs_unhealthy_threshold]
for _fs in $CTDB_MONITOR_FILESYSTEM_USAGE ; do