plugins/templates/check_dummy.pl

filter: Statementstmt 95.2% 20 / 21 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 90.6% 29 / 32 CC 2 SCAR 4.1
CC
2
Cov
89%
BEGIN
2.5
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« plugins/nagios/templates/check_template-ftp.pl ↑ Summary plugins/nagios/templates/check_template-nagios.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_dummy.pl
6 # ----------------------------------------------------------------------------------------------------------
7  
8 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 ▶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
BranchTrueFalseTotal
if ($ENV{"ASNMTAP_PERL5LIB"}) 0 7 7
15  
16 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
17  
18 7 ▶use ASNMTAP::Asnmtap::Plugins v3.002.003;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 7 ▶use ASNMTAP::Asnmtap::Plugins qw(:PLUGINS);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22  
23 7 my $objectPlugins = ASNMTAP::Asnmtap::Plugins->new (
24 _programName => 'check_dummy.pl',
25 _programDescription => "Dummy plugin for testing the '$APPLICATION'",
26 _programVersion => '3.002.003',
27 _programUsagePrefix => '-r|--returnCode <VALUE>',
28 _programHelpPrefix => '-r, --returnCode=<VALUE>
29 VALUE = 0-3
30 0) OK
31 1) WARNING
32 2) CRITICAL
33 3) UNKNOWN',
34 _programGetOptions => ['environment|e:s', 'returnCode|r=f', 'timeout|t:i', 'trendline|T:i'],
35 _timeout => 30,
36 _debug => 0);
37  
38 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39 # Start plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
40 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
41  
42 5 my $returnCode = $objectPlugins->getOptionsArgv ('returnCode');
43 5 ▶$objectPlugins->printUsage ('Missing command line argument returnCode') unless ( defined $returnCode );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $returnCode 0 5 5
44 5 ▶$objectPlugins->printUsage ('Invalid returnCode: '. $returnCode) unless ( $returnCode =~ /^([0-3]+)$/ );
Branch: 1 branch
BranchTrueFalseTotal
unless $returnCode =~ /^([0-3]+)$/ 1 4 5
45 4 $objectPlugins->pluginValues ( { stateValue => $returnCode, alert => '+DUMMY-T'. $returnCode .'+' }, $TYPE{APPEND} );
46  
47 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
48 # End plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
49 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
50  
51 4 sleep $returnCode;
52 4 $objectPlugins->exit (7);
53  
54 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
55  
56 __END__
« plugins/nagios/templates/check_template-ftp.pl ↑ Summary plugins/nagios/templates/check_template-nagios.pl »