check runs with free version, pro (former enterprise edition) tested with 2.3.x, 2.4.x, probably works on 2.5.x
Scenario: You are monitoring mounted shares using CIFS or NFS on your Linux Server and your network or service gets a hickup for a few seconds between two checks of your monitoring host: The mount gets stale at the moment your postgres needs to write its transaction logs to the formerly mounted share. Result will be the LOCAL mount point gets filled up.
One solution could be to decrease the interval of the check on the monitoring host.
A quick and dirty solution could be this small shell script. copy, make it executable and rediscover the host. Takes all the remote mounts out of fstab, adjustable timeout:
check_stale_mounts:
##!/bin/bash
# Checkmk Local Check: Stale/Hanging NFS & SMB Mounts
# Installation: /usr/lib/check_mk_agent/local/stale_mounts_check.sh
SERVICE_NAME="Network_Mounts"
STATUS=0
DETAILS=()
FAILED=()
TIMEOUT=5
# get fstab entries of type nfs/nfs4/cifs (ignore comments and swap
while IFS= read -r line; do
DEV=$(echo "$line" | awk '{print $1}')
MP=$(echo "$line" | awk '{print $2}')
FSTYPE=$(echo "$line" | awk '{print $3}')
[[ -z "$MP" ]] && continue
# Prüfe ob tatsächlich gemountet
if ! findmnt -rn "$MP" &>/dev/null; then
STATUS=2
FAILED+=("$MP ($FSTYPE): NOT MOUNTED")
continue
fi
# stat mit Timeout – hängt bei stale mounts
if ! timeout "$TIMEOUT" stat "$MP" &>/dev/null; then
STATUS=2
FAILED+=("$MP ($FSTYPE): STALE/HANGING")
else
DETAILS+=("$MP: OK")
fi
done < <(grep -E '^\s*[^#]\S+\s+\S+\s+(nfs4?|cifs)\s' /etc/fstab)
# Keine Mounts in fstab gefunden
if [[ ${#DETAILS[@]} -eq 0 ]] && [[ ${#FAILED[@]} -eq 0 ]]; then
echo "0 ${SERVICE_NAME} - No NFS/CIFS mounts in fstab"
exit 0
fi
# Output
ALL=("${FAILED[@]}" "${DETAILS[@]}")
SUMMARY=$(IFS=', '; echo "${ALL[*]}")
echo "${STATUS} ${SERVICE_NAME} - ${SUMMARY}"