Some Linux distros - Red Hat and CentOS, to wit - have a default behavior where, upon running into a hard disk problem, the affected filesystems are automatically remounted readonly. That's a good idea as far as preventing further filesystem corruption by ongoing writes is concerned, but it can also cause serious and confusing malfunctions of whatever services the host provides.

In the best possible world, your Nagios would be allowed to read the syslogs, detect the error messages there, and alert you to the problem, pronto. In the real world, however, you can find yourself tasked with the administration (and monitoring) of a service/software installed on a machine where someone else holds the power of root - and is unwilling to share. :-}

check_ro_fs reads the relevant data from /proc/filesystems and /proc/mounts (which are readable by nonprivileged users) and alerts you if some "real" filesystem is mounted readonly. (This method avoids both parsing the human-readable output of "mount", and the problems that can arise when /etc/mtab is itself on the affected fs.)

Version history

v1.1 (10-Sep-2010): Add an ignore for "/dev/.static/dev", a ro mount often found on Ubuntu systems.