From 6d73acc866f1c33a82cfe3b3b67836a363954c60 Mon Sep 17 00:00:00 2001 From: Brice Waegeneire Date: Tue, 5 Jul 2022 16:00:22 +0200 Subject: [PATCH] Add nagios check mount rw --- nagios-nrpe/files/plugins/check_readwrite | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 nagios-nrpe/files/plugins/check_readwrite diff --git a/nagios-nrpe/files/plugins/check_readwrite b/nagios-nrpe/files/plugins/check_readwrite new file mode 100755 index 00000000..578d9740 --- /dev/null +++ b/nagios-nrpe/files/plugins/check_readwrite @@ -0,0 +1,20 @@ +#!/bin/sh +# +# Verify mounted filesystems are readable and writable. + +filesystems=$* + +exit_code=0 +for filesystem in $filesystems; do + if findmnt --options ro --noheadings "${filesystem}"; then + exit_code=2 + fi +done + +if [ $exit_code != 0 ]; then + echo "CRITICAL - Above filesystems aren't monted in read and write mode" +else + echo "OK - All fine" +fi + +exit "${exit_code}"