From: Kyle Manna <2bluesc@gmail.com>
To: Stefan Malte Schumacher <stefan.m.schumacher@gmail.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: Monitoring Btrfs
Date: Mon, 17 Oct 2016 10:55:40 -0700 [thread overview]
Message-ID: <CAM9fjH7pfgHJysaSrdAPR3FoT-8XCT+DOe_cjeHqpqieaid0fg@mail.gmail.com> (raw)
In-Reply-To: <CAA3ktqmhhasyk8L+W3jz9ifYw7UMoL4ueg1HQp7Co3L39xYe9Q@mail.gmail.com>
On Mon, Oct 17, 2016 at 9:44 AM, Stefan Malte Schumacher
<stefan.m.schumacher@gmail.com> wrote:
> Hello
>
> 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[0][1] every
week. I used to use either an OnFailure[2] trigger or my failure
monitor log (aka systemd-journal) parser[3] 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[4] 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[5] (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.
[0] https://github.com/kylemanna/systemd-utils/blob/master/units/btrfs-scrub.service
[1] https://github.com/kylemanna/systemd-utils/blob/master/units/btrfs-scrub.timer
[2] https://github.com/kylemanna/systemd-utils/tree/master/onfailure
[3] https://github.com/kylemanna/systemd-utils/tree/master/failure-monitor
[4] https://blog.kylemanna.com/linux/logging-all-the-things-with-rsyslog-and-papertrail/
[5] https://www.elastic.co/guide/en/logstash/current/introduction.html
next prev parent reply other threads:[~2016-10-17 17:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-17 16:44 Monitoring Btrfs Stefan Malte Schumacher
2016-10-17 17:23 ` Austin S. Hemmelgarn
2016-10-18 3:23 ` Anand Jain
2016-10-18 12:39 ` Austin S. Hemmelgarn
2016-10-18 21:36 ` Anand Jain
2016-10-19 11:15 ` Austin S. Hemmelgarn
2016-10-19 13:06 ` Anand Jain
2016-10-19 13:33 ` Austin S. Hemmelgarn
2016-10-19 21:38 ` Anand Jain
2016-10-17 17:41 ` Zygo Blaxell
2016-10-17 17:55 ` Kyle Manna [this message]
2016-10-17 20:40 ` Chris Murphy
2016-10-18 12:41 ` Austin S. Hemmelgarn
2016-10-19 22:46 ` Stefan Malte Schumacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAM9fjH7pfgHJysaSrdAPR3FoT-8XCT+DOe_cjeHqpqieaid0fg@mail.gmail.com \
--to=2bluesc@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=stefan.m.schumacher@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).