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:
- Grabs volume names by looking at the directories in /Library/Filesystems/Xsan/data
- Runs cvfsck -nv on the volumes it finds, extracting the Volume Status (Clean or Dirty)
- Looks through the volumes' current cvlog for hourly latency summaries from the current day, pulling out sysavg
- 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.


It seems to work fine
one bug ( or a feature :) I found is that complains if the xsan directories /Library/Filesystems/Xsan/ and /Library/Filesystems/Xsan/data contains .DS_Store files
solution was to remove these files