« plugins/templates/check_template-mail-xml-fingerprint-xml-monitoring.pl
↑ Summary
plugins/templates/check_template-mail-xml.pl »
| 1 | #!/usr/bin/env perl | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ---------------------------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # © Copyright 2003-2011 by Alex Peeters [alex.peeters@citap.be] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # ---------------------------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # 2011/mm/dd, v3.002.003, check_template-mail-xml-fingerprint-xml.pl | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # ---------------------------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use warnings; # Must be used in test mode only. This reduces a little process speed | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | #use diagnostics; # Must be used in test mode only. This reduces a lot of process speed | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | BEGIN { if ( $ENV{ASNMTAP_PERL5LIB} ) { eval 'use lib ( "$ENV{ASNMTAP_PERL5LIB}" )'; } } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=9.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use ASNMTAP::Asnmtap::Plugins v3.002.003; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use ASNMTAP::Asnmtap::Plugins qw(:PLUGINS %STATE); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | my $objectPlugins = ASNMTAP::Asnmtap::Plugins->new ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | _programName => 'check_template-mail-xml-fingerprint-xml.pl', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | _programDescription => "XML fingerprint Mail XML plugin template for testing the '$APPLICATION'", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | _programVersion => '3.002.003', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | _programGetOptions => ['username|u|loginname=s', 'password|p|passwd=s', 'interval|i=i', 'environment|e=s', 'timeout|t:i', 'trendline|T:i'], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | _timeout => 30, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | _debug => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $username = $objectPlugins->getOptionsArgv ('username'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $password = $objectPlugins->getOptionsArgv ('password'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $interval = $objectPlugins->getOptionsArgv ('interval'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my $environment = $objectPlugins->getOptionsArgv ('environment'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my $environmentText = $objectPlugins->getOptionsValue ('environment'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | ▶ | use ASNMTAP::Asnmtap::Plugins::Mail v3.002.003; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my %environment = ( P => 'PROD', A => 'ACC' , S => 'SIM', T => 'TEST', D => 'DEV', L => 'LOCAL' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | my $body = " | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | <?xml version=\"1.0\" encoding=\"UTF-8\"?> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | <BaseServiceReport> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | <Ressource> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | <Server>Production-Server</Server> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | <Name>Name Service to Report</Name> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | <Date>yyyy/mm/dd</Date> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | <Time>hh:mm:ss</Time> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | <Environment>". $environment{$environment} ."</Environment> | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | <ErrorStack><![CDATA[ErrorStack .1.]]></ErrorStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | <ErrorDetail><![CDATA[ErrorDetail .1.]]></ErrorDetail> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | </Ressource> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | </BaseServiceReport> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | "; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $objectMAIL = ASNMTAP::Asnmtap::Plugins::Mail->new ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | _asnmtapInherited => \$objectPlugins, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | _SMTP => { smtp => [ qw(smtp.citap.be) ], mime => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | _POP3 => { pop3 => 'pop3.citap.be', username => $username, password => $password }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | _mailType => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | _text => { SUBJECT => 'uKey=MAIL_'. $environment .'_0004' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | _mail => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | from => 'alex.peeters@citap.com', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | to => 'asnmtap@citap.com', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | status => $APPLICATION .' Status UP', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | body => $body | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my ($returnCode, $numberOfMatches, $debugfileMessage, @xml); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # Start plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # Receiving Fingerprint Mails - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 2 | ▶ | use constant HEADER => '<?xml version="1.0" encoding="UTF-8"?>'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | ▶ | use constant FOOTER => '</BaseServiceReport>'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $debugfileMessage = "\n<HTML><HEAD><TITLE>Mail XML plugin template \@ $APPLICATION</TITLE></HEAD><BODY><HR><H1 style=\"margin: 0px 0px 5px; font: 125% verdana,arial,helvetica\">Mail XML plugin template @ $APPLICATION</H1><HR>\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $debugfileMessage .= "<TABLE WIDTH=\"100%\"><TR style=\"font: normal 68% bold verdana,arial,helvetica; text-align:left; background:#a6caf0;\"><TH>Server</TH><TH>Name</TH><TH>Environment</TH><TH>First Occurence Date</TH><TH>First Occurence Time</TH><TH>Errors</TH></TR>\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $debugfileMessage .= "<H3 style=\"margin-bottom: 0.5em; font: bold 90% verdana,arial,helvetica\">$environmentText</H3>"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ($returnCode, $numberOfMatches) = $objectMAIL->receiving_fingerprint_mails( custom => \&actionOnMailBody, customArguments => \{ xml => \@xml, header => HEADER, footer => FOOTER, validateDTD => 0, filenameDTD => '' }, receivedState => 0, outOfDate => $interval, perfdataLabel => 'email(s) received' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if ( defined $numberOfMatches and $numberOfMatches ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $numberOfMatches and $numberOfMatches
MC/DC0%0/2
defined $numberOfMatches and $numberOfMatches
defined $numberOfMatches
$numberOfMatches
Truth table0%0/3
A and B
A= defined $numberOfMatchesB= $numberOfMatches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my $debug = $objectPlugins->getOptionsValue ('debug'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my $fixedAlert = "+"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | foreach my $xml (@xml) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | $debugfileMessage .= "<TR style=\"background:#eeeee0; font: normal 68% bold verdana,arial,helvetica; color:purple;\"><TD>$xml->{Ressource}->{Server}</TD><TD>$xml->{Ressource}->{Name}</TD><TD>$xml->{Ressource}->{Environment}</TD><TD>$xml->{Ressource}->{Date}</TD><TD>$xml->{Ressource}->{Time}</TD><TD>$xml->{Ressource}->{Errors}</TD></TR>\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $debugfileMessage .= "<TR style=\"background:#eeeee0; font: normal 68% bold verdana,arial,helvetica; color:red;\"><TD valign=\"top\">Error Stack</TD><TD colspan=\"6\">$xml->{Ressource}->{ErrorStack}</TD></TR>\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | $debugfileMessage .= "<TR style=\"background:#eeeee0; font: normal 68% bold verdana,arial,helvetica; color:red;\"><TD valign=\"top\">Error Detail</TD><TD colspan=\"6\">$xml->{Ressource}->{ErrorDetail}</TD></TR>\n" if ( $debug >= 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $fixedAlert .= "$xml->{Ressource}->{Server}-$xml->{Ressource}->{Name}+"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $objectPlugins->pluginValues ( { alert => $fixedAlert }, $TYPE{COMMA_APPEND} ) if ($fixedAlert ne "+"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $debugfileMessage .= "\n</TABLE><P style=\"font: normal 68% verdana,arial,helvetica;\" ALIGN=\"left\">Generated on: ". scalar(localtime()) ."</P>\n</BODY>\n</HTML>"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $objectPlugins->write_debugfile ( \$debugfileMessage, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # Sending Fingerprint Mail - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $returnCode = $objectMAIL->sending_fingerprint_mail( perfdataLabel => 'email send' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # End plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $objectPlugins->exit (7); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # Function needed by receiving_fingerprint_mail ! - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub actionOnMailBody { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
actionOnMailBody: not called CC=24 SCAR=62.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my ($self, $asnmtapInherited, $pop3, $msgnum, $arguments) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my $debug = $$asnmtapInherited->getOptionsValue ('debug'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | unless ( defined $arguments and ref $arguments eq 'REF' and ref $$arguments eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $arguments and ref $arguments eq "REF" and ref $$arguments eq "HASH"
defined $arguments and ref $arguments eq "REF"
MC/DC0%0/3
defined $arguments and ref $arguments eq "REF" and ref $$arguments eq "HASH"
defined $arguments
ref $arguments eq "REF"
ref $$arguments eq "HASH"
Truth table0%0/4
A and B and C
A= defined $argumentsB= ref $arguments eq "REF"C= ref $$arguments eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'actionOnMailBody: arguments need to be an REF HASH!!!' }, $TYPE{APPEND} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | return ( $ERRORS{UNKNOWN} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 2 | ▶ | no warnings 'deprecated'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | if ( $debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | print "\n\nactionOnMailBody:\n". $self->{defaultArguments}->{result} ."\n\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | while (my ($key, $value) = each %{ $$arguments } ) { print "actionOnMailBody: $key => $value\n"; } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 2 | ▶ | use ASNMTAP::Asnmtap::Plugins::XML qw(&extract_XML); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | my ($returnCode, $xml) = extract_XML ( asnmtapInherited => $asnmtapInherited, resultXML => $self->{defaultArguments}->{result}, headerXML => ${$$arguments}{header}, footerXML => ${$$arguments}{footer}, validateDTD => ${$$arguments}{validateDTD}, filenameDTD => ${$$arguments}{filenameDTD} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | unless ( $returnCode ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if ( $debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | print "<->\n", $xml->{Ressource}->{Server}, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | print "<->\n", $xml->{Ressource}->{Name}, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | print "<->\n", $xml->{Ressource}->{Date}, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | print "<->\n", $xml->{Ressource}->{Time}, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | print "<->\n", $xml->{Ressource}->{Environment}, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $tXml = ${$$arguments}{xml}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $environment = $$asnmtapInherited->getOptionsArgv('environment'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my %environment = ( P => 'PROD', A => 'ACC' , S => 'SIM', T => 'TEST', D => 'DEV', L => 'LOCAL' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | if ( $xml->{Ressource}->{Environment} =~ /^$environment{$environment}$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my $push = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | foreach my $tmpXML (@{$tXml}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | $push = ($tmpXML->{Ressource}->{Server} eq $xml->{Ressource}->{Server}) && | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | ($tmpXML->{Ressource}->{Name} eq $xml->{Ressource}->{Name}) && | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | ($tmpXML->{Ressource}->{Environment} eq $xml->{Ressource}->{Environment}) && | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | ($tmpXML->{Ressource}->{ErrorStack} eq $xml->{Ressource}->{ErrorStack}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/9
$tmpXML->{'Ressource'}{'Server'} eq $xml->{'Ressource'}{'Server'} && $tmpXML->{'Ressource'}{'Name'} eq $xml->{'Ressource'}{'Name'} && $tmpXML->{'Ressource'}{'Environment'} eq $xml->{'Ressource'}{'Environment'} && $tmpXML->{'Ressource'}{'ErrorStack'} eq $xml->{'Ressource'}{'ErrorStack'}
$tmpXML->{"Ressource"}{"Server"} eq $xml->{"Ressource"}{"Server"} and $tmpXML->{"Ressource"}{"Name"} eq $xml->{"Ressource"}{"Name"} and $tmpXML->{"Ressource"}{"Environment"} eq $xml->{"Ressource"}{"Environment"}
$tmpXML->{"Ressource"}{"Server"} eq $xml->{"Ressource"}{"Server"} and $tmpXML->{"Ressource"}{"Name"} eq $xml->{"Ressource"}{"Name"}
MC/DC0%0/4
$tmpXML->{'Ressource'}{'Server'} eq $xml->{'Ressource'}{'Server'} && $tmpXML->{'Ressource'}{'Name'} eq $xml->{'Ressource'}{'Name'} && $tmpXML->{'Ressource'}{'Environment'} eq $xml->{'Ressource'}{'Environment'} && $tmpXML->{'Ressource'}{'ErrorStack'} eq $xml->{'Ressource'}{'ErrorStack'}
$tmpXML->{"Ressource"}{"Server"} eq $xml->{"Ressource"}{"Server"}
$tmpXML->{"Ressource"}{"Name"} eq $xml->{"Ressource"}{"Name"}
$tmpXML->{"Ressource"}{"Environment"} eq $xml->{"Ressource"}{"Environment"}
$tmpXML->{'Ressource'}{'ErrorStack'} eq $xml->{'Ressource'}{'ErrorStack'}
Truth table0%0/5
A and B and C && D
A= $tmpXML->{"Ressource"}{"Server"} eq $xml->{"Ressource"}{"Server"}B= $tmpXML->{"Ressource"}{"Name"} eq $xml->{"Ressource"}{"Name"}C= $tmpXML->{"Ressource"}{"Environment"} eq $xml->{"Ressource"}{"Environment"}D= $tmpXML->{'Ressource'}{'ErrorStack'} eq $xml->{'Ressource'}{'ErrorStack'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if ($push && $debug >= 2) { $push = ($tmpXML->{Ressource}->{ErrorDetail} eq $xml->{Ressource}->{ErrorDetail}); } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$push and $debug >= 2
MC/DC0%0/2
$push and $debug >= 2
$push
$debug >= 2
Truth table0%0/3
A and B
A= $pushB= $debug >= 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if ($push) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $tmpXML->{Ressource}->{Errors}++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | unless ( $push ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $xml->{Ressource}->{Errors} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | push (@{$tXml}, $xml); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | $xml->{Ressource}->{ErrorDetail} = '' if ( $debug != 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | $pop3->Delete( $msgnum ) unless ( $debug or $$asnmtapInherited->getOptionsValue ('onDemand') ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$debug or $$asnmtapInherited->getOptionsValue("onDemand")
MC/DC0%0/2
$debug or $$asnmtapInherited->getOptionsValue("onDemand")
$debug
$$asnmtapInherited->getOptionsValue("onDemand")
Truth table0%0/3
A or B
A= $debugB= $$asnmtapInherited->getOptionsValue("onDemand")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $self->{defaultArguments}->{numberOfMatches}++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if ( $debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | foreach my $xml (@{$tXml}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | print "\n+++(out)+++\n$xml->{Ressource}->{Name}\n$xml->{Ressource}->{Date}\n$xml->{Ressource}->{Time}\n$xml->{Ressource}->{Errors}\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | $pop3->Delete( $msgnum ) unless ( $debug >= 4 and $$asnmtapInherited->getOptionsValue ('onDemand') ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$debug >= 4 and $$asnmtapInherited->getOptionsValue("onDemand")
MC/DC0%0/2
$debug >= 4 and $$asnmtapInherited->getOptionsValue("onDemand")
$debug >= 4
$$asnmtapInherited->getOptionsValue("onDemand")
Truth table0%0/3
A and B
A= $debug >= 4B= $$asnmtapInherited->getOptionsValue("onDemand")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | return ( $returnCode ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||