Created
March 26, 2010 14:24
-
-
Save marton/344939 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Before using, change the hostname, and emailadresses | |
# | |
# Script is created by Frode Marton Meling, 2010 | |
# | |
# | |
# TODO! | |
# - run the cli as deamon so it can run in the background and poll more frequently | |
# - do not re-send messages unless RAID statuses are changing | |
# - send email when system is back online | |
hostname='<put in your exact hostname>' | |
statusfile='/var/log/raidstatus' | |
logdrv=`/usr/sbin/cli logdrv -v` | |
phydrv=`/usr/sbin/cli phydrv -v` | |
clilog=`/usr/bin/tail /var/log/messages | grep "$hostname cli:"` | |
/usr/sbin/cli logdrv -v > $statusfile | |
/usr/sbin/cli phydrv -v >> $statusfile | |
check=`cat $statusfile | grep "Array functional status" | grep -v Online | wc -l` | |
if [ "$check" -gt 0 ] | |
then | |
/usr/sbin/ssmtp -oi <your sender email adress> << EOF | |
From: "XenServer Monitoring" <your sender email adress> | |
To: <the email receiving notifications> | |
Subject: ALERT!! - XenServer: EX8350 - POSSIBLE RAID PROBLEMS | |
CLI Log | |
======================================================= | |
$clilog | |
Logical drive information | |
======================================================= | |
$logdrv | |
Physical drive information | |
======================================================= | |
$phydrv | |
EOF | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment