[Nagios-devel] Patch for checks.c - embedded Perl plugins do not

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Patch for checks.c - embedded Perl plugins do not

Post by Guest »

Hi,

i wondered, why a plugin (which ran error-free through mini_epn) produced
ePN-errors. What i found out is, environment variables which are made from
custom macros are not visible by the embedded perl interpreter as they would
be if the plugin was started as a separate process.
I added a patch which adds set_all_macro_environment_vars(TRUE/FALSE); to
the code after use_epn=TRUE, but i'm not sure wether i put the function
calls to the right places. (At least at my test installation it's working)
Can you have a look at it?

Gerhard

--- nagios-3.0.6/base/checks.c 2008-11-30 18:22:58.000000000 +0100
+++ nagios-3.0.6-epn-and-custom-macros/base/checks.c 2008-12-19
19:27:05.000000000 +0100
@@ -539,6 +539,9 @@
else
args[3]=processed_command+strlen(fname)+1;

+ /* set environment variables */
+ set_all_macro_environment_vars(TRUE);
+
ENTER;
SAVETMPS;
PUSHMARK(SP);
@@ -607,6 +610,9 @@
/* free check result memory */
free_check_result(&check_result_info);

+ /* unset environment variables */
+ set_all_macro_environment_vars(FALSE);
+
return;
}
else{
@@ -615,6 +621,9 @@

log_debug_info(DEBUGL_CHECKS,1,"Embedded Perl successfully
compiled %s and returned code ref to plugin handler\n",fname);

+ /* unset environment variables */
+ set_all_macro_environment_vars(FALSE);
+
PUTBACK ;
FREETMPS ;
LEAVE ;







This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked