From 2c6651034f76e2bccb549a867485f8fabbf07cb1 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Thu, 8 Jun 2006 12:27:44 +0000 Subject: Initial revision git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1419 f882894a-f735-0410-b71e-b25c423dba1c --- t/Nagios-Plugin.t | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 t/Nagios-Plugin.t (limited to 't/Nagios-Plugin.t') diff --git a/t/Nagios-Plugin.t b/t/Nagios-Plugin.t new file mode 100644 index 0000000..38e792d --- /dev/null +++ b/t/Nagios-Plugin.t @@ -0,0 +1,32 @@ + +use strict; +use Test::More tests => 5; +BEGIN { use_ok('Nagios::Plugin') }; + +use Nagios::Plugin::Base; +Nagios::Plugin::Base->exit_on_die(0); +Nagios::Plugin::Base->print_on_die(0); + +my $p = Nagios::Plugin->new; +isa_ok( $p, "Nagios::Plugin"); + +$p->shortname("PAGESIZE"); + +my $t = $p->set_thresholds( warning => "10:25", critical => "25:" ); + +$p->add_perfdata( + label => "size", + value => 1, + uom => "kB", + threshold => $t, + ); + +cmp_ok( $p->all_perfoutput, 'eq', "size=1kB;10:25;25:", "Perfdata correct"); + +my $o = $p->die( return_code => $t->get_status(1), message => "page size at http://... was 1kB" ); +cmp_ok( $o, "eq", 'PAGESIZE CRITICAL page size at http://... was 1kB | size=1kB;10:25;25:', "Output okay"); + +cmp_ok( $p->die( return_code => $t->get_status(30), message => "page size at http://... was 30kB" ), + "eq", 'PAGESIZE WARNING page size at http://... was 30kB | size=1kB;10:25;25:', "Output okay"); + + -- cgit v1.2.3-74-g34f1