summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/nagios-check.script42
-rw-r--r--tests/nagios-check.stdout4
-rw-r--r--yarns/0110-administration.yarn40
3 files changed, 40 insertions, 46 deletions
diff --git a/tests/nagios-check.script b/tests/nagios-check.script
deleted file mode 100755
index 3af550fe..00000000
--- a/tests/nagios-check.script
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-# Copyright 2011 Lars Wirzenius
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-opts="--warn-age=1h --critical-age=1d"
-
-# Backup, and pretend to do it during a particular time.
-$SRCDIR/tests/backup --pretend-time="1999-01-01 00:00:00"
-
-# Check there's a warning after one
-if ! $SRCDIR/tests/obnam $opts nagios-last-backup-age \
- --pretend-time="1999-01-01 01:00:01"
-then
- echo 'correctly returned non-zero exit code'
-else
- echo 'incorrectly returned zero exit code' 1>&2
- exit 1
-fi
-
-# Check there's an error.
-if ! $SRCDIR/tests/obnam $opts nagios-last-backup-age \
- --pretend-time="1999-01-02 00:00:01"
-then
- echo 'correctly returned non-zero exit code'
-else
- echo 'incorrectly returned zero exit code' 1>&2
- exit 1
-fi
diff --git a/tests/nagios-check.stdout b/tests/nagios-check.stdout
deleted file mode 100644
index 3fa00943..00000000
--- a/tests/nagios-check.stdout
+++ /dev/null
@@ -1,4 +0,0 @@
-WARNING: backup is old. last backup was 1999-01-01 00:00:00.
-correctly returned non-zero exit code
-CRITICAL: backup is old. last backup was 1999-01-01 00:00:00.
-correctly returned non-zero exit code
diff --git a/yarns/0110-administration.yarn b/yarns/0110-administration.yarn
new file mode 100644
index 00000000..96197b82
--- /dev/null
+++ b/yarns/0110-administration.yarn
@@ -0,0 +1,40 @@
+System administration tasks
+===========================
+
+System administrators may want to do some tasks related to backups
+that normal users might not care about, such as monitoring and
+integrity checking.
+
+
+Nagios monitoring support
+-------------------------
+
+Obnam has a command to help it be integrated into a monitoring system
+using Nagios plugins. First, setup a known configuration of the plugin
+to make things testable.
+
+ SCENARIO Nagios monitoring support
+ GIVEN user U sets configuration warn-age to 1h
+ AND user U sets configuration critical-age to 1d
+
+Then make a backup at a known (pretended) time.
+
+ GIVEN 1kB of new data in directory L
+ AND user U sets configuration pretend-time to 1999-01-01 00:00:00
+ WHEN user U backs up directory L to repository R
+
+Now, pretend that it's an hour and a second later. We should now be
+getting a warning.
+
+ GIVEN user U sets configuration pretend-time to 1999-01-01 01:00:01
+ WHEN user U attempts nagios-last-backup-age against repository R
+ THEN the attempt failed with exit code 1
+ AND the output matches "^WARNING:"
+
+If it's more than a day later (just a second over), there should be an
+error.
+
+ GIVEN user U sets configuration pretend-time to 1999-01-02 00:00:01
+ WHEN user U attempts nagios-last-backup-age against repository R
+ THEN the attempt failed with exit code 2
+ AND the output matches "^CRITICAL:"