Currently I monitor for a failed filesystem (as a result of a failed disk, controller, whatever) by checking syslog for messages like this:
2017-06-15T17:18:10.081665+00:00 2017-06-15T17:18:10+00:00 localhost kernel: [1381844.448488] blk_update_request: critical target error, dev sdj, sector 97672656
2017-06-15T17:18:10.724329+00:00 2017-06-15T17:18:10+00:00 localhost kernel: [1381845.047871] XFS (md0): metadata I/O error: block 0x2baa81400 ("xlog_iodone") error 121 numblks 512
2017-06-15T17:18:10.724329+00:00 2017-06-15T17:18:10+00:00 localhost kernel: [1381845.124418] XFS (md0): xfs_do_force_shutdown(0x2) called from line 1177 of file /build/linux-lts-wily-8ENwT0/linux-lts-wily-4.2.0/fs/xfs/xfs_log.c. Return address = 0xffffffffc050e100
2017-06-15T17:18:10.724349+00:00 2017-06-15T17:18:10+00:00 localhost kernel: [1381845.124425] XFS (md0): Log I/O Error Detected. Shutting down filesystem
2017-06-15T17:18:10.724349+00:00 2017-06-15T17:18:10+00:00 localhost kernel: [1381845.124452] XFS (md0): xfs_log_force: error -5 returned.
2017-06-15T17:18:10.724354+00:00 2017-06-15T17:18:10+00:00 localhost kernel: [1381845.163480] XFS (md0): Please umount the filesystem and rectify the problem(s)
2017-06-15T17:18:40.612572+00:00 2017-06-15T17:18:40+00:00 localhost kernel: [1381875.074647] XFS (md0): xfs_log_force: error -5 returned.
2017-06-15T17:19:10.612554+00:00 2017-06-15T17:19:10+00:00 localhost kernel: [1381905.101606] XFS (md0): xfs_log_force: error -5 returned.
2017-06-15T17:19:40.612558+00:00 2017-06-15T17:19:40+00:00 localhost kernel: [1381935.128546] XFS (md0): xfs_log_force: error -5 returned.
This is ok but I'd really like a more canonical check. The only thing I can think of is to write a script that attempts to write a file to disk and fires off an alarm if it can't for any reason. However, that seems like it's prone to false positives - there are several reasons why a file might not be able to be written, not just a failed filesystem.
Aside from grepping the logs or writing a canary file to disk, how can this be monitored?