diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-06-08 12:27:44 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-06-08 12:27:44 +0000 |
commit | 2c6651034f76e2bccb549a867485f8fabbf07cb1 (patch) | |
tree | 8de53d7efe4564017e1ebce73353c7e3a3c8b548 /t/Nagios-Plugin.t | |
parent | 83e29d795dddf34a652cda8665179b77372ddcfe (diff) | |
download | monitoring-plugin-perl-2c6651034f76e2bccb549a867485f8fabbf07cb1.tar.gz |
Initial revision
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1419 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't/Nagios-Plugin.t')
-rw-r--r-- | t/Nagios-Plugin.t | 32 |
1 files changed, 32 insertions, 0 deletions
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 @@ | |||
1 | |||
2 | use strict; | ||
3 | use Test::More tests => 5; | ||
4 | BEGIN { use_ok('Nagios::Plugin') }; | ||
5 | |||
6 | use Nagios::Plugin::Base; | ||
7 | Nagios::Plugin::Base->exit_on_die(0); | ||
8 | Nagios::Plugin::Base->print_on_die(0); | ||
9 | |||
10 | my $p = Nagios::Plugin->new; | ||
11 | isa_ok( $p, "Nagios::Plugin"); | ||
12 | |||
13 | $p->shortname("PAGESIZE"); | ||
14 | |||
15 | my $t = $p->set_thresholds( warning => "10:25", critical => "25:" ); | ||
16 | |||
17 | $p->add_perfdata( | ||
18 | label => "size", | ||
19 | value => 1, | ||
20 | uom => "kB", | ||
21 | threshold => $t, | ||
22 | ); | ||
23 | |||
24 | cmp_ok( $p->all_perfoutput, 'eq', "size=1kB;10:25;25:", "Perfdata correct"); | ||
25 | |||
26 | my $o = $p->die( return_code => $t->get_status(1), message => "page size at http://... was 1kB" ); | ||
27 | cmp_ok( $o, "eq", 'PAGESIZE CRITICAL page size at http://... was 1kB | size=1kB;10:25;25:', "Output okay"); | ||
28 | |||
29 | cmp_ok( $p->die( return_code => $t->get_status(30), message => "page size at http://... was 30kB" ), | ||
30 | "eq", 'PAGESIZE WARNING page size at http://... was 30kB | size=1kB;10:25;25:', "Output okay"); | ||
31 | |||
32 | |||