How can I monitor a read-only filesystem on a Linux machine?

Document ID : KB000010050
Last Modified Date : 14/02/2018
Show Technical Document Details

The customer requirement is, whenever a Filesystem is going into Readonly mode, there should be an alarm triggered from UIM.

Currently the cdm probe doesn’t alerts when a Filesystem goes into read only mode.  But even though this is not covered out of the box by any probe you could try using logmon probe.

UIM - any versioncdm probelogmon probe

Configure the logmon probe to run the mount -l command and then create 'Watcher' rules to parse the data and create alarms when the readonly attribute 'ro' is found.

Here is an example...

You can run something like this from the logmon script:

mount |grep "(ro"|awk -F ' ' '{print $1 " " $6}'

$1 will give the disk e.g /dev/sda1 and $6 will give the mount options. so a sample output might look like this:

/dev/sdb1 (ro,noatime)
/dev/sda6 (ro,noatime)
/dev/sdc5 (ro,noatime)