sni / mod_gearman

Distribute Naemon Host/Service Checks & Eventhandler with Gearman Queues. Host/Servicegroups affinity included.
http://www.mod-gearman.org
GNU General Public License v3.0
122 stars 42 forks source link

mod_gearman_p1.pl should set NAGIOS_PLUGIN env #25

Closed sebastien-prudhomme closed 12 years ago

sebastien-prudhomme commented 12 years ago

Hi,

Perl Nagios::Plugin module use NAGIOS_PLUGIN environment variable to display plugin name in the plugin output.

For instance check_esx3.pl result:

CHECK_ESX3.PL OK - cpu usage=2.37 %

Unfortunately mod_gearman_p1.pl doesn't set that environment variable and output is like that :

MOD_GEARMAN_P1.PL OK - cpu usage=1.70 %

I've check original Nagios perl compiler "p1.pl" and found this code:

sub hndlr {
        \@ARGV = \@_ ;
        local \$^W = 1 ;
        \$ENV{NAGIOS_PLUGIN} = '$filename' ;

                                                                # <<< START of PLUGIN (first line of plugin is line 8 in the text) >>>
$sub
                                                                # <<< END of PLUGIN >>>
}

I guess you need to add a line similar to "\$ENV{NAGIOS_PLUGIN} = '$filename' ;" in mod_gearman_p1.pl

Regards

sni commented 12 years ago

Thanks for your report, i just pushed a fix.