Monkey Albino

Linux altar53.supremepanel53.com 4.18.0-553.8.1.lve.el8.x86_64 #1 SMP Thu Jul 4 16:24:39 UTC 2024 x86_64
/ lib64/ nagios/ plugins/

//lib64/nagios/plugins/check_filesystem.sh

#!/bin/bash
#
# Nagios plugin to check if mounted devices are rw
#
STATE_OK=0
STATE_CRITICAL=2

for i in `grep ' ro,' /proc/mounts | awk '{ print $2 }'`
do
        OUTPUT=$(grep ' $i ' /etc/fstab | awk '{ print $4 }' | grep 'ro' 2>/dev/null)
        if [ $i == 0 ]; then
                MESSAGE="$i $MESSAGE";
        fi
done

if [ "$MESSAGE" ]
then
        echo "CRITICAL: Read-only filesystem: $MESSAGE"
        exit $STATE_CRITICAL
fi

echo "No Read-Only filesystems"
exit $STATE_OK