summaryrefslogtreecommitdiff
path: root/bytemark
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-05-29 15:25:17 +0100
committerSteve Kemp <steve@steve.org.uk>2013-05-29 15:25:17 +0100
commitb4b4d2a893384d6eb1ade8d2b7ffada6b951d126 (patch)
tree4a655ad3af7377b19cfd75d1e7071cff04a5b8ba /bytemark
parent299b657c0cc24b3cd2ee81725768e4d24f73dc0c (diff)
Updated to read the alert-target from the configuration file.
Diffstat (limited to 'bytemark')
-rwxr-xr-xbytemark/bin/custodian-enqueue-parse-test46
-rwxr-xr-xbytemark/bin/custodian-queue-monitor33
2 files changed, 70 insertions, 9 deletions
diff --git a/bytemark/bin/custodian-enqueue-parse-test b/bytemark/bin/custodian-enqueue-parse-test
index abd90f5..9f072e6 100755
--- a/bytemark/bin/custodian-enqueue-parse-test
+++ b/bytemark/bin/custodian-enqueue-parse-test
@@ -1,16 +1,48 @@
#!/bin/sh
#
-# Parse the two configuration files we use, and alert if there
-# is a failure.
+# Parse the configuration files we use, and alert if there is a failure.
#
+# Steve
+# --
+
+
+#
+# Find the hostname of the mauve-server to alert against
+#
+if [ -e /etc/custodian/custodian.cfg ] ; then
+ alert=$(grep ^mauve_target /etc/custodian/custodian.cfg 2>/dev/null | awk -F= '{print $2}' )
+fi
+
+
+#
+# If we didn't find one then we'll use the default.
+#
+if [ -z "$alert" ]; then
+ alert=alert.bytemark.co.uk
+fi
+
+
+#
+# For each file.
+#
for file in bytemark.cfg managed-clients.cfg ; do
- if ( ! custodian-enqueue --test --file /etc/custodian/$file >/dev/null 2>/dev/null ); then
- mauvesend alert.bytemark.co.uk -i custodian-enqueue-$file -r now -s "Parse failure from custodian-enqueue against $file." --detail="<p>The file was not added to the queue successfully due to syntax error. Please fix.</p>"
- else
- mauvesend alert.bytemark.co.uk -i custodian-enqueue-$file -c now -s "Parse failure from custodian-enqueue against $file." --detail="<p>The file was not added to the queue successfully due to syntax error. Please fix.</p>"
+ #
+ # If we cannot parse ..
+ #
+ if ( ! custodian-enqueue --test --file /etc/custodian/$file >/dev/null 2>/dev/null ); then
+
+ #
+ # Raise an alert.
+ #
+ mauvesend $alert -i custodian-enqueue-$file -r now -s "Parse failure from custodian-enqueue against $file." --detail="<p>The file was not added to the queue successfully due to syntax error. Please fix.</p>"
+ else
- fi
+ #
+ # Otherwise clear any prior alert.
+ #
+ mauvesend $alert -i custodian-enqueue-$file -c now -s "Parse failure from custodian-enqueue against $file." --detail="<p>The file was not added to the queue successfully due to syntax error. Please fix.</p>"
+ fi
done
diff --git a/bytemark/bin/custodian-queue-monitor b/bytemark/bin/custodian-queue-monitor
index 0b32370..ead65be 100755
--- a/bytemark/bin/custodian-queue-monitor
+++ b/bytemark/bin/custodian-queue-monitor
@@ -9,13 +9,42 @@
#
+# Find the hostname of the mauve-server to alert against
+#
+if [ -e /etc/custodian/custodian.cfg ] ; then
+ alert=$(grep ^mauve_target /etc/custodian/custodian.cfg 2>/dev/null | awk -F= '{print $2}' )
+fi
+
+
+#
+# If we didn't find one then we'll use the default.
+#
+if [ -z "$alert" ]; then
+ alert=alert.bytemark.co.uk
+fi
+
+
+#
# Maximum queue size.
#
max=5000
+
+#
+# If the queu is too large.
+#
if ( custodian-queue --monitor=$max ) ; then
- mauvesend alert.bytemark.co.uk -i custodian -c now -s "Our custodian queue is too full" --detail="<p>The custodian queue doesn't seem to be emptying [alert threshold is $max].</p><p>Is there a bug, or do we need to add more workers? See https://wiki.bytemark.co.uk/Main/CustodianMonitoring</p>"
+
+ #
+ # Raise an alert
+ #
+ mauvesend $alert -i custodian -c now -s "Our custodian queue is too full" --detail="<p>The custodian queue doesn't seem to be emptying [alert threshold is $max].</p><p>Is there a bug, or do we need to add more workers? See https://wiki.bytemark.co.uk/Main/CustodianMonitoring</p>"
+
else
- mauvesend alert.bytemark.co.uk -i custodian -r now -s "Our custodian queue is too full" --detail="<p>The custodian queue doesn't seem to be emptying [alert threshold is $max].</p><p>Is there a bug, or do we need to add more workers? See https://wiki.bytemark.co.uk/Main/CustodianMonitoring</p>"
+
+ #
+ # Otherwise clear any prior alert.
+ #
+ mauvesend $alert -i custodian -r now -s "Our custodian queue is too full" --detail="<p>The custodian queue doesn't seem to be emptying [alert threshold is $max].</p><p>Is there a bug, or do we need to add more workers? See https://wiki.bytemark.co.uk/Main/CustodianMonitoring</p>"
fi