On Mon, Oct 17, 2016 at 9:44 AM, Stefan Malte Schumacher
> I would like to monitor my btrfs-filesystem for missing drives. On
> Debian mdadm uses a script in /etc/cron.daily, which calls mdadm and
> sends an email if anything is wrong with the array. I would like to do
> the same with btrfs. In my first attempt I grepped and cut the
> information from "btrfs fi show" and let the script send an email if
> the number of devices was not equal to the preselected number.
> 1) Has anybody already written a script like this? After all, there is
> no need to reinvent the wheel a second time.
Not that I have a solution to your primary question regarding message
parsing, but do something different which may offer a different
perspective on your monitoring and reporting.
I employ systemd with timers to scrub my btrfs volumes every
week. I used to use either an OnFailure trigger or my failure
monitor log (aka systemd-journal) parser to send me emails if the
service failed to run. This is a more "modern" approach to
cron.weekly + custom shell script for people that like systemd, love
it or hate it.
Recently I dropped the systemd journal parser for remote logging with
rsyslog + Papertrail with a few alerts for things like "systemd
Failed to start" which indicates that the script returned a non-zero
exit code. Papertrail then emails me when any of a handful of
machines trip up.
It's also worth noting logstash (or similar) may be another way to
parse log files. It could be a bloated overkill solution for
something that a 10 line shell script could accomplish, depends on if
you leverage it for things beyond basic log parsing.
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html