#! /usr/bin/perl
#
# Nagios Plugin to detect and alert on the current
# UK Threat Level.
#
# Requires Acme::Terror::UK
#
# Usage:
# ======
# Simply add to your nagios configuration
#
# Author:
# =======
# Ian Bissett - ian.bissett@tekuiti.co.uk
#
# Changelog:
# ==========
# Version 1.00 - 14/08/2006
#    * Initial Release
#
# This work is licensed under the Creative Commons Attribution 2.0 UK: England & Wales License.
# To view a copy of this license, visit http://creativecommons.org/licenses/by/2.0/uk/ or send
# a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.

our $VERSION="1.00";

use strict;
use warnings;

use Acme::Terror::UK;
my $t = Acme::Terror::UK->new();

my $level  = $t->level();
my $threat = $t->fetch();

if ($level == Acme::Terror::UK::CRITICAL) {
        print "$threat: You have no chance to survive. Make your plans!\n";
        exit 2;
}

if($level == Acme::Terror::UK::SEVERE) {
        print "$threat: You are on your way to destruction!\n";
        exit 1;
}

if($level == Acme::Terror::UK::SUBSTANTIAL) {
        print "$threat: Somebody set us up the bomb!\n";
        exit 1;
}

if($level == Acme::Terror::UK::MODERATE) {
        print "$threat: We Get Signal!\n";
        exit 0;
}

if($level == Acme::Terror::UK::LOW) {
        print "$threat: How are you Gentlemen!!\n";
        exit 0;
}

if($level == Acme::Terror::UK::UNKNOWN) {
        print "$threat: What Happen?\n";
        exit 3;
}
