plugins/templates/check_template.pl

filter: Statementstmt 95.4% 21 / 22 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 93.1% 27 / 29 CC 2 SCAR 4.1
CC
2
Cov
92%
BEGIN
2.5
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« plugins/nagios/templates/check_template-nagios.pl ↑ Summary plugins/templates/check_template-WebTransact-Perfdata.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.pl
6 # ----------------------------------------------------------------------------------------------------------
7  
8 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶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 6 6
15  
16 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
17  
18 6 ▶use ASNMTAP::Asnmtap::Plugins v3.002.003;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 6 ▶use ASNMTAP::Asnmtap::Plugins qw(:PLUGINS);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22  
23 6 my $objectPlugins = ASNMTAP::Asnmtap::Plugins->new (
24 _programName => 'check_template.pl',
25 _programDescription => "General plugin template for the '$APPLICATION'",
26 _programVersion => '3.002.003',
27 _programUsagePrefix => '-w|--warning <warning> -c|--critical <critical>',
28 _programHelpPrefix => '-w, --warning=<WARNING>
29 warning threshold with more than one type of threshold
30 -c, --critical=<CRITICAL>
31 critical threshold with more than one type of threshold',
32 _programGetOptions => ['host|H=s', 'warning|w=s', 'critical|c=s', 'timeout|t:i', 'trendline|T:i'],
33 _timeout => 30,
34 _debug => 0);
35  
36 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37 # Start plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
38 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39  
40 1 my $host = $objectPlugins->getOptionsArgv ('host');
41  
42 1 my $warning = $objectPlugins->getOptionsArgv ('warning');
43 1 my $critical = $objectPlugins->getOptionsArgv ('critical');
44  
45 1 $objectPlugins->pluginValue ( stateValue => $ERRORS{CRITICAL} );
46 1 $objectPlugins->pluginValue ( alert => '.1.' );
47  
48 1 $objectPlugins->pluginValues ( { stateValue => $ERRORS{WARNING}, alert => '.2.', error => '.3.' }, $TYPE{APPEND} );
49  
50 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
51 # End plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
52 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
53  
54 1 $objectPlugins->exit (7);
55  
56 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
57  
58 __END__
« plugins/nagios/templates/check_template-nagios.pl ↑ Summary plugins/templates/check_template-WebTransact-Perfdata.pl »