blib/lib/ASNMTAP/Asnmtap/Plugins.pm

filter: Statementstmt 69.6% 344 / 494 Branchbran 51.6% 290 / 562 Conditioncond 44.1% 57 / 129 MC/DCmcdc 21.9% 18 / 82 Subroutinesub 88.8% 24 / 27 Podpod 100% 14 / 14 totaltotal 57.1% 747 / 1308 CC 328 SCAR 63.9
CC
328
Cov
58%
_getOptions
1395.7
exit
806.5
pluginValues
202.9
CRAP 594.5
« blib/lib/ASNMTAP/Asnmtap/Applications.pm ↑ Summary plugins/templates/check_template-mail-xml-fingerprint-xml-monitoring-1.1.pl »
1 # ----------------------------------------------------------------------------------------------------------
2 # © Copyright 2000-2011 by Alex Peeters [alex.peeters@citap.be]
3 # ----------------------------------------------------------------------------------------------------------
4 # 2011/mm/dd, v3.002.003, package ASNMTAP::Asnmtap::Plugins Object-Oriented Perl
5 # ----------------------------------------------------------------------------------------------------------
6  
7 package ASNMTAP::Asnmtap::Plugins;
8  
9 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10  
11 102 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 102 ▶use warnings; # Must be used in test mode only. This reduces a little process speed
Subroutine BEGIN: called CC=1 SCAR=0.0
13 #use diagnostics; # Must be used in test mode only. This reduces a lot of process speed
14  
15 102 ▶no warnings 'deprecated';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
18  
19 102 ▶use Carp qw(carp);
Subroutine BEGIN: called CC=1 SCAR=0.0
20 102 ▶use Time::HiRes qw(gettimeofday tv_interval);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 # include the class files - - - - - - - - - - - - - - - - - - - - - - - -
23  
24 102 ▶use ASNMTAP::Asnmtap qw(:ASNMTAP :COMMANDS :_HIDDEN :PLUGINS);
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27  
28 102 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
29 102 ▶ use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 102 @ASNMTAP::Asnmtap::Plugins::ISA = qw(Exporter ASNMTAP::Asnmtap);
32  
33 102 %ASNMTAP::Asnmtap::Plugins::EXPORT_TAGS = (ALL => [ qw($APPLICATION $BUSINESS $DEPARTMENT $COPYRIGHT $SENDEMAILTO
34 $CAPTUREOUTPUT
35 $PREFIXPATH $LOGPATH $PIDPATH $PERL5LIB $MANPATH $LD_LIBRARY_PATH
36 $ALARM_OFF %ERRORS %STATE %TYPE
37  
38 $CHATCOMMAND $DIFFCOMMAND $KILLALLCOMMAND $PERLCOMMAND $PPPDCOMMAND $ROUTECOMMAND $RSYNCCOMMAND $SCPCOMMAND $SSHCOMMAND
39  
40 &_checkAccObjRef
41 &_checkSubArgs0 &_checkSubArgs1 &_checkSubArgs2
42 &_checkReadOnly0 &_checkReadOnly1 &_checkReadOnly2
43 &_dumpValue
44  
45 $PLUGINPATH) ],
46  
47 PLUGINS => [ qw($APPLICATION $BUSINESS $DEPARTMENT $COPYRIGHT $SENDEMAILTO
48 $CAPTUREOUTPUT
49 $PREFIXPATH $PLUGINPATH $LOGPATH $PIDPATH $PERL5LIB $MANPATH $LD_LIBRARY_PATH
50 %ERRORS %STATE %TYPE) ],
51  
52 COMMANDS => [ qw($CHATCOMMAND $DIFFCOMMAND $KILLALLCOMMAND $PERLCOMMAND $PPPDCOMMAND $ROUTECOMMAND $RSYNCCOMMAND $SCPCOMMAND $SSHCOMMAND) ],
53  
54 _HIDDEN => [ qw(&_checkAccObjRef
55 &_checkSubArgs0 &_checkSubArgs1 &_checkSubArgs2
56 &_checkReadOnly0 &_checkReadOnly1 &_checkReadOnly2
57 &_dumpValue) ] );
58  
59 102 @ASNMTAP::Asnmtap::Plugins::EXPORT_OK = ( @{ $ASNMTAP::Asnmtap::Plugins::EXPORT_TAGS{ALL} } );
60  
61 102 $ASNMTAP::Asnmtap::Plugins::VERSION = do { my @r = (q$Revision: 3.002.003$ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };
62 }
63  
64 102 our $ALARM_OFF = 0;
65  
66 # Constructor & initialisation - - - - - - - - - - - - - - - - - - - - -
67  
68 102 ▶sub _init {
Subroutine _init: called CC=62 SCAR=47.0
69 102 $_[0]->SUPER::_init($_[1]);
70 102 ▶ carp ('ASNMTAP::Asnmtap::Plugins: _init') if ( $_[0]->{_debug} );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_debug"} 0 102 102
71  
72 # --httpdump & --dumphttp tijdelijk voor backwards compatibiliteit !!!
73  
74 102 $_[0]->{_programUsageSuffix} = ' [-S|--status N] [-A|asnmtapEnv [F|T]|[F|T]|[F|T]] [-O|onDemand F|T|N|Y] [-L|--logging <LOGGING>] [-D|--debugfile|--httpdump|--dumphttp <DEBUGFILE>] [-d|--debug F|T|L|M|A|S] '. $_[0]->{_programUsageSuffix};
75  
76 $_[0]->{_programHelpSuffix} = "
77 -S, --status=N
78 N(agios) : Nagios custom plugin output (default)
79 -A, --asnmtapEnv=[F|T]|[F|T]|[F|T]
80 F(alse) : all screendebugging off (default)
81 T(true) : all screendebugging on
82 |
83 F(alse) : all file debugging off (default)
84 T(true) : all file debugging on
85 |
86 F(alse) : nok file debugging off (default)
87 T(true) : nok file debugging on
88 -O, --onDemand=F|T|N|Y
89 F(alse)/N(o) : normal plugin execution (default)
90 T(true)/Y(es) : plugin launched on demand
91 -L, --logging=LOGGING
92 write logging to file LOGGING
93 -D, --debugfile, --httpdump, --dumphttp=DEBUGFILE
94 write debug to file DEBUGFILE
95 -d, --debug=F|T|L|M|A|S
96 F(alse) : screendebugging off (default)
97 T(true) : normal screendebugging on
98 L(ong) : long screendebugging on
99 M(oderator) : long screendebugging on for Moderators
100 A(dmin) : long screendebugging on for Admins
101 S(erver Admin): long screendebugging on for Server Admins
102 102 " . $_[0]->{_programHelpSuffix};
103  
104 102 push ( @{ $_[0]->{_programGetOptions} }, 'status|S:s', 'asnmtapEnv|A:s', 'onDemand|O:s', 'logging|L:s', 'debugfile|D|dumphttp|httpdump:s', 'debug|d:s' );
105  
106 102 my ($_programUsageSuffix, $_programHelpSuffix);
107  
108 102 foreach ( @{ $_[0]->{_programGetOptions} } ) {
109 1729 for ($_) {
110 1729 ▶ /^trendline\|T([:=])i$/ && do { $_[0]->{_getOptionsType}->{trendline} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-T|--trendline <TRENDLINE>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-T, --trendline <TRENDLINE>\n trendline threshold (seconds) from which a TRENDLINE status will result for the plugin response time\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^trendline\|T([:=])i$/ and do { $_[0]{"_getOptionsType"}{"trendline"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-T|--trendline <TRENDLINE>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-T, --trendline <TRENDLINE>\n trendline threshold (seconds) from which a TRENDLINE status will result for the plugin response time\n"; last } 73 1656 1729
$1 eq ':' ? : 73 0 73
$1 eq ':' ? : 73 0 73
111 1656 ▶ /^timeout\|t([:=])i$/ && do { $_[0]->{_getOptionsType}->{timeout} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-t|--timeout <TIMEOUT>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-t, --timeout=<TIMEOUT>\n timeout threshold (seconds) from which a UNKNOWN status will result for the plugin execution time\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^timeout\|t([:=])i$/ and do { $_[0]{"_getOptionsType"}{"timeout"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-t|--timeout <TIMEOUT>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-t, --timeout=<TIMEOUT>\n timeout threshold (seconds) from which a UNKNOWN status will result for the plugin execution time\n"; last } 56 1600 1656
$1 eq ':' ? : 56 0 56
$1 eq ':' ? : 56 0 56
112 1600 ▶ /^environment\|e([:=])s$/ && do { $_[0]->{_getOptionsType}->{environment} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-e|--environment <ENVIRONMENT>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-e, --environment=<ENVIRONMENT>\n P(roduction)\n S(imulation)\n A(cceptation)\n T(est)\n D(evelopment)\n L(ocal)\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^environment\|e([:=])s$/ and do { $_[0]{"_getOptionsType"}{"environment"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-e|--environment <ENVIRONMENT>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-e, --environment=<ENVIRONMENT>\n P(roduction)\n S(imulation)\n A(cceptation)\n T(est)\n D(evelopment)\n L(ocal)\n"; last } 85 1515 1600
$1 eq ':' ? : 29 56 85
$1 eq ':' ? : 29 56 85
113 1515 ▶ /^proxy([:=])s$/ && do { $_[0]->{_getOptionsType}->{proxy} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'--proxy <username:password@proxy:port&domain[,domain]>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "--proxy=<username:password\@proxy:port&domain[,domain]>\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^proxy([:=])s$/ and do { $_[0]{"_getOptionsType"}{"proxy"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '--proxy <username:password@proxy:port&domain[,domain]>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "--proxy=<username:password\@proxy:port&domain[,domain]>\n"; last } 34 1481 1515
$1 eq ':' ? : 34 0 34
$1 eq ':' ? : 34 0 34
114 1481 ▶ /^host\|H([:=])s$/ && do { $_[0]->{_getOptionsType}->{host} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-H|--host <HOST>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-H, --host=<HOST>\n hostname or ip address\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^host\|H([:=])s$/ and do { $_[0]{"_getOptionsType"}{"host"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-H|--host <HOST>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-H, --host=<HOST>\n hostname or ip address\n"; last } 17 1464 1481
$1 eq ':' ? : 2 15 17
$1 eq ':' ? : 2 15 17
115 1464 ▶ /^url\|U([:=])s$/ && do { $_[0]->{_getOptionsType}->{url} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-U|--url <URL>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-U, --url=<URL>\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^url\|U([:=])s$/ and do { $_[0]{"_getOptionsType"}{"url"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-U|--url <URL>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-U, --url=<URL>\n"; last } 11 1453 1464
$1 eq ':' ? : 2 9 11
$1 eq ':' ? : 2 9 11
116 1453 ▶ /^port\|P([:=])i$/ && do { $_[0]->{_getOptionsType}->{port} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-P|--port <PORT>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-P, --port=<PORT>\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^port\|P([:=])i$/ and do { $_[0]{"_getOptionsType"}{"port"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-P|--port <PORT>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-P, --port=<PORT>\n"; last } 4 1449 1453
$1 eq ':' ? : 2 2 4
$1 eq ':' ? : 2 2 4
117 1449 ▶ /^community\|C([:=])s$/ && do { $_[0]->{_getOptionsType}->{community} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-C|--community <SNMP COMMUNITY>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-C, --community=<SNMP COMMUNITY>\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^community\|C([:=])s$/ and do { $_[0]{"_getOptionsType"}{"community"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-C|--community <SNMP COMMUNITY>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-C, --community=<SNMP COMMUNITY>\n"; last } 2 1447 1449
$1 eq ':' ? : 2 0 2
$1 eq ':' ? : 2 0 2
118 1447 ▶ /^username\|u\|loginname([:=])s$/ && do { $_[0]->{_getOptionsType}->{username} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-u|--username|--loginname <USERNAME>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-u, --username/--loginname=<USERNAME>\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^username\|u\|loginname([:=])s$/ and do { $_[0]{"_getOptionsType"}{"username"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-u|--username|--loginname <USERNAME>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-u, --username/--loginname=<USERNAME>\n"; last } 27 1420 1447
$1 eq ':' ? : 4 23 27
$1 eq ':' ? : 4 23 27
119 1420 ▶ /^password\|p\|passwd([:=])s$/ && do { $_[0]->{_getOptionsType}->{password} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-p|--password|--passwd <PASSWORD>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-p, --password/--passwd=<PASSWORD>\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^password\|p\|passwd([:=])s$/ and do { $_[0]{"_getOptionsType"}{"password"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-p|--password|--passwd <PASSWORD>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-p, --password/--passwd=<PASSWORD>\n"; last } 27 1393 1420
$1 eq ':' ? : 4 23 27
$1 eq ':' ? : 4 23 27
120 1393 ▶ /^filename\|F([:=])s$/ && do { $_[0]->{_getOptionsType}->{filename} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-F|--filename <FILENAME>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-F, --filename=<FILENAME>\n XML filename with the ASNMTAP/Nagios compatible test results\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^filename\|F([:=])s$/ and do { $_[0]{"_getOptionsType"}{"filename"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-F|--filename <FILENAME>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-F, --filename=<FILENAME>\n XML filename with the ASNMTAP/Nagios compatible test results\n"; last } 24 1369 1393
$1 eq ':' ? : 0 24 24
$1 eq ':' ? : 0 24 24
121 1369 ▶ /^interval\|i([:=])i$/ && do { $_[0]->{_getOptionsType}->{interval} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-i|--interval <SECONDS>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-i, --interval=<SECONDS>\n interval threshold (seconds) from which a CRITICAL (2x) or WARNING (1x) status will result when XML fingerprint out of time\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^interval\|i([:=])i$/ and do { $_[0]{"_getOptionsType"}{"interval"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-i|--interval <SECONDS>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-i, --interval=<SECONDS>\n interval threshold (seconds) from which a CRITICAL (2x) or WARNING (1x) status will result when XML fingerprint out of time\n"; last } 41 1328 1369
$1 eq ':' ? : 0 41 41
$1 eq ':' ? : 0 41 41
122 0 ▶ /^loglevel\|l([:=])s$/ && do { $_[0]->{_getOptionsType}->{loglevel} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-l|--loglevel <LOGLEVEL>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-l, --loglevel=<LOGLEVEL>\n loglevel, one of (order of decrescent verbosity): debug, verbose, notice, info, warning, err, crit, alert, emerg\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^loglevel\|l([:=])s$/ and do { $_[0]{"_getOptionsType"}{"loglevel"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-l|--loglevel <LOGLEVEL>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-l, --loglevel=<LOGLEVEL>\n loglevel, one of (order of decrescent verbosity): debug, verbose, notice, info, warning, err, crit, alert, emerg\n"; last } 0 1328 1328
$1 eq ':' ? : 0 0 0
$1 eq ':' ? : 0 0 0
123 0 ▶ /^year\|Y([:=])i$/ && do { $_[0]->{_getOptionsType}->{year} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-Y|--year <YEAR>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-Y, --year=<YEAR>\n year, format: [19|20|21]yy\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^year\|Y([:=])i$/ and do { $_[0]{"_getOptionsType"}{"year"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-Y|--year <YEAR>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-Y, --year=<YEAR>\n year, format: [19|20|21]yy\n"; last } 0 1328 1328
$1 eq ':' ? : 0 0 0
$1 eq ':' ? : 0 0 0
124 0 ▶ /^quarter\|Q([:=])i$/ && do { $_[0]->{_getOptionsType}->{quarter} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-Q|--quarter <QUARTER>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-Q, --quarter=<QUARTER>\n quarter, where value 0..4\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^quarter\|Q([:=])i$/ and do { $_[0]{"_getOptionsType"}{"quarter"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-Q|--quarter <QUARTER>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-Q, --quarter=<QUARTER>\n quarter, where value 0..4\n"; last } 0 1328 1328
$1 eq ':' ? : 0 0 0
$1 eq ':' ? : 0 0 0
125 0 ▶ /^month\|M([:=])i$/ && do { $_[0]->{_getOptionsType}->{month} = $1; $_programUsageSuffix .= ($1 eq ':' ? ' [' : ' ') .'-M|--month <MONTH>'. ($1 eq ':' ? ']' : ''); $_programHelpSuffix .= "-M, --month=<MONTH>\n month, where value 1..12\n"; last; };
Branch: 3 branches
BranchTrueFalseTotal
/^month\|M([:=])i$/ and do { $_[0]{"_getOptionsType"}{"month"} = $1; $_programUsageSuffix .= ($1 eq ":" ? " [" : " ") . '-M|--month <MONTH>' . ($1 eq ":" ? "]" : ""); $_programHelpSuffix .= "-M, --month=<MONTH>\n month, where value 1..12\n"; last } 0 1328 1328
$1 eq ':' ? : 0 0 0
$1 eq ':' ? : 0 0 0
126  
127 1328 ▶ /^warning\|w([:=])s$/ && do { $_[0]->{_getOptionsType}->{warning} = $1; last; };
Branch: 1 branch
BranchTrueFalseTotal
/^warning\|w([:=])s$/ and do { $_[0]{"_getOptionsType"}{"warning"} = $1; last } 6 1322 1328
128 1322 ▶ /^critical\|c([:=])s$/ && do { $_[0]->{_getOptionsType}->{critical} = $1; last; };
Branch: 1 branch
BranchTrueFalseTotal
/^critical\|c([:=])s$/ and do { $_[0]{"_getOptionsType"}{"critical"} = $1; last } 6 1316 1322
129 }
130 }
131  
132 102 ▶ $_[0]->{_programUsageSuffix} = $_programUsageSuffix .' '. $_[0]->{_programUsageSuffix} if (defined $_programUsageSuffix);
Branch: 1 branch
BranchTrueFalseTotal
if defined $_programUsageSuffix 97 5 102
133  
134 102 ▶ $_[0]->{_programHelpSuffix} = "\n". $_programHelpSuffix . $_[0]->{_programHelpSuffix} if (defined $_programHelpSuffix);
Branch: 1 branch
BranchTrueFalseTotal
if defined $_programHelpSuffix 97 5 102
135  
136 102 $_[0]->[ $_[0]->[0]{_exit_} = @{$_[0]} ] = 0;
137  
138 102 ▶ $_[0]->[ $_[0]->[0]{_plugins} = @{$_[0]} ] = (defined $_[1]->{_plugins}) ? $_[1]->{_plugins} : 1;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1]{'_plugins'} ? : 0 102 102
139  
140 102 ▶ $_[0]->[ $_[0]->[0]{_timeout} = @{$_[0]} ] = (defined $_[1]->{_timeout}) ? $_[1]->{_timeout} : 10;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1]{'_timeout'} ? : 102 0 102
141  
142 102 ▶ $_[0]->[ $_[0]->[0]{_browseragent} = @{$_[0]} ] = (defined $_[1]->{_browseragent}) ? $_[1]->{_browseragent} : 'Mozilla/5.0 (compatible; ASNMTAP; U; ASNMTAP 3.002.003 postfix; nl-BE; rv:3.002.003) Gecko/yyyymmdd libwww-perl/5.813';
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1]{'_browseragent'} ? : 0 102 102
143  
144 102 ▶ $_[0]->[ $_[0]->[0]{_SSLversion} = @{$_[0]} ] = (defined $_[1]->{_SSLversion} and $_[1]->{_SSLversion} =~ /^(?:2|3|23)$/) ? $_[1]->{_SSLversion} : 3;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1]{'_SSLversion'} && $_[1]{'_SSLversion'} =~ /^(?:2|3|23)$/ ? : 2 100 102
Condition66%2/3
defined $_[1]{"_SSLversion"} and $_[1]{"_SSLversion"} =~ /^(?:2|3|23)$/
!ll&&!rl&&r
10002
MC/DC50%1/2
defined $_[1]{"_SSLversion"} and $_[1]{"_SSLversion"} =~ /^(?:2|3|23)$/
defined $_[1]{"_SSLversion"} $_[1]{"_SSLversion"} =~ /^(?:2|3|23)$/
Truth table66%2/3
A and B
A= defined $_[1]{"_SSLversion"}B= $_[1]{"_SSLversion"} =~ /^(?:2|3|23)$/
ABresult
0X0
100
111
145  
146 102 ▶ $_[0]->[ $_[0]->[0]{_clientCertificate} = @{$_[0]} ] = $_[1]->{_clientCertificate} if (defined $_[1]->{_clientCertificate});
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1]{"_clientCertificate"} 5 97 102
147 }
148  
149 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
150  
151 126 ▶sub _getOptions {
Subroutine _getOptions: called CC=112 SCAR=72.4
152 126 $_[0]->SUPER::_getOptions();
153 78 ▶ carp ('ASNMTAP::Asnmtap::Plugins: _getOptions') if ( $_[0]->{_debug} );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_debug"} 0 78 78
154  
155 # Default _pluginValues - - - - - - - - - - - - - - - - - - - - - - - -
156  
157 78 $_[0]->[ $_[0]->[0]{_pluginValues} = @{$_[0]} ] = {};
158  
159 78 $_[0]->{_pluginValues}->{stateValue} = $ERRORS{DEPENDENT};
160 78 $_[0]->{_pluginValues}->{stateError} = $STATE{$_[0]->{_pluginValues}->{stateValue}};
161  
162 78 $_[0]->{_pluginValues}->{message} = $_[0]->{_programDescription};
163  
164 78 $_[0]->{_pluginValues}->{alert} = undef;
165 78 $_[0]->{_pluginValues}->{error} = undef;
166 78 $_[0]->{_pluginValues}->{result} = undef;
167  
168 78 $_[0]->{_pluginValues}->{performanceData} = undef;
169  
170 78 my ($startTimeSeconds, $startTimeMicroseconds) = gettimeofday();
171 78 $_[0]->{_pluginValues}->{startTime} = $startTimeSeconds .'.'. $startTimeMicroseconds;
172 78 $_[0]->{_pluginValues}->{endTime} = $_[0]->{_pluginValues}->{startTime};
173  
174 # Options that are unknown, ambiguous or supplied with an invalid option value are passed through in @ARGV
175  
176 78 ▶ if ( @ARGV ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ARGV) 0 78 78
177 0 $_[0]->{_pluginValues}->{error} = "Unknown option(s) @ARGV";
178 0 $_[0]->{_exit_} = 2;
179 0 $_[0]->exit(0);
180 }
181  
182 # Default command line options - - - - - - - - - - - - - - - - - - - -
183  
184 78 ▶ my $status = (exists $_[0]->{_getOptionsArgv}->{status}) ? $_[0]->{_getOptionsArgv}->{status} : 'N';
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{'_getOptionsArgv'}{'status'} ? : 0 78 78
185 78 ▶ $_[0]->printUsage ('Invalid status option: '. $status) unless ($status =~ /^[N]$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $status =~ /^[N]$/ 0 78 78
186  
187 78 ▶ if (exists $_[0]->{_getOptionsArgv}->{asnmtapEnv}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'asnmtapEnv'}) { } 0 78 78
188 0 my $asnmtapEnv = $_[0]->{_getOptionsArgv}->{asnmtapEnv};
189  
190 0 my ($boolean_screenDebug, $boolean_debug_all, $boolean_debug_NOK) = split (/\|/, $asnmtapEnv);
191 0 ▶ $_[0]->printUsage ('Wrong ASNMTAP environment options: '. $asnmtapEnv) unless (defined $boolean_screenDebug and defined $boolean_debug_all and defined $boolean_debug_NOK);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $boolean_screenDebug and defined $boolean_debug_all and defined $boolean_debug_NOK 0 0 0
Condition0%0/6
defined $boolean_screenDebug and defined $boolean_debug_all and defined $boolean_debug_NOK
!ll&&!rl&&r
000
defined $boolean_screenDebug and defined $boolean_debug_all
!ll&&!rl&&r
000
MC/DC0%0/3
defined $boolean_screenDebug and defined $boolean_debug_all and defined $boolean_debug_NOK
defined $boolean_screenDebug defined $boolean_debug_all defined $boolean_debug_NOK
Truth table0%0/4
A and B and C
A= defined $boolean_screenDebugB= defined $boolean_debug_allC= defined $boolean_debug_NOK
ABCresult
0XX0
10X0
1100
1111
192 0 ▶ $_[0]->printUsage ('Invalid ASNMTAP environment options: '. $asnmtapEnv) unless ($boolean_screenDebug =~ /^[TF]$/ and $boolean_debug_all =~ /^[TF]$/ and $boolean_debug_NOK =~ /^[TF]$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $boolean_screenDebug =~ /^[TF]$/ and $boolean_debug_all =~ /^[TF]$/ and $boolean_debug_NOK =~ /^[TF]$/ 0 0 0
Condition0%0/6
$boolean_screenDebug =~ /^[TF]$/ and $boolean_debug_all =~ /^[TF]$/ and $boolean_debug_NOK =~ /^[TF]$/
!ll&&!rl&&r
000
$boolean_screenDebug =~ /^[TF]$/ and $boolean_debug_all =~ /^[TF]$/
!ll&&!rl&&r
000
MC/DC0%0/3
$boolean_screenDebug =~ /^[TF]$/ and $boolean_debug_all =~ /^[TF]$/ and $boolean_debug_NOK =~ /^[TF]$/
$boolean_screenDebug =~ /^[TF]$/ $boolean_debug_all =~ /^[TF]$/ $boolean_debug_NOK =~ /^[TF]$/
Truth table0%0/4
A and B and C
A= $boolean_screenDebug =~ /^[TF]$/B= $boolean_debug_all =~ /^[TF]$/C= $boolean_debug_NOK =~ /^[TF]$/
ABCresult
0XX0
10X0
1100
1111
193  
194 0 ▶ $_[0]->{_getOptionsValues}->{boolean_screenDebug} = ($boolean_screenDebug eq 'T') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$boolean_screenDebug eq 'T' ? : 0 0 0
195 0 ▶ $_[0]->{_getOptionsValues}->{boolean_debug_all} = ($boolean_debug_all eq 'T') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$boolean_debug_all eq 'T' ? : 0 0 0
196 0 ▶ $_[0]->{_getOptionsValues}->{boolean_debug_NOK} = ($boolean_debug_NOK eq 'T') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$boolean_debug_NOK eq 'T' ? : 0 0 0
197 } else {
198 78 $_[0]->{_getOptionsValues}->{boolean_screenDebug} = 0;
199 78 $_[0]->{_getOptionsValues}->{boolean_debug_all} = 0;
200 78 $_[0]->{_getOptionsValues}->{boolean_debug_NOK} = 0;
201 }
202  
203 78 ▶ my $onDemand = (exists $_[0]->{_getOptionsArgv}->{onDemand}) ? $_[0]->{_getOptionsArgv}->{onDemand} : 'F';
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{'_getOptionsArgv'}{'onDemand'} ? : 0 78 78
204 78 ▶ $_[0]->printUsage ('Invalid on demand option: '. $onDemand) unless ($onDemand =~ /^[FTNY]$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $onDemand =~ /^[FTNY]$/ 0 78 78
205 78 ▶ $_[0]->{_getOptionsValues}->{onDemand} = ($onDemand =~ /^[TY]$/) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$onDemand =~ /^[TY]$/ ? : 0 78 78
206  
207 # exists $_[0]->{_getOptionsArgv}->{logging}
208  
209 78 ▶ if ( defined $_[0]->{_getOptionsArgv}->{debugfile} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]{"_getOptionsArgv"}{"debugfile"}) 0 78 78
210 0 ▶ unlink $_[0]->{_getOptionsArgv}->{debugfile} if ( -s $_[0]->{_getOptionsArgv}->{debugfile} );
Branch: 1 branch
BranchTrueFalseTotal
if -s $_[0]{"_getOptionsArgv"}{"debugfile"} 0 0 0
211 }
212  
213 78 ▶ my $debug = (exists $_[0]->{_getOptionsArgv}->{debug}) ? $_[0]->{_getOptionsArgv}->{debug} : 'F';
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{'_getOptionsArgv'}{'debug'} ? : 0 78 78
214 78 ▶ $_[0]->printUsage ('Invalid debug option: '. $debug) unless ($debug =~ /^[FTLMAS]$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $debug =~ /^[FTLMAS]$/ 0 78 78
215 78 ▶ $_[0]->{_getOptionsValues}->{debug} = ($debug eq 'T') ? 1 : (($debug eq 'L') ? 2 : (($debug eq 'M') ? 3 : (($debug eq 'A') ? 4 : ((($debug eq 'S') ? 5 : 0)))));
Branch: 5 branches
BranchTrueFalseTotal
$debug eq 'T' ? : 0 78 78
$debug eq 'L' ? : 0 78 78
$debug eq 'M' ? : 0 78 78
$debug eq 'A' ? : 0 78 78
$debug eq 'S' ? : 0 78 78
216  
217 # Reserved command line options - - - - - - - - - - - - - - - - - - - -
218  
219 78 ▶ if ( exists $_[0]->{_getOptionsArgv}->{timeout} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'timeout'}) { } 0 78 78
elsif (exists $_[0]{'_getOptionsType'}{'timeout'} and $_[0]{'_getOptionsType'}{'timeout'} eq '=') { } 0 117 117
220 0 ▶ my $timeout = $1 if ( $_[0]->{_getOptionsArgv}->{timeout} =~ m/^([1-9]?(?:\d*))$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"timeout"} =~ /^([1-9]?(?:\d*))$/ 0 0 0
221 0 ▶ $_[0]->printUsage ('Invalid timeout: '. $_[0]->{_getOptionsArgv}->{timeout}) unless (defined $timeout);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $timeout 0 0 0
222 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{timeout} and $_[0]->{_getOptionsType}->{timeout} eq '=' ) {
Condition66%2/3
exists $_[0]{"_getOptionsType"}{"timeout"} and $_[0]{"_getOptionsType"}{"timeout"} eq "="
!ll&&!rl&&r
39390
MC/DC0%0/2
exists $_[0]{"_getOptionsType"}{"timeout"} and $_[0]{"_getOptionsType"}{"timeout"} eq "="
exists $_[0]{"_getOptionsType"}{"timeout"} $_[0]{"_getOptionsType"}{"timeout"} eq "="
Truth table66%2/3
A and B
A= exists $_[0]{"_getOptionsType"}{"timeout"}B= $_[0]{"_getOptionsType"}{"timeout"} eq "="
ABresult
0X0
100
111
223 0 $_[0]->printUsage ('Missing command line argument timeout');
224 }
225  
226 78 ▶ if ( exists $_[0]->{_getOptionsArgv}->{trendline} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'trendline'}) { } 0 78 78
elsif (exists $_[0]{'_getOptionsType'}{'trendline'} and $_[0]{'_getOptionsType'}{'trendline'} eq '=') { } 0 104 104
227 0 ▶ my $trendline = $1 if ( $_[0]->{_getOptionsArgv}->{trendline} =~ m/^([1-9]?(?:\d*))$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"trendline"} =~ /^([1-9]?(?:\d*))$/ 0 0 0
228 0 ▶ $_[0]->printUsage ('Invalid trendline: '. $_[0]->{_getOptionsArgv}->{trendline}) unless (defined $trendline);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $trendline 0 0 0
229 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{trendline} and $_[0]->{_getOptionsType}->{trendline} eq '=' ) {
Condition66%2/3
exists $_[0]{"_getOptionsType"}{"trendline"} and $_[0]{"_getOptionsType"}{"trendline"} eq "="
!ll&&!rl&&r
26520
MC/DC0%0/2
exists $_[0]{"_getOptionsType"}{"trendline"} and $_[0]{"_getOptionsType"}{"trendline"} eq "="
exists $_[0]{"_getOptionsType"}{"trendline"} $_[0]{"_getOptionsType"}{"trendline"} eq "="
Truth table66%2/3
A and B
A= exists $_[0]{"_getOptionsType"}{"trendline"}B= $_[0]{"_getOptionsType"}{"trendline"} eq "="
ABresult
0X0
100
111
230 0 $_[0]->printUsage ('Missing command line argument trendline');
231 }
232  
233 78 ▶ if ( exists $_[0]->{_getOptionsArgv}->{environment} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'environment'}) { } 22 56 78
elsif (exists $_[0]{'_getOptionsType'}{'environment'} and $_[0]{'_getOptionsType'}{'environment'} eq '=') { } 21 48 69
234 22 ▶ $_[0]->printUsage ('Invalid environment option: '. $_[0]->{_getOptionsArgv}->{environment}) unless ($_[0]->{_getOptionsArgv}->{environment} =~ /^[PSATDL]$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]{"_getOptionsArgv"}{"environment"} =~ /^[PSATDL]$/ 0 22 22
235  
236 22 for ($_[0]->{_getOptionsArgv}->{environment}) {
237 22 ▶ /P/ && do { $_[0]->{_getOptionsValues}->{environment} = "Production"; last; };
Branch: 1 branch
BranchTrueFalseTotal
/P/ and do { $_[0]{"_getOptionsValues"}{"environment"} = "Production"; last } 16 6 22
238 0 ▶ /S/ && do { $_[0]->{_getOptionsValues}->{environment} = "Simulation"; last; };
Branch: 1 branch
BranchTrueFalseTotal
/S/ and do { $_[0]{"_getOptionsValues"}{"environment"} = "Simulation"; last } 0 6 6
239 0 ▶ /A/ && do { $_[0]->{_getOptionsValues}->{environment} = "Acceptation"; last; };
Branch: 1 branch
BranchTrueFalseTotal
/A/ and do { $_[0]{"_getOptionsValues"}{"environment"} = "Acceptation"; last } 0 6 6
240 0 ▶ /T/ && do { $_[0]->{_getOptionsValues}->{environment} = "Test"; last; };
Branch: 1 branch
BranchTrueFalseTotal
/T/ and do { $_[0]{"_getOptionsValues"}{"environment"} = "Test"; last } 0 6 6
241 0 ▶ /D/ && do { $_[0]->{_getOptionsValues}->{environment} = "Development"; last; };
Branch: 1 branch
BranchTrueFalseTotal
/D/ and do { $_[0]{"_getOptionsValues"}{"environment"} = "Development"; last } 0 6 6
242 6 ▶ /L/ && do { $_[0]->{_getOptionsValues}->{environment} = "Local"; last; };
Branch: 1 branch
BranchTrueFalseTotal
/L/ and do { $_[0]{"_getOptionsValues"}{"environment"} = "Local"; last } 6 0 6
243 0 $_[0]->{_getOptionsValues}->{environment} = undef;
244 }
245 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{environment} and $_[0]->{_getOptionsType}->{environment} eq '=' ) {
Condition100%3/3
exists $_[0]{"_getOptionsType"}{"environment"} and $_[0]{"_getOptionsType"}{"environment"} eq "="
!ll&&!rl&&r
132221
MC/DC100%2/2
exists $_[0]{"_getOptionsType"}{"environment"} and $_[0]{"_getOptionsType"}{"environment"} eq "="
exists $_[0]{"_getOptionsType"}{"environment"} $_[0]{"_getOptionsType"}{"environment"} eq "="
Truth table100%3/3
A and B
A= exists $_[0]{"_getOptionsType"}{"environment"}B= $_[0]{"_getOptionsType"}{"environment"} eq "="
ABresult
0X0
100
111
246 21 $_[0]->printUsage ('Missing command line argument environment');
247 }
248  
249 57 $_[0]->_init_proxy_and_client_certificate ();
250  
251 57 ▶ if ( exists $_[0]->{_getOptionsArgv}->{host} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'host'}) { } 6 51 57
elsif (exists $_[0]{'_getOptionsType'}{'host'} and $_[0]{'_getOptionsType'}{'host'} eq '=') { } 4 92 96
252 6 ▶ my $host = $1 if ( $_[0]->{_getOptionsArgv}->{host} =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"host"} =~ /^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/ 6 0 6
253 6 ▶ $_[0]->printUsage ('Invalid hostname or ip address: '. $_[0]->{_getOptionsArgv}->{host}) unless (defined $host);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $host 0 6 6
254 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{host} and $_[0]->{_getOptionsType}->{host} eq '=' ) {
Condition100%3/3
exists $_[0]{"_getOptionsType"}{"host"} and $_[0]{"_getOptionsType"}{"host"} eq "="
!ll&&!rl&&r
4524
MC/DC100%2/2
exists $_[0]{"_getOptionsType"}{"host"} and $_[0]{"_getOptionsType"}{"host"} eq "="
exists $_[0]{"_getOptionsType"}{"host"} $_[0]{"_getOptionsType"}{"host"} eq "="
Truth table100%3/3
A and B
A= exists $_[0]{"_getOptionsType"}{"host"}B= $_[0]{"_getOptionsType"}{"host"} eq "="
ABresult
0X0
100
111
255 4 $_[0]->printUsage ('Missing command line argument host');
256 }
257  
258 53 ▶ if ( exists $_[0]->{_getOptionsArgv}->{url} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'url'}) { } 0 53 53
elsif (exists $_[0]{'_getOptionsType'}{'url'} and $_[0]{'_getOptionsType'}{'url'} eq '=') { } 0 104 104
259 # ... TODO ...
260 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{url} and $_[0]->{_getOptionsType}->{url} eq '=' ) {
Condition66%2/3
exists $_[0]{"_getOptionsType"}{"url"} and $_[0]{"_getOptionsType"}{"url"} eq "="
!ll&&!rl&&r
5120
MC/DC0%0/2
exists $_[0]{"_getOptionsType"}{"url"} and $_[0]{"_getOptionsType"}{"url"} eq "="
exists $_[0]{"_getOptionsType"}{"url"} $_[0]{"_getOptionsType"}{"url"} eq "="
Truth table66%2/3
A and B
A= exists $_[0]{"_getOptionsType"}{"url"}B= $_[0]{"_getOptionsType"}{"url"} eq "="
ABresult
0X0
100
111
261 0 $_[0]->printUsage ('Missing command line argument url');
262 }
263  
264 53 ▶ if ( exists $_[0]->{_getOptionsArgv}->{port} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'port'}) { } 0 53 53
elsif (exists $_[0]{'_getOptionsType'}{'port'} and $_[0]{'_getOptionsType'}{'port'} eq '=') { } 0 104 104
265 0 ▶ my $port = $1 if ( $_[0]->{_getOptionsArgv}->{port} =~ m/^([1-9]?(?:\d*))$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"port"} =~ /^([1-9]?(?:\d*))$/ 0 0 0
266 0 ▶ $_[0]->printUsage ('Invalid port: '. $_[0]->{_getOptionsArgv}->{port}) unless (defined $port);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $port 0 0 0
267 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{port} and $_[0]->{_getOptionsType}->{port} eq '=' ) {
Condition66%2/3
exists $_[0]{"_getOptionsType"}{"port"} and $_[0]{"_getOptionsType"}{"port"} eq "="
!ll&&!rl&&r
5120
MC/DC0%0/2
exists $_[0]{"_getOptionsType"}{"port"} and $_[0]{"_getOptionsType"}{"port"} eq "="
exists $_[0]{"_getOptionsType"}{"port"} $_[0]{"_getOptionsType"}{"port"} eq "="
Truth table66%2/3
A and B
A= exists $_[0]{"_getOptionsType"}{"port"}B= $_[0]{"_getOptionsType"}{"port"} eq "="
ABresult
0X0
100
111
268 0 $_[0]->printUsage ('Missing command line argument port');
269 }
270  
271 53 ▶ if ( exists $_[0]->{_getOptionsArgv}->{community} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'community'}) { } 0 53 53
elsif (exists $_[0]{'_getOptionsType'}{'community'} and $_[0]{'_getOptionsType'}{'community'} eq '=') { } 0 104 104
272 # ... TODO ...
273 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{community} and $_[0]->{_getOptionsType}->{community} eq '=' ) {
Condition66%2/3
exists $_[0]{"_getOptionsType"}{"community"} and $_[0]{"_getOptionsType"}{"community"} eq "="
!ll&&!rl&&r
5120
MC/DC0%0/2
exists $_[0]{"_getOptionsType"}{"community"} and $_[0]{"_getOptionsType"}{"community"} eq "="
exists $_[0]{"_getOptionsType"}{"community"} $_[0]{"_getOptionsType"}{"community"} eq "="
Truth table66%2/3
A and B
A= exists $_[0]{"_getOptionsType"}{"community"}B= $_[0]{"_getOptionsType"}{"community"} eq "="
ABresult
0X0
100
111
274 0 $_[0]->printUsage ('Missing command line argument community');
275 }
276  
277 53 ▶ if ( exists $_[0]->{_getOptionsArgv}->{username} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'username'}) { } 2 51 53
elsif (exists $_[0]{'_getOptionsType'}{'username'} and $_[0]{'_getOptionsType'}{'username'} eq '=') { } 1 98 99
278 # ... TODO ...
279 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{username} and $_[0]->{_getOptionsType}->{username} eq '=' ) {
Condition100%3/3
exists $_[0]{"_getOptionsType"}{"username"} and $_[0]{"_getOptionsType"}{"username"} eq "="
!ll&&!rl&&r
4821
MC/DC100%2/2
exists $_[0]{"_getOptionsType"}{"username"} and $_[0]{"_getOptionsType"}{"username"} eq "="
exists $_[0]{"_getOptionsType"}{"username"} $_[0]{"_getOptionsType"}{"username"} eq "="
Truth table100%3/3
A and B
A= exists $_[0]{"_getOptionsType"}{"username"}B= $_[0]{"_getOptionsType"}{"username"} eq "="
ABresult
0X0
100
111
280 1 $_[0]->printUsage ('Missing command line argument username');
281 }
282  
283 52 ▶ if ( exists $_[0]->{_getOptionsArgv}->{password} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'password'}) { } 1 51 52
elsif (exists $_[0]{'_getOptionsType'}{'password'} and $_[0]{'_getOptionsType'}{'password'} eq '=') { } 1 98 99
284 # ... TODO ...
285 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{password} and $_[0]->{_getOptionsType}->{password} eq '=' ) {
Condition100%3/3
exists $_[0]{"_getOptionsType"}{"password"} and $_[0]{"_getOptionsType"}{"password"} eq "="
!ll&&!rl&&r
4821
MC/DC100%2/2
exists $_[0]{"_getOptionsType"}{"password"} and $_[0]{"_getOptionsType"}{"password"} eq "="
exists $_[0]{"_getOptionsType"}{"password"} $_[0]{"_getOptionsType"}{"password"} eq "="
Truth table100%3/3
A and B
A= exists $_[0]{"_getOptionsType"}{"password"}B= $_[0]{"_getOptionsType"}{"password"} eq "="
ABresult
0X0
100
111
286 1 $_[0]->printUsage ('Missing command line argument password');
287 }
288  
289 51 ▶ if ( exists $_[0]->{_getOptionsArgv}->{filename} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'filename'}) { } 16 35 51
elsif (exists $_[0]{'_getOptionsType'}{'filename'} and $_[0]{'_getOptionsType'}{'filename'} eq '=') { } 2 66 68
290 # ... TODO ...
291 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{filename} and $_[0]->{_getOptionsType}->{filename} eq '=' ) {
Condition66%2/3
exists $_[0]{"_getOptionsType"}{"filename"} and $_[0]{"_getOptionsType"}{"filename"} eq "="
!ll&&!rl&&r
3302
MC/DC50%1/2
exists $_[0]{"_getOptionsType"}{"filename"} and $_[0]{"_getOptionsType"}{"filename"} eq "="
exists $_[0]{"_getOptionsType"}{"filename"} $_[0]{"_getOptionsType"}{"filename"} eq "="
Truth table66%2/3
A and B
A= exists $_[0]{"_getOptionsType"}{"filename"}B= $_[0]{"_getOptionsType"}{"filename"} eq "="
ABresult
0X0
100
111
292 2 $_[0]->printUsage ('Missing command line argument filename');
293 }
294  
295 49 ▶ if ( exists $_[0]->{_getOptionsArgv}->{interval} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'interval'}) { } 14 35 49
elsif (exists $_[0]{'_getOptionsType'}{'interval'} and $_[0]{'_getOptionsType'}{'interval'} eq '=') { } 2 66 68
296 14 ▶ my $interval = $1 if ( $_[0]->{_getOptionsArgv}->{interval} =~ m/^([1-9]?(?:\d*))$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"interval"} =~ /^([1-9]?(?:\d*))$/ 14 0 14
297 14 ▶ $_[0]->printUsage ('Invalid interval: '. $_[0]->{_getOptionsArgv}->{interval}) unless (defined $interval);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $interval 0 14 14
298 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{interval} and $_[0]->{_getOptionsType}->{interval} eq '=' ) {
Condition66%2/3
exists $_[0]{"_getOptionsType"}{"interval"} and $_[0]{"_getOptionsType"}{"interval"} eq "="
!ll&&!rl&&r
3302
MC/DC50%1/2
exists $_[0]{"_getOptionsType"}{"interval"} and $_[0]{"_getOptionsType"}{"interval"} eq "="
exists $_[0]{"_getOptionsType"}{"interval"} $_[0]{"_getOptionsType"}{"interval"} eq "="
Truth table66%2/3
A and B
A= exists $_[0]{"_getOptionsType"}{"interval"}B= $_[0]{"_getOptionsType"}{"interval"} eq "="
ABresult
0X0
100
111
299 2 $_[0]->printUsage ('Missing command line argument interval');
300 }
301  
302 47 ▶ if ( exists $_[0]->{_getOptionsArgv}->{loglevel} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'loglevel'}) { } 0 47 47
elsif (exists $_[0]{'_getOptionsType'}{'loglevel'} and $_[0]{'_getOptionsType'}{'loglevel'} eq '=') { } 0 94 94
303 0 ▶ my $loglevel = $1 if ( $_[0]->{_getOptionsArgv}->{loglevel} =~ m/^(debug|verbose|notice|info|warning|err|crit|alert|emerg)$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"loglevel"} =~ /^(debug|verbose|notice|info|warning|err|crit|alert|emerg)$/ 0 0 0
304 0 ▶ $_[0]->printUsage ('Invalid loglevel: '. $_[0]->{_getOptionsArgv}->{loglevel}) unless (defined $loglevel);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $loglevel 0 0 0
305 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{loglevel} and $_[0]->{_getOptionsType}->{loglevel} eq '=' ) {
Condition33%1/3
exists $_[0]{"_getOptionsType"}{"loglevel"} and $_[0]{"_getOptionsType"}{"loglevel"} eq "="
!ll&&!rl&&r
4700
MC/DC0%0/2
exists $_[0]{"_getOptionsType"}{"loglevel"} and $_[0]{"_getOptionsType"}{"loglevel"} eq "="
exists $_[0]{"_getOptionsType"}{"loglevel"} $_[0]{"_getOptionsType"}{"loglevel"} eq "="
Truth table33%1/3
A and B
A= exists $_[0]{"_getOptionsType"}{"loglevel"}B= $_[0]{"_getOptionsType"}{"loglevel"} eq "="
ABresult
0X0
100
111
306 0 $_[0]->printUsage ('Missing command line argument loglevel');
307 }
308  
309 47 ▶ if ( exists $_[0]->{_getOptionsArgv}->{year} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'year'}) { } 0 47 47
elsif (exists $_[0]{'_getOptionsType'}{'year'} and $_[0]{'_getOptionsType'}{'year'} eq '=') { } 0 94 94
310 0 ▶ my $year = $1 if ( $_[0]->{_getOptionsArgv}->{year} =~ m/^((?:19|20|21)\d{2,2})$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"year"} =~ /^((?:19|20|21)\d{2,2})$/ 0 0 0
311 0 ▶ $_[0]->printUsage ('Invalid year: '. $_[0]->{_getOptionsArgv}->{year}) unless (defined $year);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $year 0 0 0
312 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{year} and $_[0]->{_getOptionsType}->{year} eq '=' ) {
Condition33%1/3
exists $_[0]{"_getOptionsType"}{"year"} and $_[0]{"_getOptionsType"}{"year"} eq "="
!ll&&!rl&&r
4700
MC/DC0%0/2
exists $_[0]{"_getOptionsType"}{"year"} and $_[0]{"_getOptionsType"}{"year"} eq "="
exists $_[0]{"_getOptionsType"}{"year"} $_[0]{"_getOptionsType"}{"year"} eq "="
Truth table33%1/3
A and B
A= exists $_[0]{"_getOptionsType"}{"year"}B= $_[0]{"_getOptionsType"}{"year"} eq "="
ABresult
0X0
100
111
313 0 $_[0]->printUsage ('Missing command line argument year');
314 }
315  
316 47 ▶ if ( exists $_[0]->{_getOptionsArgv}->{quarter} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'quarter'}) { } 0 47 47
elsif (exists $_[0]{'_getOptionsType'}{'quarter'} and $_[0]{'_getOptionsType'}{'quarter'} eq '=') { } 0 94 94
317 0 ▶ my $quarter = $1 if ( $_[0]->{_getOptionsArgv}->{quarter} =~ m/^([1-4])$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"quarter"} =~ /^([1-4])$/ 0 0 0
318 0 ▶ $_[0]->printUsage ('Invalid quarter: '. $_[0]->{_getOptionsArgv}->{quarter}) unless (defined $quarter);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $quarter 0 0 0
319 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{quarter} and $_[0]->{_getOptionsType}->{quarter} eq '=' ) {
Condition33%1/3
exists $_[0]{"_getOptionsType"}{"quarter"} and $_[0]{"_getOptionsType"}{"quarter"} eq "="
!ll&&!rl&&r
4700
MC/DC0%0/2
exists $_[0]{"_getOptionsType"}{"quarter"} and $_[0]{"_getOptionsType"}{"quarter"} eq "="
exists $_[0]{"_getOptionsType"}{"quarter"} $_[0]{"_getOptionsType"}{"quarter"} eq "="
Truth table33%1/3
A and B
A= exists $_[0]{"_getOptionsType"}{"quarter"}B= $_[0]{"_getOptionsType"}{"quarter"} eq "="
ABresult
0X0
100
111
320 0 $_[0]->printUsage ('Missing command line argument quarter');
321 }
322  
323 47 ▶ if ( exists $_[0]->{_getOptionsArgv}->{month} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'month'}) { } 0 47 47
elsif (exists $_[0]{'_getOptionsType'}{'month'} and $_[0]{'_getOptionsType'}{'month'} eq '=') { } 0 94 94
324 0 ▶ my $month = $1 if ( $_[0]->{_getOptionsArgv}->{month} =~ m/^([1-9]|1[0-2])$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"month"} =~ /^([1-9]|1[0-2])$/ 0 0 0
325 0 ▶ $_[0]->printUsage ('Invalid month: '. $_[0]->{_getOptionsArgv}->{month}) unless (defined $month);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $month 0 0 0
326 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{month} and $_[0]->{_getOptionsType}->{month} eq '=' ) {
Condition33%1/3
exists $_[0]{"_getOptionsType"}{"month"} and $_[0]{"_getOptionsType"}{"month"} eq "="
!ll&&!rl&&r
4700
MC/DC0%0/2
exists $_[0]{"_getOptionsType"}{"month"} and $_[0]{"_getOptionsType"}{"month"} eq "="
exists $_[0]{"_getOptionsType"}{"month"} $_[0]{"_getOptionsType"}{"month"} eq "="
Truth table33%1/3
A and B
A= exists $_[0]{"_getOptionsType"}{"month"}B= $_[0]{"_getOptionsType"}{"month"} eq "="
ABresult
0X0
100
111
327 0 $_[0]->printUsage ('Missing command line argument month');
328 }
329  
330 # Reserved command line options - - - - - - - - - - - - - - - - - - - -
331  
332 47 ▶ if (exists $_[0]->{_getOptionsArgv}->{warning}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'warning'}) { } 2 45 47
elsif (exists $_[0]{'_getOptionsType'}{'warning'} and $_[0]{'_getOptionsType'}{'warning'} eq '=') { } 1 88 89
333 2 ▶ my $warning = $1 if ( $_[0]->{_getOptionsArgv}->{warning} =~ /^([1-9]?(?:\d*))$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"warning"} =~ /^([1-9]?(?:\d*))$/ 2 0 2
334 2 ▶ $_[0]->printUsage ('Invalid warning threshold ranges '. $_[0]->{_getOptionsArgv}->{warning}) unless (defined $warning);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $warning 0 2 2
335 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{warning} and $_[0]->{_getOptionsType}->{warning} eq '=' ) {
Condition66%2/3
exists $_[0]{"_getOptionsType"}{"warning"} and $_[0]{"_getOptionsType"}{"warning"} eq "="
!ll&&!rl&&r
4401
MC/DC50%1/2
exists $_[0]{"_getOptionsType"}{"warning"} and $_[0]{"_getOptionsType"}{"warning"} eq "="
exists $_[0]{"_getOptionsType"}{"warning"} $_[0]{"_getOptionsType"}{"warning"} eq "="
Truth table66%2/3
A and B
A= exists $_[0]{"_getOptionsType"}{"warning"}B= $_[0]{"_getOptionsType"}{"warning"} eq "="
ABresult
0X0
100
111
336 1 $_[0]->printUsage ('Missing command line argument warning');
337 }
338  
339 46 ▶ if (exists $_[0]->{_getOptionsArgv}->{critical}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[0]{'_getOptionsArgv'}{'critical'}) { } 1 45 46
elsif (exists $_[0]{'_getOptionsType'}{'critical'} and $_[0]{'_getOptionsType'}{'critical'} eq '=') { } 1 88 89
340 1 ▶ my $critical = $1 if ($_[0]->{_getOptionsArgv}->{critical} =~ /^([1-9]?(?:\d*))$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_getOptionsArgv"}{"critical"} =~ /^([1-9]?(?:\d*))$/ 1 0 1
341 1 ▶ $_[0]->printUsage ('Invalid critical threshold range: '. $_[0]->{_getOptionsArgv}->{critical}) unless (defined $critical);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $critical 0 1 1
342 ▶ } elsif ( exists $_[0]->{_getOptionsType}->{critical} and $_[0]->{_getOptionsType}->{critical} eq '=' ) {
Condition66%2/3
exists $_[0]{"_getOptionsType"}{"critical"} and $_[0]{"_getOptionsType"}{"critical"} eq "="
!ll&&!rl&&r
4401
MC/DC50%1/2
exists $_[0]{"_getOptionsType"}{"critical"} and $_[0]{"_getOptionsType"}{"critical"} eq "="
exists $_[0]{"_getOptionsType"}{"critical"} $_[0]{"_getOptionsType"}{"critical"} eq "="
Truth table66%2/3
A and B
A= exists $_[0]{"_getOptionsType"}{"critical"}B= $_[0]{"_getOptionsType"}{"critical"} eq "="
ABresult
0X0
100
111
343 1 $_[0]->printUsage ('Missing command line argument critical');
344 }
345  
346 # Default _pluginValues - - - - - - - - - - - - - - - - - - - - - - - -
347  
348 45 ▶ $_[0]->{_pluginValues}->{message} .= ' ('. $_[0]->{_getOptionsValues}->{environment} .')' if ( defined $_[0]->{_getOptionsValues}->{environment} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_getOptionsValues"}{"environment"} 15 30 45
349  
350 45 ($startTimeSeconds, $startTimeMicroseconds) = gettimeofday();
351 45 $_[0]->{_pluginValues}->{startTime} = $startTimeSeconds .'.'. $startTimeMicroseconds;
352 45 $_[0]->{_pluginValues}->{endTime} = $_[0]->{_pluginValues}->{startTime};
353  
354 # Timing Out Slow Plugins - part 1/2 - - - - - - - - - - - - - - - - - -
355  
356 45 ▶ if ( exists $_[0]->{_getOptionsArgv}->{timeout} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_[0]{"_getOptionsArgv"}{"timeout"}) 0 45 45
357 0 $_[0]->{_pluginValues}->{_alarm_} = alarm (0);
358  
359 0 ▶ if ( $_[0]->{_pluginValues}->{_alarm_} && $_[0]->{_getOptionsArgv}->{timeout} > $_[0]->{_pluginValues}->{_alarm_} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"_pluginValues"}{"_alarm_"} and $_[0]{"_getOptionsArgv"}{"timeout"} > $_[0]{"_pluginValues"}{"_alarm_"}) 0 0 0
Condition0%0/3
$_[0]{"_pluginValues"}{"_alarm_"} and $_[0]{"_getOptionsArgv"}{"timeout"} > $_[0]{"_pluginValues"}{"_alarm_"}
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0]{"_pluginValues"}{"_alarm_"} and $_[0]{"_getOptionsArgv"}{"timeout"} > $_[0]{"_pluginValues"}{"_alarm_"}
$_[0]{"_pluginValues"}{"_alarm_"} $_[0]{"_getOptionsArgv"}{"timeout"} > $_[0]{"_pluginValues"}{"_alarm_"}
Truth table0%0/3
A and B
A= $_[0]{"_pluginValues"}{"_alarm_"}B= $_[0]{"_getOptionsArgv"}{"timeout"} > $_[0]{"_pluginValues"}{"_alarm_"}
ABresult
0X0
100
111
360 0 $_[0]->{_getOptionsArgv}->{timeout} = $_[0]->{_pluginValues}->{_alarm_};
361 }
362  
363 0 $_[0]->{_pluginValues}->{_handler_} = $SIG{ALRM};
364 0 ▶ $SIG{ALRM} = sub { $ALARM_OFF = 1; die "ASNMTAP::Asnmtap::Plugins::ALARM_OFF = 1\n" };
Subroutine __ANON__: not called CC=1 SCAR=6.9
365 0 alarm ( $_[0]->{_getOptionsArgv}->{timeout} );
366 }
367 }
368  
369 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
370  
371 57 ▶sub _init_proxy_and_client_certificate {
Subroutine _init_proxy_and_client_certificate: called CC=23 SCAR=34.8
372 57 ▶ my $proxy = ( exists $ENV{ASNMTAP_PROXY} ? $ENV{ASNMTAP_PROXY} : ( exists $_[0]->{_getOptionsArgv}->{proxy} and defined $_[0]->{_getOptionsArgv}->{proxy} ? $_[0]->{_getOptionsArgv}->{proxy} : undef ) );
Branch: 2 branches
BranchTrueFalseTotal
exists $ENV{'ASNMTAP_PROXY'} ? : 2 55 57
defined $_[0]{'_getOptionsArgv'}{'proxy'} ? : 0 0 0
Condition33%1/3
exists $_[0]{"_getOptionsArgv"}{"proxy"} and defined $_[0]{"_getOptionsArgv"}{"proxy"} ? $_[0]{"_getOptionsArgv"}{"proxy"} : undef
!ll&&!rl&&r
5500
MC/DC0%0/2
exists $_[0]{"_getOptionsArgv"}{"proxy"} and defined $_[0]{"_getOptionsArgv"}{"proxy"} ? $_[0]{"_getOptionsArgv"}{"proxy"} : undef
exists $_[0]{"_getOptionsArgv"}{"proxy"} defined $_[0]{"_getOptionsArgv"}{"proxy"} ? $_[0]{"_getOptionsArgv"}{"proxy"} : undef
Truth table33%1/3
A and B
A= exists $_[0]{"_getOptionsArgv"}{"proxy"}B= defined $_[0]{"_getOptionsArgv"}{"proxy"} ? $_[0]{"_getOptionsArgv"}{"proxy"} : undef
ABresult
0X0
100
111
373  
374 57 ▶ if ( defined $proxy and $proxy ne '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $proxy and $proxy ne "") 2 55 57
Condition66%2/3
defined $proxy and $proxy ne ""
!ll&&!rl&&r
0552
MC/DC50%1/2
defined $proxy and $proxy ne ""
defined $proxy $proxy ne ""
Truth table66%2/3
A and B
A= defined $proxyB= $proxy ne ""
ABresult
0X0
100
111
375 2 my ($proxyServer, $proxyNo, $proxyServerNo, $proxyUsername, $proxyPassword, $proxyUsernamePassword);
376 2 ($proxyUsernamePassword, $proxyServerNo) = split(/\@/, $proxy );
377  
378 2 ▶ if ( defined $proxyServerNo ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $proxyServerNo) { } 2 0 2
379 2 ($proxyUsername, $proxyPassword) = split(/\:/, $proxyUsernamePassword, 2);
380 2 ▶ $_[0]->printUsage ('Username and/or Password missing: : '. $proxy) unless (defined $proxyUsername and defined $proxyPassword);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $proxyUsername and defined $proxyPassword 0 2 2
Condition33%1/3
defined $proxyUsername and defined $proxyPassword
!ll&&!rl&&r
002
MC/DC0%0/2
defined $proxyUsername and defined $proxyPassword
defined $proxyUsername defined $proxyPassword
Truth table33%1/3
A and B
A= defined $proxyUsernameB= defined $proxyPassword
ABresult
0X0
100
111
381 2 ($proxyServer, $proxyNo) = split(/\&/, $proxyServerNo );
382 } else {
383 0 ($proxyServer, $proxyNo) = split(/\&/, $proxy );
384 }
385  
386 2 ▶ $_[0]->[ $_[0]->[0]{_proxy} = @{$_[0]} ] = {} unless ( exists $_[0]->{_proxy} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $_[0]{"_proxy"} 2 0 2
387  
388 2 $_[0]->{_proxy}->{server} = "http://" . $proxyServer;
389 2 $_[0]->{_proxy}->{username} = $proxyUsername;
390 2 $_[0]->{_proxy}->{password} = $proxyPassword;
391  
392 2 ▶ $_[0]->{_proxy}->{no} = ( defined $proxyNo ? [ split (/,/, $proxyNo) ] : undef );
Branch: 1 branch
BranchTrueFalseTotal
defined $proxyNo ? : 0 2 2
393 0 ▶ $ENV{NO_PROXY} = ( defined $_[0]->{_proxy}->{no} ? join (', ', @{ $_[0]->{_proxy}->{no} }) : '' );
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'_proxy'}{'no'} ? : 0 2 2
394 }
395  
396 # HTTPS: DEFAULT SSL VERSION
397 57 $ENV{HTTPS_VERSION} = $_[0]->{_SSLversion};
398  
399 # HTTPS: DEBUGGING SWITCH / LOW LEVEL SSL DIAGNOSTICS
400 57 $ENV{HTTPS_DEBUG} = $_[0]->{_getOptionsValues}->{debug};
401  
402 57 ▶ if ( defined $proxy and $proxy ne '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $proxy and $proxy ne "") 2 55 57
Condition66%2/3
defined $proxy and $proxy ne ""
!ll&&!rl&&r
0552
MC/DC50%1/2
defined $proxy and $proxy ne ""
defined $proxy $proxy ne ""
Truth table66%2/3
A and B
A= defined $proxyB= $proxy ne ""
ABresult
0X0
100
111
403 # HTTPS: PROXY SUPPORT
404 2 $ENV{HTTPS_PROXY} = $_[0]->{_proxy}->{server};
405  
406 # HTTPS: PROXY BASIC_AUTH
407 2 ▶ $ENV{HTTPS_PROXY_USERNAME} = $_[0]->{_proxy}->{username} if (defined $_[0]->{_proxy}->{username});
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_proxy"}{"username"} 2 0 2
408 2 ▶ $ENV{HTTPS_PROXY_PASSWORD} = $_[0]->{_proxy}->{password} if (defined $_[0]->{_proxy}->{password});
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_proxy"}{"password"} 2 0 2
409 }
410  
411 57 ▶ if (exists $_[0]->{_clientCertificate}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_[0]{"_clientCertificate"}) 4 53 57
412 4 ▶ if (defined $_[0]->{_clientCertificate}->{certFile} and defined $_[0]->{_clientCertificate}->{keyFile}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]{"_clientCertificate"}{"certFile"} and defined $_[0]{"_clientCertificate"}{"keyFile"}) 4 0 4
Condition33%1/3
defined $_[0]{"_clientCertificate"}{"certFile"} and defined $_[0]{"_clientCertificate"}{"keyFile"}
!ll&&!rl&&r
004
MC/DC0%0/2
defined $_[0]{"_clientCertificate"}{"certFile"} and defined $_[0]{"_clientCertificate"}{"keyFile"}
defined $_[0]{"_clientCertificate"}{"certFile"} defined $_[0]{"_clientCertificate"}{"keyFile"}
Truth table33%1/3
A and B
A= defined $_[0]{"_clientCertificate"}{"certFile"}B= defined $_[0]{"_clientCertificate"}{"keyFile"}
ABresult
0X0
100
111
413 # CLIENT CERT SUPPORT, PEM encoded certificate and private key files.
414 4 $ENV{HTTPS_CERT_FILE} = $_[0]->{_clientCertificate}->{certFile};
415 4 $ENV{HTTPS_KEY_FILE} = $_[0]->{_clientCertificate}->{keyFile};
416  
417 4 ▶ if (defined $_[0]->{_clientCertificate}->{caFile} and defined $_[0]->{_clientCertificate}->{caDir}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]{"_clientCertificate"}{"caFile"} and defined $_[0]{"_clientCertificate"}{"caDir"}) 2 2 4
Condition66%2/3
defined $_[0]{"_clientCertificate"}{"caFile"} and defined $_[0]{"_clientCertificate"}{"caDir"}
!ll&&!rl&&r
202
MC/DC50%1/2
defined $_[0]{"_clientCertificate"}{"caFile"} and defined $_[0]{"_clientCertificate"}{"caDir"}
defined $_[0]{"_clientCertificate"}{"caFile"} defined $_[0]{"_clientCertificate"}{"caDir"}
Truth table66%2/3
A and B
A= defined $_[0]{"_clientCertificate"}{"caFile"}B= defined $_[0]{"_clientCertificate"}{"caDir"}
ABresult
0X0
100
111
418 # CA CERT PEER VERIFICATION, Additionally, if you would like to tell the client where the CA file is.
419 2 $ENV{HTTPS_CA_FILE} = $_[0]->{_clientCertificate}->{caFile};
420 2 $ENV{HTTPS_CA_DIR} = $_[0]->{_clientCertificate}->{caDir};
421 }
422 }
423  
424 4 ▶ if (defined $_[0]->{_clientCertificate}->{pkcs12File} and defined $_[0]->{_clientCertificate}->{pkcs12Password}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]{"_clientCertificate"}{"pkcs12File"} and defined $_[0]{"_clientCertificate"}{"pkcs12Password"}) 2 2 4
Condition66%2/3
defined $_[0]{"_clientCertificate"}{"pkcs12File"} and defined $_[0]{"_clientCertificate"}{"pkcs12Password"}
!ll&&!rl&&r
202
MC/DC50%1/2
defined $_[0]{"_clientCertificate"}{"pkcs12File"} and defined $_[0]{"_clientCertificate"}{"pkcs12Password"}
defined $_[0]{"_clientCertificate"}{"pkcs12File"} defined $_[0]{"_clientCertificate"}{"pkcs12Password"}
Truth table66%2/3
A and B
A= defined $_[0]{"_clientCertificate"}{"pkcs12File"}B= defined $_[0]{"_clientCertificate"}{"pkcs12Password"}
ABresult
0X0
100
111
425 # CLIENT PKCS12 CERT SUPPORT, Use of this type of certificate will take precedence over previous certificate settings described.
426 2 $ENV{HTTPS_PKCS12_FILE} = $_[0]->{_clientCertificate}->{pkcs12File};
427 2 $ENV{HTTPS_PKCS12_PASSWORD} = $_[0]->{_clientCertificate}->{pkcs12Password};
428 }
429 }
430 }
431  
432 # Object accessor methods - - - - - - - - - - - - - - - - - - - - - - - -
433  
434 123 ▶sub appendPerformanceData { &_checkAccObjRef ( $_[0] ); &_checkSubArgs1; $_[0]->{_pluginValues}->{performanceData} .= ' '. $_[1] if ( defined $_[1] ); }
Subroutine appendPerformanceData: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1] 121 2 123
435  
436 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
437  
438 24 ▶sub browseragent { &_checkAccObjRef ( $_[0] ); &_checkSubArgs1; $_[0]->{_browseragent} = $_[1] if ( defined $_[1] ); $_[0]->{_browseragent}; }
Subroutine browseragent: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1] 2 22 24
439  
440 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
441  
442 8 ▶sub SSLversion {
Subroutine SSLversion: called CC=3 SCAR=11.0
Pod documented
443 8 &_checkAccObjRef ( $_[0] ); &_checkSubArgs1;
444  
445 8 ▶ if ( defined $_[1] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) 8 0 8
446 8 ▶ $_[0]->{_SSLversion} = ($_[1] =~ /^(?:2|3|23)$/ ? $_[1] : 3);
Branch: 1 branch
BranchTrueFalseTotal
$_[1] =~ /^(?:2|3|23)$/ ? : 6 2 8
447 }
448  
449 8 $_[0]->{_SSLversion};
450 }
451  
452 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
453  
454 26 ▶sub clientCertificate {
Subroutine clientCertificate: called CC=5 SCAR=16.6
Pod documented
455 26 &_checkAccObjRef ( $_[0] ); &_checkSubArgs2;
456  
457 26 ▶ if ( defined $_[1] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) 26 0 26
458 26 ▶ if ( defined $_[2] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[2]) 14 12 26
459 14 ▶ $_[0]->{_clientCertificate}->{$_[1]} = $_[2] if ( exists $_[0]->{_clientCertificate}->{$_[1]} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $_[0]{"_clientCertificate"}{$_[1]} 14 0 14
460 }
461  
462 26 ▶ ( defined $_[0]->{_clientCertificate}->{$_[1]} ) ? $_[0]->{_clientCertificate}->{$_[1]} : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'_clientCertificate'}{$_[1]} ? : 26 0 26
463 }
464 }
465  
466 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
467  
468 270 ▶sub pluginValue {
Subroutine pluginValue: called CC=16 SCAR=30.0
Pod documented
469 270 &_checkAccObjRef ( $_[0] ); &_checkSubArgs2;
470  
471 270 ▶ if ( defined $_[1] and exists $_[0]->{_pluginValues}->{$_[1]}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1] and exists $_[0]{"_pluginValues"}{$_[1]}) 270 0 270
Condition33%1/3
defined $_[1] and exists $_[0]{"_pluginValues"}{$_[1]}
!ll&&!rl&&r
00270
MC/DC0%0/2
defined $_[1] and exists $_[0]{"_pluginValues"}{$_[1]}
defined $_[1] exists $_[0]{"_pluginValues"}{$_[1]}
Truth table33%1/3
A and B
A= defined $_[1]B= exists $_[0]{"_pluginValues"}{$_[1]}
ABresult
0X0
100
111
472 270 ▶ if ( exists $_[2] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_[2]) 53 217 270
473 53 ▶ if ( $_[1] eq 'stateValue' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($_[1] eq 'stateValue') { } 21 32 53
elsif ($_[1] eq 'stateError') { } 20 12 32
474 21 ▶ &_dumpValue ( $_[2], 'Wrong value!' ) unless ( defined $_[2] && $_[2] =~ /^[0-3]$/ );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[2] and $_[2] =~ /^[0-3]$/ 0 21 21
Condition33%1/3
defined $_[2] and $_[2] =~ /^[0-3]$/
!ll&&!rl&&r
0021
MC/DC0%0/2
defined $_[2] and $_[2] =~ /^[0-3]$/
defined $_[2] $_[2] =~ /^[0-3]$/
Truth table33%1/3
A and B
A= defined $_[2]B= $_[2] =~ /^[0-3]$/
ABresult
0X0
100
111
475 21 ▶ my $stateValue = $_[0]->{_pluginValues}->{stateValue} == $ERRORS{DEPENDENT} ? $_[2] : ( $_[0]->{_pluginValues}->{stateValue} > $_[2] ? $_[0]->{_pluginValues}->{stateValue} : $_[2] );
Branch: 2 branches
BranchTrueFalseTotal
$_[0]{'_pluginValues'}{'stateValue'} == $ASNMTAP::Asnmtap::Plugins::ERRORS{'DEPENDENT'} ? : 3 18 21
$_[0]{'_pluginValues'}{'stateValue'} > $_[2] ? : 12 6 18
476 21 $_[0]->{_pluginValues}->{stateValue} = $stateValue;
477 21 $_[0]->{_pluginValues}->{stateError} = $STATE{$stateValue};
478 } elsif ( $_[1] eq 'stateError' ) {
479 20 ▶ &_dumpValue ( $_[2], 'Wrong value!' ) unless ( defined $_[2] && $_[2] =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/ );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[2] and $_[2] =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/ 0 20 20
Condition33%1/3
defined $_[2] and $_[2] =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/
!ll&&!rl&&r
0020
MC/DC0%0/2
defined $_[2] and $_[2] =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/
defined $_[2] $_[2] =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/
Truth table33%1/3
A and B
A= defined $_[2]B= $_[2] =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/
ABresult
0X0
100
111
480 20 ▶ my $stateValue = $_[0]->{_pluginValues}->{stateValue} == $ERRORS{DEPENDENT} ? $ERRORS{$_[2]} : ( $_[0]->{_pluginValues}->{stateValue} > $ERRORS{$_[2]} ? $_[0]->{_pluginValues}->{stateValue} : $ERRORS{$_[2]} );
Branch: 2 branches
BranchTrueFalseTotal
$_[0]{'_pluginValues'}{'stateValue'} == $ASNMTAP::Asnmtap::Plugins::ERRORS{'DEPENDENT'} ? : 0 20 20
$_[0]{'_pluginValues'}{'stateValue'} > $ASNMTAP::Asnmtap::Plugins::ERRORS{$_[2]} ? : 12 8 20
481 20 $_[0]->{_pluginValues}->{stateValue} = $stateValue;
482 20 $_[0]->{_pluginValues}->{stateError} = $STATE{$stateValue};
483 } else {
484 12 ▶ $_[0]->{_pluginValues}->{$_[1]} = $_[2] if ( defined $_[2] );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[2] 12 0 12
485 }
486 }
487  
488 270 ▶ ( defined $_[0]->{_pluginValues}->{$_[1]} ) ? $_[0]->{_pluginValues}->{$_[1]} : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'_pluginValues'}{$_[1]} ? : 270 0 270
489 }
490 }
491  
492 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
493  
494 126 ▶sub pluginValues {
Subroutine pluginValues: called CC=38 SCAR=53.1
Pod documented
495 126 &_checkAccObjRef ( $_[0] ); &_checkSubArgs2;
496 126 ▶ &_dumpValue ( $_[1], 'Request parameter is not a hash.' ) if ( ref $_[1] ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[1] ne "HASH" 0 126 126
497 126 ▶ &_dumpValue ( $_[1], 'Replace/Append value missing!' ) unless (defined $_[2]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[2] 0 126 126
498  
499 126 ▶ if ( exists $_[1]->{stateValue} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $_[1]{'stateValue'}) { } 98 28 126
elsif (exists $_[1]{'stateError'}) { } 20 8 28
500 98 ▶ &_dumpValue ( $_[1]->{stateValue}, 'Wrong value!' ) unless ( defined $_[1]->{stateValue} && $_[1]->{stateValue} =~ /^[0-3]$/ );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1]{"stateValue"} and $_[1]{"stateValue"} =~ /^[0-3]$/ 0 98 98
Condition33%1/3
defined $_[1]{"stateValue"} and $_[1]{"stateValue"} =~ /^[0-3]$/
!ll&&!rl&&r
0098
MC/DC0%0/2
defined $_[1]{"stateValue"} and $_[1]{"stateValue"} =~ /^[0-3]$/
defined $_[1]{"stateValue"} $_[1]{"stateValue"} =~ /^[0-3]$/
Truth table33%1/3
A and B
A= defined $_[1]{"stateValue"}B= $_[1]{"stateValue"} =~ /^[0-3]$/
ABresult
0X0
100
111
501 98 ▶ my $stateValue = $_[0]->{_pluginValues}->{stateValue} == $ERRORS{DEPENDENT} ? $_[1]->{stateValue} : ( $_[0]->{_pluginValues}->{stateValue} > $_[1]->{stateValue} ? $_[0]->{_pluginValues}->{stateValue} : $_[1]->{stateValue} );
Branch: 2 branches
BranchTrueFalseTotal
$_[0]{'_pluginValues'}{'stateValue'} == $ASNMTAP::Asnmtap::Plugins::ERRORS{'DEPENDENT'} ? : 27 71 98
$_[0]{'_pluginValues'}{'stateValue'} > $_[1]{'stateValue'} ? : 15 56 71
502 98 $_[0]->{_pluginValues}->{stateValue} = $stateValue;
503 98 $_[0]->{_pluginValues}->{stateError} = $STATE{$stateValue};
504 } elsif ( exists $_[1]->{stateError} ) {
505 20 ▶ &_dumpValue ( $_[1]->{stateError}, 'Wrong value!' ) unless ( defined $_[1]->{stateError} && $_[1]->{stateError} =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/ );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1]{"stateError"} and $_[1]{"stateError"} =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/ 0 20 20
Condition33%1/3
defined $_[1]{"stateError"} and $_[1]{"stateError"} =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/
!ll&&!rl&&r
0020
MC/DC0%0/2
defined $_[1]{"stateError"} and $_[1]{"stateError"} =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/
defined $_[1]{"stateError"} $_[1]{"stateError"} =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/
Truth table33%1/3
A and B
A= defined $_[1]{"stateError"}B= $_[1]{"stateError"} =~ /^(?:OK|WARNING|CRITICAL|UNKNOWN)$/
ABresult
0X0
100
111
506 20 ▶ my $stateValue = $_[0]->{_pluginValues}->{stateValue} == $ERRORS{DEPENDENT} ? $ERRORS{$_[1]->{stateError}} : ( $_[0]->{_pluginValues}->{stateValue} > $ERRORS{$_[1]->{stateError}} ? $_[0]->{_pluginValues}->{stateValue} : $ERRORS{$_[1]->{stateError}} );
Branch: 2 branches
BranchTrueFalseTotal
$_[0]{'_pluginValues'}{'stateValue'} == $ASNMTAP::Asnmtap::Plugins::ERRORS{'DEPENDENT'} ? : 0 20 20
$_[0]{'_pluginValues'}{'stateValue'} > $ASNMTAP::Asnmtap::Plugins::ERRORS{$_[1]{'stateError'}} ? : 12 8 20
507 20 $_[0]->{_pluginValues}->{stateValue} = $stateValue;
508 20 $_[0]->{_pluginValues}->{stateError} = $STATE{$stateValue};
509 }
510  
511 126 ▶ if ( $_[2] == $TYPE{REPLACE} ) {
Branch: 6 branches
BranchTrueFalseTotal
if ($_[2] == $ASNMTAP::Asnmtap::Plugins::TYPE{'REPLACE'}) { } 27 99 126
elsif ($_[2] == $ASNMTAP::Asnmtap::Plugins::TYPE{'APPEND'}) { } 99 0 99
elsif ($_[2] == $ASNMTAP::Asnmtap::Plugins::TYPE{'INSERT'}) { } 0 0 0
elsif ($_[2] == $ASNMTAP::Asnmtap::Plugins::TYPE{'COMMA_REPLACE'}) { } 0 0 0
elsif ($_[2] == $ASNMTAP::Asnmtap::Plugins::TYPE{'COMMA_APPEND'}) { } 0 0 0
elsif ($_[2] == $ASNMTAP::Asnmtap::Plugins::TYPE{'COMMA_INSERT'}) { } 0 0 0
512 27 ▶ $_[0]->{_pluginValues}->{alert} = $_[1]->{alert} if ( defined $_[1]->{alert} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1]{"alert"} 27 0 27
513 27 ▶ $_[0]->{_pluginValues}->{error} = $_[1]->{error} if ( defined $_[1]->{error} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1]{"error"} 13 14 27
514 } elsif ( $_[2] == $TYPE{APPEND} ) {
515 99 ▶ $_[0]->{_pluginValues}->{alert} .= ( ( defined $_[0]->{_pluginValues}->{alert} ? ' - ' : '' ) .$_[1]->{alert} ) if ( defined $_[1]->{alert} );
Branch: 2 branches
BranchTrueFalseTotal
if defined $_[1]{"alert"} 10 89 99
defined $_[0]{'_pluginValues'}{'alert'} ? : 5 5 10
516 99 ▶ $_[0]->{_pluginValues}->{error} .= ( ( defined $_[0]->{_pluginValues}->{error} ? ' - ' : '' ) .$_[1]->{error} ) if ( defined $_[1]->{error} );
Branch: 2 branches
BranchTrueFalseTotal
if defined $_[1]{"error"} 52 47 99
defined $_[0]{'_pluginValues'}{'error'} ? : 36 16 52
517 } elsif ( $_[2] == $TYPE{INSERT} ) {
518 0 ▶ $_[0]->{_pluginValues}->{alert} = ( $_[1]->{alert} . ( defined $_[0]->{_pluginValues}->{alert} ? ' - '. $_[0]->{_pluginValues}->{alert} : '' ) ) if ( defined $_[1]->{alert} );
Branch: 2 branches
BranchTrueFalseTotal
if defined $_[1]{"alert"} 0 0 0
defined $_[0]{'_pluginValues'}{'alert'} ? : 0 0 0
519 0 ▶ $_[0]->{_pluginValues}->{error} = ( $_[1]->{error} . ( defined $_[0]->{_pluginValues}->{error} ? ' - '. $_[0]->{_pluginValues}->{error} : '' ) ) if ( defined $_[1]->{error} );
Branch: 2 branches
BranchTrueFalseTotal
if defined $_[1]{"error"} 0 0 0
defined $_[0]{'_pluginValues'}{'error'} ? : 0 0 0
520 } elsif ( $_[2] == $TYPE{COMMA_REPLACE} ) {
521 # reserved !!!
522 } elsif ( $_[2] == $TYPE{COMMA_APPEND} ) {
523 0 ▶ $_[0]->{_pluginValues}->{alert} .= ( ( defined $_[0]->{_pluginValues}->{alert} ? ', ' : '' ) .$_[1]->{alert} ) if ( defined $_[1]->{alert} );
Branch: 2 branches
BranchTrueFalseTotal
if defined $_[1]{"alert"} 0 0 0
defined $_[0]{'_pluginValues'}{'alert'} ? : 0 0 0
524 0 ▶ $_[0]->{_pluginValues}->{error} .= ( ( defined $_[0]->{_pluginValues}->{error} ? ', ' : '' ) .$_[1]->{error} ) if ( defined $_[1]->{error} );
Branch: 2 branches
BranchTrueFalseTotal
if defined $_[1]{"error"} 0 0 0
defined $_[0]{'_pluginValues'}{'error'} ? : 0 0 0
525 } elsif ( $_[2] == $TYPE{COMMA_INSERT} ) {
526 0 ▶ $_[0]->{_pluginValues}->{alert} = ( $_[1]->{alert} . ( defined $_[0]->{_pluginValues}->{alert} ? ', '. $_[0]->{_pluginValues}->{alert} : '' ) ) if ( defined $_[1]->{alert} );
Branch: 2 branches
BranchTrueFalseTotal
if defined $_[1]{"alert"} 0 0 0
defined $_[0]{'_pluginValues'}{'alert'} ? : 0 0 0
527 0 ▶ $_[0]->{_pluginValues}->{error} = ( $_[1]->{error} . ( defined $_[0]->{_pluginValues}->{alert} ? ', '. $_[0]->{_pluginValues}->{error} : '' ) ) if ( defined $_[1]->{error} );
Branch: 2 branches
BranchTrueFalseTotal
if defined $_[1]{"error"} 0 0 0
defined $_[0]{'_pluginValues'}{'alert'} ? : 0 0 0
528 }
529  
530 126 ▶ $_[0]->{_pluginValues}->{result} = $_[1]->{result} if ( defined $_[1]->{result} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1]{"result"} 22 104 126
531 }
532  
533 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
534  
535 33 ▶sub proxy {
Subroutine proxy: called CC=6 SCAR=18.6
Pod documented
536 33 &_checkAccObjRef ( $_[0] ); &_checkSubArgs2;
537  
538 33 ▶ if ( defined $_[1] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) 33 0 33
539 33 ▶ if ( exists $_[0]->{_proxy} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_[0]{'_proxy'}) { } 6 27 33
540 6 ▶ if ( defined $_[2] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[2]) 6 0 6
541 6 ▶ $_[0]->{_proxy}->{$_[1]} = $_[2] if ( exists $_[0]->{_proxy}->{$_[1]} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $_[0]{"_proxy"}{$_[1]} 6 0 6
542 }
543  
544 6 ▶ ( defined $_[0]->{_proxy}->{$_[1]} ) ? $_[0]->{_proxy}->{$_[1]} : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'_proxy'}{$_[1]} ? : 6 0 6
545 } else {
546 27 undef;
547 }
548 }
549 }
550  
551 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
552  
553 31 ▶sub timeout { &_checkAccObjRef ( $_[0] ); &_checkSubArgs1; $_[0]->{_timeout} = $_[1] if ( defined $_[1] ); $_[0]->{_timeout}; }
Subroutine timeout: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1] 2 29 31
554  
555 # Class accessor methods - - - - - - - - - - - - - - - - - - - - - - - -
556  
557 125 ▶sub setEndTime_and_getResponsTime {
Subroutine setEndTime_and_getResponsTime: called CC=4 SCAR=14.0
Pod documented
558 125 &_checkAccObjRef ( $_[0] ); &_checkSubArgs1;
559  
560 125 my ($endTimeSeconds, $endTimeMicroseconds) = gettimeofday();
561 125 $_[0]->{_pluginValues}->{endTime} = "$endTimeSeconds.$endTimeMicroseconds";
562  
563 125 my ($startTimeSeconds, $startTimeMicroseconds) = split (/\./, $_[1]);
564 125 ▶ $startTimeMicroseconds = 0 unless ( defined $startTimeMicroseconds );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $startTimeMicroseconds 48 77 125
565 125 ▶ return ( defined $startTimeSeconds ? int ( ( ( $endTimeSeconds >= $startTimeSeconds ) ? tv_interval ( [$startTimeSeconds, $startTimeMicroseconds], [$endTimeSeconds, $endTimeMicroseconds] ) : tv_interval ( [$endTimeSeconds, $endTimeMicroseconds], [$startTimeSeconds, $startTimeMicroseconds] ) ) * 1000 ) : -1 );
Branch: 2 branches
BranchTrueFalseTotal
defined $startTimeSeconds ? : 125 0 125
$endTimeSeconds >= $startTimeSeconds ? : 125 0 125
566 }
567  
568 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
569  
570 0 ▶sub write_debugfile {
Subroutine write_debugfile: not called CC=6 SCAR=37.4
Pod documented
571 0 &_checkAccObjRef ( $_[0] ); &_checkReadOnly2;
572  
573 0 my $debugfile = $_[0]->{_getOptionsArgv}->{debugfile};
574  
575 0 ▶ if ( defined $debugfile ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $debugfile) 0 0 0
576 0 ▶ my $openAppend = ( defined $_[2] and $_[2] =~ /^1$/ ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[2] && $_[2] =~ /^1$/ ? : 0 0 0
Condition0%0/3
defined $_[2] and $_[2] =~ /^1$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[2] and $_[2] =~ /^1$/
defined $_[2] $_[2] =~ /^1$/
Truth table0%0/3
A and B
A= defined $_[2]B= $_[2] =~ /^1$/
ABresult
0X0
100
111
577 0 ▶ my $rvOpen = open (DEBUGFILE, ($openAppend ? '>>' : '>') .$debugfile);
Branch: 1 branch
BranchTrueFalseTotal
$openAppend ? : 0 0 0
578  
579 0 ▶ if ($rvOpen) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rvOpen) { } 0 0 0
580 0 print DEBUGFILE ${$_[1]}, "\n";
581 0 close(DEBUGFILE);
582 } else {
583 0 print ref ($_[0]) .": Cannot open $debugfile to print debug information\n";
584 }
585 }
586 }
587  
588 # Utility methods - - - - - - - - - - - - - - - - - - - - - - - - - - - -
589  
590 47 ▶sub printUsage {
Subroutine printUsage: called CC=2 SCAR=7.2
Pod documented
591 47 ▶ $_[0]->_getOptions () if ( exists $_[0]->{_getOptionsArgv}->{usage} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $_[0]{"_getOptionsArgv"}{"usage"} 0 47 47
592 47 $_[0]->SUPER::printUsage ($_[1]);
593 }
594  
595 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
596  
597 24 ▶sub printHelp {
Subroutine printHelp: called CC=1 SCAR=0.0
Pod documented
598 24 $_[0]->_getOptions ();
599 9 $_[0]->SUPER::printHelp ();
600 }
601  
602 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
603  
604 4 ▶sub call_system {
Subroutine call_system: called CC=9 SCAR=26.0
Pod documented
605 4 &_checkAccObjRef ( $_[0] ); &_checkReadOnly2;
606  
607 4 ▶ return ( $ERRORS{DEPENDENT} ) unless ( defined $_[1] );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] 0 4 4
608 4 my ($status, $stdout, $stderr) = $_[0]->SUPER::call_system ( $_[1] );
609  
610 4 ▶ if ( $status ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status) { } 2 2 4
611 2 ▶ if ( $_[0]->{_getOptionsValues}->{debug} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{'_getOptionsValues'}{'debug'}) { } 0 2 2
612 0 ▶ $_[0]->pluginValues ( { stateValue => $ERRORS{OK}, alert => $_[1] .': OK', result => ( defined $stdout ? $stdout : undef ) }, $TYPE{APPEND} );
Branch: 1 branch
BranchTrueFalseTotal
defined $stdout ? : 0 0 0
613 } else {
614 2 ▶ $_[0]->pluginValues ( { stateValue => $ERRORS{OK}, result => ( defined $stdout ? $stdout : undef ) }, $TYPE{APPEND} );
Branch: 1 branch
BranchTrueFalseTotal
defined $stdout ? : 2 0 2
615 }
616  
617 2 return ( $ERRORS{OK} );
618 } else {
619 2 ▶ if ( $_[0]->{_getOptionsValues}->{debug} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{'_getOptionsValues'}{'debug'}) { } 0 2 2
620 0 ▶ $_[0]->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, result => ( defined $stderr ? $stderr : undef ) }, $TYPE{APPEND} );
Branch: 1 branch
BranchTrueFalseTotal
defined $stderr ? : 0 0 0
621 } else {
622 2 ▶ $_[0]->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => $_[1] .': '. $stderr, result => ( defined $stderr ? $stderr : undef ) }, $TYPE{APPEND} );
Branch: 1 branch
BranchTrueFalseTotal
defined $stderr ? : 2 0 2
623 }
624  
625 2 return ( $ERRORS{UNKNOWN} );
626 }
627 }
628  
629 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
630  
631 29 ▶sub exit {
Subroutine exit: called CC=47 SCAR=66.9
Pod documented
632 29 &_checkAccObjRef ( $_[0] ); &_checkSubArgs1;
633  
634 29 ▶ exit $ERRORS { $_[0]->{_pluginValues}->{stateError} } if ( exists $_[0]->{_exit_} and $_[0]->{_exit_} == 1 );
Branch: 1 branch
BranchTrueFalseTotal
if exists $_[0]{"_exit_"} and $_[0]{"_exit_"} == 1 0 29 29
Condition33%1/3
exists $_[0]{"_exit_"} and $_[0]{"_exit_"} == 1
!ll&&!rl&&r
0290
MC/DC0%0/2
exists $_[0]{"_exit_"} and $_[0]{"_exit_"} == 1
exists $_[0]{"_exit_"} $_[0]{"_exit_"} == 1
Truth table33%1/3
A and B
A= exists $_[0]{"_exit_"}B= $_[0]{"_exit_"} == 1
ABresult
0X0
100
111
635  
636 # Timing Out Slow Plugins - part 2/2 - - - - - - - - - - - - - - - - -
637  
638 29 ▶ if ( exists $_[0]->{_getOptionsArgv}->{timeout} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_[0]{"_getOptionsArgv"}{"timeout"}) 0 29 29
639 0 my $remaining = alarm (0);
640  
641 0 ▶ if ( $ALARM_OFF or $! =~ /\QASNMTAP::Asnmtap::Plugins::ALARM_OFF = 1\n\E/ or $@ =~ /\QASNMTAP::Asnmtap::Plugins::ALARM_OFF = 1\n\E/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ASNMTAP::Asnmtap::Plugins::ALARM_OFF or $! =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/ or $@ =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/) 0 0 0
Condition0%0/6
$ASNMTAP::Asnmtap::Plugins::ALARM_OFF or $! =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/ or $@ =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/
l!l&&r!l&&!r
000
$ASNMTAP::Asnmtap::Plugins::ALARM_OFF or $! =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/
l!l&&r!l&&!r
000
MC/DC0%0/3
$ASNMTAP::Asnmtap::Plugins::ALARM_OFF or $! =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/ or $@ =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/
$ASNMTAP::Asnmtap::Plugins::ALARM_OFF $! =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/ $@ =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/
Truth table0%0/4
A or B or C
A= $ASNMTAP::Asnmtap::Plugins::ALARM_OFFB= $! =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/C= $@ =~ /ASNMTAP\:\:Asnmtap\:\:Plugins\:\:ALARM_OFF\ \=\ 1\\n/
ABCresult
1XX1
01X1
0011
0000
642 0 $_[0]->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => "TIMING OUT SLOW PLUGIN ($remaining)" }, $TYPE{APPEND} );
643 0 $remaining = 0;
644 }
645  
646 0 ▶ $SIG{ALRM} = $_[0]->{_pluginValues}->{_handler_} ? $_[0]->{_pluginValues}->{_handler_} : 'DEFAULT';
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{'_pluginValues'}{'_handler_'} ? : 0 0 0
647  
648 0 ▶ if ( $_[0]->{_pluginValues}->{_alarm_} ) { # Previous alarm pending
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"_pluginValues"}{"_alarm_"}) 0 0 0
649 0 my $alarm = $_[0]->{_pluginValues}->{_alarm_} - $_[0]->{_getOptionsArgv}->{timeout} + $remaining;
650  
651 0 ▶ if ( $alarm > 0 ) { # Reset it, excluding the elapsed time
Branch: 1 branch
BranchTrueFalseTotal
if ($alarm > 0) { } 0 0 0
652 0 alarm ($alarm);
653 } else { # It should have gone off already, set it off
654 0 kill 'ALRM',$$;
655 }
656 }
657 }
658  
659 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
660  
661 29 ▶ $_[0]->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'HELP, THERE IS A PROBLEM WITH THE PLUGIN' }, $TYPE{APPEND} ) if ( $_[0]->{_pluginValues}->{stateValue} == $ERRORS{DEPENDENT} or ( exists $_[0]->{_exit_} and $_[0]->{_exit_} == 2 ) );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_pluginValues"}{"stateValue"} == $ASNMTAP::Asnmtap::Plugins::ERRORS{"DEPENDENT"} or exists $_[0]{"_exit_"} and $_[0]{"_exit_"} == 2 0 29 29
Condition33%2/6
$_[0]{"_pluginValues"}{"stateValue"} == $ASNMTAP::Asnmtap::Plugins::ERRORS{"DEPENDENT"} or exists $_[0]{"_exit_"} and $_[0]{"_exit_"} == 2
l!l&&r!l&&!r
0029
exists $_[0]{"_exit_"} and $_[0]{"_exit_"} == 2
!ll&&!rl&&r
0290
MC/DC0%0/3
$_[0]{"_pluginValues"}{"stateValue"} == $ASNMTAP::Asnmtap::Plugins::ERRORS{"DEPENDENT"} or exists $_[0]{"_exit_"} and $_[0]{"_exit_"} == 2
$_[0]{"_pluginValues"}{"stateValue"} == $ASNMTAP::Asnmtap::Plugins::ERRORS{"DEPENDENT"} exists $_[0]{"_exit_"} $_[0]{"_exit_"} == 2
Truth table25%1/4
A or B and C
A= $_[0]{"_pluginValues"}{"stateValue"} == $ASNMTAP::Asnmtap::Plugins::ERRORS{"DEPENDENT"}B= exists $_[0]{"_exit_"}C= $_[0]{"_exit_"} == 2
ABCresult
1XX1
0111
00X0
0100
662  
663 29 ▶ $_[0]->appendPerformanceData('Status='. $_[0]->{_pluginValues}->{stateValue} .';1;2;0;3') if ( defined $_[1] && $_[1] =~ /^[1357]$/ );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1] and $_[1] =~ /^[1357]$/ 24 5 29
Condition66%2/3
defined $_[1] and $_[1] =~ /^[1357]$/
!ll&&!rl&&r
0524
MC/DC50%1/2
defined $_[1] and $_[1] =~ /^[1357]$/
defined $_[1] $_[1] =~ /^[1357]$/
Truth table66%2/3
A and B
A= defined $_[1]B= $_[1] =~ /^[1357]$/
ABresult
0X0
100
111
664  
665 29 my $duration = $_[0]->setEndTime_and_getResponsTime ($_[0]->{_pluginValues}->{startTime});
666 29 ▶ $_[0]->appendPerformanceData('Compilation='. ($_[0]->setEndTime_and_getResponsTime ($^T) - $duration) .'ms;;;0;') if ( $_[1] =~ /^[2367]$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[1] =~ /^[2367]$/ 24 5 29
667  
668 29 ▶ if ( $_[0]->{_getOptionsArgv}->{trendline} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{'_getOptionsArgv'}{'trendline'}) { } 0 29 29
669 0 my $responseTimeSeconds = ( $duration / 1000 ); # convert to seconds
670  
671 0 ▶ if ( $_[0]->{_getOptionsValues}->{debug} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"_getOptionsValues"}{"debug"}) 0 0 0
672 0 my ($startTimeEpoch, undef) = split (/\./, $_[0]->{_pluginValues}->{startTime});
673 0 my ($endTimeEpoch, undef) = split (/\./, $_[0]->{_pluginValues}->{endTime});
674 0 print "\nStart time : ", scalar(localtime($startTimeEpoch)), "\n";
675 0 print "End time : ", scalar(localtime($endTimeEpoch)), "\n";
676 0 print "Trendline : ". $_[0]->{_getOptionsArgv}->{trendline} ."\n";
677 0 print "Response time: $responseTimeSeconds\n";
678 }
679  
680 0 ▶ if ( $_[0]->{_pluginValues}->{stateValue} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{'_pluginValues'}{'stateValue'}) { } 0 0 0
681 0 $_[0]->appendPerformanceData('Trendline='. $responseTimeSeconds .'s;;;;');
682 } else {
683 0 $_[0]->appendPerformanceData('Trendline='. $responseTimeSeconds .'s;'. $_[0]->{_getOptionsArgv}->{trendline} .';;;');
684 0 ▶ $_[0]->{_pluginValues}->{alert} = "Response time $responseTimeSeconds > trendline ". $_[0]->{_getOptionsArgv}->{trendline} if ( $responseTimeSeconds > $_[0]->{_getOptionsArgv}->{trendline} );
Branch: 1 branch
BranchTrueFalseTotal
if $responseTimeSeconds > $_[0]{"_getOptionsArgv"}{"trendline"} 0 0 0
685 }
686 } else {
687 29 ▶ $_[0]->appendPerformanceData('Duration='. $duration .'ms;;;0;') if ( $_[1] =~ /^[2367]$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[1] =~ /^[2367]$/ 24 5 29
688 }
689  
690 29 ▶ $_[0]->{_pluginValues}->{alert} =~ s/^\s+//g if ( defined $_[0]->{_pluginValues}->{alert} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_pluginValues"}{"alert"} 15 14 29
691  
692 29 ▶ if ( $_[0]->{_getOptionsValues}->{debug} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"_getOptionsValues"}{"debug"}) 0 29 29
693 0 ▶ print "\nStatus : ". $_[0]->{_getOptionsArgv}->{status} ."\n" if ( defined $_[0]->{_getOptionsArgv}->{status} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_getOptionsArgv"}{"status"} 0 0 0
694 0 ▶ print "Debug : ". $_[0]->{_getOptionsValues}->{debug} ."\n" if ( defined $_[0]->{_getOptionsValues}->{debug} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_getOptionsValues"}{"debug"} 0 0 0
695 0 ▶ print "Logging : ". $_[0]->{_getOptionsArgv}->{logging} ."\n" if ( defined $_[0]->{_getOptionsArgv}->{logging} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_getOptionsArgv"}{"logging"} 0 0 0
696 0 ▶ print "Httpdump : ". $_[0]->{_getOptionsArgv}->{debugfile} ."\n" if ( defined $_[0]->{_getOptionsArgv}->{debugfile} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_getOptionsArgv"}{"debugfile"} 0 0 0
697 0 ▶ print "State : ". $_[0]->{_pluginValues}->{stateError} ."\n" if ( defined $_[0]->{_pluginValues}->{stateError} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_pluginValues"}{"stateError"} 0 0 0
698 0 ▶ print "Message : ". $_[0]->{_pluginValues}->{message} ."\n" if ( defined $_[0]->{_pluginValues}->{message} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_pluginValues"}{"message"} 0 0 0
699 0 ▶ print "Alert : ". $_[0]->{_pluginValues}->{alert} ."\n" if ( defined $_[0]->{_pluginValues}->{alert} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_pluginValues"}{"alert"} 0 0 0
700 0 ▶ print "Error : ". $_[0]->{_pluginValues}->{error} ."\n" if ( defined $_[0]->{_pluginValues}->{error} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_pluginValues"}{"error"} 0 0 0
701 0 print "\n";
702 }
703  
704 29 my $returnMessage = $_[0]->{_pluginValues}->{stateError} .' - '. $_[0]->{_pluginValues}->{message} .':';
705 29 ▶ $returnMessage .= ' '. $_[0]->{_pluginValues}->{alert} if ( $_[0]->{_pluginValues}->{alert} );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_pluginValues"}{"alert"} 15 14 29
706 29 ▶ $returnMessage .= ' ERROR: '. $_[0]->{_pluginValues}->{error} if (defined $_[0]->{_pluginValues}->{error});
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"_pluginValues"}{"error"} 23 6 29
707  
708 29 ▶ $_[0]->appendPerformanceData('Execution='. $_[0]->setEndTime_and_getResponsTime ($^T) .'ms;;;0;') if ( $_[1] =~ /^[2367]$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[1] =~ /^[2367]$/ 24 5 29
709  
710 29 ▶ if ( defined $_[0]->{_pluginValues}->{performanceData} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]{"_pluginValues"}{"performanceData"}) 27 2 29
711 27 $_[0]->{_pluginValues}->{performanceData} =~ s/^\s+//g;
712 27 $returnMessage .= '|'. $_[0]->{_pluginValues}->{performanceData};
713 }
714  
715 29 ▶ if ( $_[0]->{_getOptionsArgv}->{logging} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"_getOptionsArgv"}{"logging"}) 0 29 29
716 0 ▶ unless ( $CAPTUREOUTPUT ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ASNMTAP::Asnmtap::Plugins::CAPTUREOUTPUT) 0 0 0
717 0 ▶ my $loggedStatus = ( $_[0]->{_getOptionsArgv}->{debugfile} ) ? $_[0]->{_getOptionsArgv}->{debugfile} : $_[0]->{_getOptionsArgv}->{logging};
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{'_getOptionsArgv'}{'debugfile'} ? : 0 0 0
718 0 $loggedStatus .= "-status.txt";
719  
720 0 my $rvOpen = open( LOGGING, ">$loggedStatus" );
721  
722 0 ▶ if ($rvOpen) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rvOpen) { } 0 0 0
723 0 print LOGGING "$returnMessage\n";
724 0 close(LOGGING);
725 } else {
726 0 print "Cannot open $loggedStatus to print debug information\n";
727 }
728 }
729  
730 0 ▶ if ( $_[0]->{_getOptionsValues}->{boolean_debug_all} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"_getOptionsValues"}{"boolean_debug_all"}) 0 0 0
731 0 my $rvOpen = open ( LOGGING, '>>'. $_[0]->{_getOptionsArgv}->{logging} .'-all.txt' );
732  
733 0 ▶ if ($rvOpen) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rvOpen) { } 0 0 0
734 0 print LOGGING "--> $returnMessage\n";
735 0 ▶ print LOGGING ' -> '. $_[0]->{_pluginValues}->{error} ."\n" if ( $_[0]->{_pluginValues}->{error} ne 'SUCCESS' );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_pluginValues"}{"error"} ne "SUCCESS" 0 0 0
736 0 close(LOGGING);
737 } else {
738 0 print 'Cannot open '. $_[0]->{_getOptionsArgv}->{logging} ."-all.txt to print debug information\n";
739 }
740 }
741  
742 0 ▶ if ( $_[0]->{_getOptionsValues}->{boolean_debug_NOK} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"_getOptionsValues"}{"boolean_debug_NOK"}) 0 0 0
743 0 ▶ if ( $_[0]->{_pluginValues}->{stateValue} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"_pluginValues"}{"stateValue"}) 0 0 0
744 0 my $rvOpen = open ( LOGGING, '>'. $_[0]->{_getOptionsArgv}->{logging} .'-nok.txt' );
745  
746 0 ▶ if ( $rvOpen ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rvOpen) { } 0 0 0
747 0 print LOGGING "--> $returnMessage\n";
748 0 print LOGGING ' -> '. $_[0]->{_pluginValues}->{error} ."\n";
749 0 print LOGGING ' > '. $_[0]->{_pluginValues}->{result} ."\n";
750 0 close(LOGGING);
751 } else {
752 0 print "Cannot open ". $_[0]->{_getOptionsArgv}->{logging} ."-nok.txt to print debug information\n";
753 }
754 }
755 }
756 }
757  
758 29 ▶ $_[0]->dumpData (1) if ( $_[0]->getOptionsArgv ('dumpData') );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]->getOptionsArgv("dumpData") 0 29 29
759  
760 29 ▶ print "$returnMessage\n" if ( $_[0]->{_plugins} );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_plugins"} 29 0 29
761 29 $_[0]->{_exit_} = 1;
762 29 exit $ERRORS { $_[0]->{_pluginValues}->{stateError} };
763 }
764  
765 # Destructor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
766  
767 0 ▶sub DESTROY {
Subroutine DESTROY: not called CC=5 SCAR=34.0
768 0 ▶ print (ref ($_[0]), "::DESTROY: ()\n") if ( $_[0]->{_debug} );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_debug"} 0 0 0
769  
770 0 ▶ if ( exists $_[0]->{_pluginValues} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_[0]{"_pluginValues"}) 0 0 0
771 0 ▶ unless ( exists $_[0]->{_exit_} and $_[0]->{_exit_} == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $_[0]{"_exit_"} and $_[0]{"_exit_"} == 1) 0 0 0
Condition0%0/3
exists $_[0]{"_exit_"} and $_[0]{"_exit_"} == 1
!ll&&!rl&&r
000
MC/DC0%0/2
exists $_[0]{"_exit_"} and $_[0]{"_exit_"} == 1
exists $_[0]{"_exit_"} $_[0]{"_exit_"} == 1
Truth table0%0/3
A and B
A= exists $_[0]{"_exit_"}B= $_[0]{"_exit_"} == 1
ABresult
0X0
100
111
772 0 $_[0]->{_exit_} = 2;
773 0 $_[0]->exit(0);
774 }
775 }
776  
777 0 $_[0]->{_exit_} = 1;
778 0 $_[0]->exit(0);
779 }
780  
781 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
782  
783 102 1;
784  
785 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
786  
787 __END__
« blib/lib/ASNMTAP/Asnmtap/Applications.pm ↑ Summary plugins/templates/check_template-mail-xml-fingerprint-xml-monitoring-1.1.pl »