[Nagiosplug-checkins] Nagios-Plugin/lib/Nagios/Plugin Functions.pm, 1.7, 1.8

Gavin Carr gonzai at users.sourceforge.net
Sat Nov 11 06:18:48 CET 2006


Update of /cvsroot/nagiosplug/Nagios-Plugin/lib/Nagios/Plugin
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv29809/lib/Nagios/Plugin

Modified Files:
	Functions.pm 
Log Message:
Add get_shortname to NP::Functions export_ok list; update perldocs.

Index: Functions.pm
===================================================================
RCS file: /cvsroot/nagiosplug/Nagios-Plugin/lib/Nagios/Plugin/Functions.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Functions.pm	10 Nov 2006 01:26:16 -0000	1.7
+++ Functions.pm	11 Nov 2006 05:18:45 -0000	1.8
@@ -18,7 +18,7 @@
 require Exporter;
 our @ISA = qw(Exporter);
 our @EXPORT = (@STATUS_CODES, qw(nagios_exit nagios_die check_messages));
-our @EXPORT_OK = qw(%ERRORS %STATUS_TEXT @STATUS_CODES);
+our @EXPORT_OK = qw(%ERRORS %STATUS_TEXT @STATUS_CODES get_shortname);
 our %EXPORT_TAGS = (
     all => [ @EXPORT, @EXPORT_OK ],
     codes => [ @STATUS_CODES ],
@@ -224,6 +224,10 @@
       critical => \@crit, warning => \@warn,
       ok => \@ok );
 
+    # get_shortname - return the default short name for this plugin
+    #   (as used by nagios_exit/die; not exported by default)
+    $shortname = get_shortname();
+
 
 =head1 DESCRIPTION
 
@@ -250,10 +254,11 @@
     nagios_die
     check_messages
 
-The following variables are exported only on request:
+The following variables and functions are exported only on request:
 
     %ERRORS
     %STATUS_TEXT
+    get_shortname
 
 
 =head2 FUNCTIONS
@@ -330,6 +335,18 @@
 
 =back
 
+=item get_shortname
+
+Return the default shortname used for this plugin i.e. the first
+token reported by nagios_exit/nagios_die. The default is basically
+
+    uc basename( $ENV{NAGIOS_PLUGIN} || $0 )
+
+with any leading 'CHECK_' and trailing file suffixes removed.
+
+get_shortname is not exported by default, so must be explicitly
+imported.
+
 =back
 
 





More information about the Commits mailing list