Scripting Xsan monitoring

Tuesday, April 07 2009 @ 04:01 PM EDT

Contributed by: gsullivan318

This is a bash script I wrote for automating notifications for things that Xsan doesn't notify you about by itself. 318 has quite a few Xsan deployments to keep an eye on, and this helps get a quick overview of volume status and latency for them, so we know which ones need a little extra attention.

Lithium and other similar applications can do some of what we're doing here, but this is a quick way to do it without licensing.

Here's what it does:

  1. Grabs volume names by looking at the directories in /Library/Filesystems/Xsan/data
  2. Runs cvfsck -nv on the volumes it finds, extracting the Volume Status (Clean or Dirty)
  3. Looks through the volumes' current cvlog for hourly latency summaries from the current day, pulling out sysavg
  4. f the volume is Dirty, or any of the syavg numbers are above a predefined level, sends a notification email

  Options:

   -h
   Prints a usage summary.

   -l [Latency Level]
   Sets your acceptable latency level. Default is 500. You'll probably want to set that higher, especially if you've got a Promise instead of an Xserve RAID.

   -a [email address]
   Specify the address you want to send notifications to. Default is "root@localhost". You'll probably want to change that too.

I created an installer package, that installs both the script and a launch daemon that runs daily at 11 PM. Or you can just grab the script, sans installer.

3 comments



http://www.xsanity.com/article.php?story=20090407150134377