#! /usr/bin/perl
#
# Nagios Plugin to detect and alert on the current
# US Threat Level.
#
# Requires Acme::Terror
#
# Usage:
# ======
# Simply add to your nagios configuration
#
# Author:
# =======
# Peter Milleson (pitr256@gmail.com) based on the 
# excellent work of Ian Bissett - ian.bissett@tekuiti.co.uk
#
# Changelog:
# ==========
# Version 0.02 - 21/09/2006 - Ian Bissett <ian.bissett@tekuiti.co.uk>
#    * Bug Fixes and Rationalisation of code
# Version 0.01 - 16/09/2006
#    * Initial Release
#
# This work is licensed under the Creative Commons Attribution 2.5 
# To view a copy of this license, visit http://creativecommons.org/licenses/by/2.5 or send
# a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.

our $VERSION="0.02";

use strict;
use warnings;

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

my $threat = $t->fetch();
print "$threat risk of terrorist attacks\n";

# Change exit status
exit 2 if($threat eq 'SEVERE');
exit 1 if($threat eq 'HIGH' or $threat eq 'ELEVATED');

# Default status of 0
exit 0;