[Xymon] Detecting read-only file system in Linux

Thomas Eckert thomas.eckert at it-eckert.de
Mon Mar 9 15:05:00 CET 2015


Hi,

> On 09 Mar 2015, at 13:44, SebA <spah at syntec.co.uk> wrote:

(…)

> Although we have some Debian systems, I was looking for a solution for another Linux distro.
>  
> If I was to write something myself to do it, I would check /proc/mounts and the best command I could find was:
> awk '$4~/(^|,)ro($|,)/' /proc/mounts
> which outputs:
> /dev/root / ext3 ro,data=ordered 0 0
> with sample line:
> /dev/root / ext3 ro,data=ordered 0 0

You could use the reported “Client data” / “clientlog” with a server-side extension. I have to admit that I’m not 100% sure if error-or-remounts are reflected properly by this — but `mount` seems to use `/proc/self/mountinfo` as it’s datasource, so it _should_ be ok.

Extract the reported `mount`-data for host bb.local:

	xymon 127.0.0.1 “clientlog bb.local section=mount”

Some testing of the output:

	(export host=bb.local; xymon 127.0.0.1:1984 "clientlog $host section=mount" | gawk '/[(,]+ro[,)]+/ { print "filesystem " $1 " mounted RO!" } ')

This would not require installing and maintaining an extension on every client. One drawback would be increased latency as the ro-check would be “indirect”.

Cheers
Thomas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20150309/af684490/attachment.html>


More information about the Xymon mailing list