line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Nagios::Plugin::Functions; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
87295
|
use strict; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
610
|
|
4
|
14
|
|
|
14
|
|
68
|
use warnings; |
|
14
|
|
|
|
|
20
|
|
|
14
|
|
|
|
|
452
|
|
5
|
14
|
|
|
14
|
|
77
|
use base 'Monitoring::Plugin::Functions'; |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
8708
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Remember to update Nagios::Plugins as well |
8
|
|
|
|
|
|
|
our $VERSION = "0.37"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN { |
11
|
14
|
50
|
|
14
|
|
524973
|
warnings::warnif("deprecated", "Nagios::Plugin is deprecated, use Monitoring::Plugin instead.") |
12
|
|
|
|
|
|
|
unless $Monitoring::Plugin::deprecated_warned; |
13
|
14
|
|
|
|
|
1680
|
$Monitoring::Plugin::deprecated_warned = 1; |
14
|
|
|
|
|
|
|
}; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @STATUS_CODES = qw(OK WARNING CRITICAL UNKNOWN DEPENDENT); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#require Exporter; |
19
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
20
|
|
|
|
|
|
|
our @EXPORT = (@STATUS_CODES, qw(nagios_exit nagios_die check_messages)); |
21
|
|
|
|
|
|
|
our @EXPORT_OK = qw(%ERRORS %STATUS_TEXT @STATUS_CODES get_shortname max_state max_state_alt convert $value_re); |
22
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
23
|
|
|
|
|
|
|
all => [ @EXPORT, @EXPORT_OK ], |
24
|
|
|
|
|
|
|
codes => [ @STATUS_CODES ], |
25
|
|
|
|
|
|
|
functions => [ qw(nagios_exit nagios_die check_messages max_state max_state_alt convert) ], |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
14
|
|
|
14
|
|
132
|
use constant OK => 0; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
810
|
|
29
|
14
|
|
|
14
|
|
72
|
use constant WARNING => 1; |
|
14
|
|
|
|
|
24
|
|
|
14
|
|
|
|
|
680
|
|
30
|
14
|
|
|
14
|
|
85
|
use constant CRITICAL => 2; |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
597
|
|
31
|
14
|
|
|
14
|
|
165
|
use constant UNKNOWN => 3; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
635
|
|
32
|
14
|
|
|
14
|
|
64
|
use constant DEPENDENT => 4; |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
6121
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our %ERRORS = ( |
35
|
|
|
|
|
|
|
'OK' => OK, |
36
|
|
|
|
|
|
|
'WARNING' => WARNING, |
37
|
|
|
|
|
|
|
'CRITICAL' => CRITICAL, |
38
|
|
|
|
|
|
|
'UNKNOWN' => UNKNOWN, |
39
|
|
|
|
|
|
|
'DEPENDENT' => DEPENDENT, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
our %STATUS_TEXT = reverse %ERRORS; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $value = qr/[-+]?[\d\.]+/; |
45
|
|
|
|
|
|
|
our $value_re = qr/$value(?:e$value)?/; |
46
|
|
|
|
|
|
|
|
47
|
9
|
|
|
9
|
|
1010
|
sub _fake_exit { return(Monitoring::Plugin::Functions::_fake_exit(@_)); }; |
48
|
10
|
|
|
10
|
|
70283
|
sub _use_die { return(Monitoring::Plugin::Functions::_use_die(@_)); }; |
49
|
37
|
|
|
37
|
0
|
16155
|
sub nagios_exit { return(Monitoring::Plugin::Functions::plugin_exit(@_)); } |
50
|
13
|
|
|
13
|
|
67
|
sub _nagios_exit { return(Monitoring::Plugin::Functions::_plugin_exit(@_)); } |
51
|
55
|
|
|
55
|
0
|
19352
|
sub nagios_die { return(Monitoring::Plugin::Functions::plugin_die(@_)); } |
52
|
1
|
|
|
1
|
0
|
1238
|
sub get_shortname { return(Monitoring::Plugin::Functions::get_shortname(@_)); } |
53
|
0
|
|
|
0
|
0
|
0
|
sub max_state_alt { return(Monitoring::Plugin::Functions::max_state_alt(@_)); } |
54
|
7
|
|
|
7
|
0
|
1736
|
sub max_state { return(Monitoring::Plugin::Functions::max_state(@_)); } |
55
|
23
|
|
|
23
|
0
|
14407
|
sub check_messages { return(Monitoring::Plugin::Functions::check_messages(@_)); } |
56
|
0
|
|
|
0
|
0
|
|
sub convert { return(Monitoring::Plugin::Functions::convert(@_)); } |
57
|
0
|
|
|
0
|
0
|
|
sub die { Monitoring::Plugin::Functions::plugin_die(@_); } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |