diff options
author | Gavin Carr <gonzai@users.sourceforge.net> | 2006-09-26 04:10:37 +0000 |
---|---|---|
committer | Gavin Carr <gonzai@users.sourceforge.net> | 2006-09-26 04:10:37 +0000 |
commit | 3a58d586f935a35390196bbbb65b36d5c651fe93 (patch) | |
tree | 4ed74dec16c5e8d4a223f5aa80bb4e7a55f016d2 /lib/Nagios/Plugin | |
parent | e548a22a92b3aa345f4a952fddb39cc693c35a70 (diff) | |
download | monitoring-plugin-perl-3a58d586f935a35390196bbbb65b36d5c651fe93.tar.gz |
Update Nagios::Plugin with NP::Function wrapper methods, and extras.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1483 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/Nagios/Plugin')
-rw-r--r-- | lib/Nagios/Plugin/Functions.pm | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Nagios/Plugin/Functions.pm b/lib/Nagios/Plugin/Functions.pm index 9c20288..e77bc4f 100644 --- a/lib/Nagios/Plugin/Functions.pm +++ b/lib/Nagios/Plugin/Functions.pm | |||
@@ -14,7 +14,7 @@ our @STATUS_CODES = qw(OK WARNING CRITICAL UNKNOWN DEPENDENT); | |||
14 | require Exporter; | 14 | require Exporter; |
15 | our @ISA = qw(Exporter); | 15 | our @ISA = qw(Exporter); |
16 | our @EXPORT = (@STATUS_CODES, qw(nagios_exit nagios_die check_messages)); | 16 | our @EXPORT = (@STATUS_CODES, qw(nagios_exit nagios_die check_messages)); |
17 | our @EXPORT_OK = qw(%ERRORS %STATUS_TEXT); | 17 | our @EXPORT_OK = qw(%ERRORS %STATUS_TEXT @STATUS_CODES); |
18 | our %EXPORT_TAGS = ( | 18 | our %EXPORT_TAGS = ( |
19 | all => [ @EXPORT, @EXPORT_OK ], | 19 | all => [ @EXPORT, @EXPORT_OK ], |
20 | codes => [ @STATUS_CODES ], | 20 | codes => [ @STATUS_CODES ], |
@@ -28,7 +28,7 @@ use constant UNKNOWN => 3; | |||
28 | use constant DEPENDENT => 4; | 28 | use constant DEPENDENT => 4; |
29 | 29 | ||
30 | our %ERRORS = ( | 30 | our %ERRORS = ( |
31 | 'OK' => OK, | 31 | 'OK' => OK, |
32 | 'WARNING' => WARNING, | 32 | 'WARNING' => WARNING, |
33 | 'CRITICAL' => CRITICAL, | 33 | 'CRITICAL' => CRITICAL, |
34 | 'UNKNOWN' => UNKNOWN, | 34 | 'UNKNOWN' => UNKNOWN, |
@@ -84,7 +84,8 @@ sub nagios_exit { | |||
84 | $output = "$shortname $output" if $shortname; | 84 | $output = "$shortname $output" if $shortname; |
85 | if ($arg->{plugin}) { | 85 | if ($arg->{plugin}) { |
86 | my $plugin = $arg->{plugin}; | 86 | my $plugin = $arg->{plugin}; |
87 | $output .= " | ". $plugin->all_perfoutput if $plugin->perfdata; | 87 | $output .= " | ". $plugin->all_perfoutput |
88 | if $plugin->perfdata && $plugin->all_perfoutput; | ||
88 | } | 89 | } |
89 | $output .= "\n"; | 90 | $output .= "\n"; |
90 | 91 | ||
@@ -193,7 +194,7 @@ Nagios plugins. | |||
193 | # Constants OK, WARNING, CRITICAL, and UNKNOWN exported by default | 194 | # Constants OK, WARNING, CRITICAL, and UNKNOWN exported by default |
194 | use Nagios::Plugin::Functions; | 195 | use Nagios::Plugin::Functions; |
195 | 196 | ||
196 | # nagios_exit( ODE, $message ) - exit with error code CODE, | 197 | # nagios_exit( CODE, $message ) - exit with error code CODE, |
197 | # and message "PLUGIN CODE - $message" | 198 | # and message "PLUGIN CODE - $message" |
198 | nagios_exit( CRITICAL, $critical_error ) if $critical_error; | 199 | nagios_exit( CRITICAL, $critical_error ) if $critical_error; |
199 | nagios_exit( WARNING, $warning_error ) if $warning_error; | 200 | nagios_exit( WARNING, $warning_error ) if $warning_error; |
@@ -223,7 +224,7 @@ Nagios::Plugin. It is intended for those who prefer a simpler | |||
223 | functional interface, and who do not need the additional | 224 | functional interface, and who do not need the additional |
224 | functionality of Nagios::Plugin. | 225 | functionality of Nagios::Plugin. |
225 | 226 | ||
226 | =head2 Exports | 227 | =head2 EXPORTS |
227 | 228 | ||
228 | Nagios status code constants are exported by default: | 229 | Nagios status code constants are exported by default: |
229 | 230 | ||
@@ -245,13 +246,13 @@ The following variables are exported only on request: | |||
245 | %STATUS_TEXT | 246 | %STATUS_TEXT |
246 | 247 | ||
247 | 248 | ||
248 | =head2 Functions | 249 | =head2 FUNCTIONS |
249 | 250 | ||
250 | The following functions are supported: | 251 | The following functions are supported: |
251 | 252 | ||
252 | =over 4 | 253 | =over 4 |
253 | 254 | ||
254 | =item nagios_exit( CODE, $message ) | 255 | =item nagios_exit( <CODE>, $message ) |
255 | 256 | ||
256 | Exit with return code CODE, and a standard nagios message of the | 257 | Exit with return code CODE, and a standard nagios message of the |
257 | form "PLUGIN CODE - $message". | 258 | form "PLUGIN CODE - $message". |