Read-Only Partition Check for remote Client

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
firasshawareb
Posts: 1
Joined: Sun Mar 17, 2019 3:30 am

Read-Only Partition Check for remote Client

Post by firasshawareb »

Hello All,

I am trying to find a way to make Nagios-XI able to see if some host partition is read-only or not

sample Bash Script :

#Build File List array
FSROEXTRACT=`cat /etc/fstab| egrep "ext" | grep -v "^#"| awk '{ print $2 }'`
FSROLIST=(
$FSROEXTRACT
)

#Check if each file system is writeable
count=0
FSROCHECKTOTAL=0
while [ "x${FSROLIST[count]}" != "x" ]
do
FSROCHECK=`touch ${FSROLIST[count]}/test.txt 2> /dev/null && { rm ${FSROLIST[count]}/test.txt 2> /dev/null; echo "0"; } || echo "1"`
FSROCHECKTOTAL=$(( $FSROCHECKTOTAL + $FSROCHECK ))
if [ "$FSROCHECK" == 1 ] && [ -d "${FSROLIST[count]}" ]; then
echo $CURDATE ${FSROLIST[count]} is read only. >> /tmp/fsrocheck.log
fi
count=$(( $count + 1 ))
done

if [ "$FSROCHECKTOTAL" == 0 ]; then
echo $CURDATE all file systems are writeable. >> /tmp/fsrocheck.log
fi


Regards,
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Read-Only Partition Check for remote Client

Post by npolovenko »

Hello, @firasshawareb. To get your plugin to work with Nagios you need to add proper exit codes. Check the Plugin Return Codes section of this KB article.
https://nagios-plugins.org/doc/guidelines.html


You also need to install a remote agent such as NRPE that will execute this script and send the result back to the Nagios server.
https://support.nagios.com/kb/article.php?id=8

PS: Seems like we have a couple plugins to check read-only mounts on the Exchange as well.
https://exchange.nagios.org/directory/P ... ts/details
https://michielonline.nl/?q=node/4
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked