« t/Templates/Plugins/Nagios/check_xml-monitoring.t
↑ Summary
t/Templates/Plugins/IO/check_template-IO.t »
| 1 | #!/usr/bin/env perl -w -I .. | ||||||||||
| 2 | # | ||||||||||
| 3 | # ... Tests via check_xml.pl | ||||||||||
| 4 | # | ||||||||||
| 5 | # $Id: check_xml.t, v 1.0 2006/02/01 Alex Peeters Exp $ | ||||||||||
| 6 | # | ||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Test; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use ASNMTAP::Asnmtap::Plugins::NPTest; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | use vars qw($tests); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | BEGIN {$tests = 23; plan tests => $tests} | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 1 | my $t; | |||||||||
| 16 | 1 | my $prefix = '../plugins/nagios/templates'; | |||||||||
| 17 | 1 | my $plugin = 'check_xml.pl'; | |||||||||
| 18 | |||||||||||
| 19 | 1 | ▶ | if ( -x "$prefix/$plugin" ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 1 | $t += checkCmd( "$prefix/$plugin -V", 3, "/$plugin/"); | |||||||||
| 21 | 1 | $t += checkCmd( "$prefix/$plugin -h", 3); | |||||||||
| 22 | 1 | $t += checkCmd( "$prefix/$plugin", 3, '/Missing command line argument environment/'); | |||||||||
| 23 | 1 | $t += checkCmd( "$prefix/$plugin -e P", 3, '/Missing command line argument filename/'); | |||||||||
| 24 | 1 | $t += checkCmd( "$prefix/$plugin -e P -F $prefix/xml/doNotExist", 3, '/Missing command line argument interval/'); | |||||||||
| 25 | 1 | $t += checkCmd( "$prefix/$plugin -e P -F $prefix/xml/doNotExist -i 1", 3, '/Missing command line argument hostname/'); | |||||||||
| 26 | 1 | $t += checkCmd( "$prefix/$plugin -e P -F $prefix/xml/doNotExist -i 1 -H hostname", 3, '/Missing command line argument service/'); | |||||||||
| 27 | 1 | $t += checkCmd( "$prefix/$plugin -e P -F $prefix/xml/doNotExist -i 1 -H hostname -s service", 3, '/UNKNOWN - Check Nagios by XML: The XML file \'[//\w]+\' doesn\'t exist|/'); | |||||||||
| 28 | 1 | $t += checkCmd( "$prefix/$plugin -e P -F $prefix/xml/nagios-1.0.xml -i 1 -H hostname -s service", 3, '/ERROR: Content Error: - Host: Host Name ... ne hostname - Service: Service Name ... ne service - Environment: LOCAL ne P/'); | |||||||||
| 29 | 1 | $t += checkCmd( "$prefix/$plugin -e P -F $prefix/xml/nagios-1.0.xml -i 10 -H 'Host Name ...' -s service", 3, '/ERROR: Content Error: - Service: Service Name ... ne service - Environment: LOCAL ne P/'); | |||||||||
| 30 | 1 | $t += checkCmd( "$prefix/$plugin -e P -F $prefix/xml/nagios-1.0.xml -i 10 -H 'Host Name ...' -s 'Service Name ...'", 3, '/ERROR: Content Error: - Environment: LOCAL ne P/'); | |||||||||
| 31 | 1 | $t += checkCmd( "$prefix/$plugin -e L -F $prefix/xml/nagios-1.0.xml -i 10 -H 'Host Name ...' -s 'Service Name ...'", 3, '/Result into XML file \'[//\w\-\.]+\' are out of date:/'); | |||||||||
| 32 | } else { | ||||||||||
| 33 | 0 | $t += skipMissingCmd( "$prefix/$plugin", $tests ); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 1 | ▶ | exit(0) if defined($Test::Harness::VERSION); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 1 | exit($tests - $t); | |||||||||