NagiosEnterprises / nrpe

NRPE Agent
GNU General Public License v2.0
263 stars 134 forks source link

Environment variables not inherited #222

Closed hariwe closed 4 years ago

hariwe commented 4 years ago

Affects Version 4.0.0:

When running nrpe in daemon mode, started via systemd, Environment Variables are not inherited to the check commands. The systemd service file for nrpe has the option EnvironmentFile= specified. Checking "/proc/pidofnrpe/environ", the Environment Variables specified in the EnvironmentFile are correctly set, so systemd is doing his part and nrpe has them available. However processes spawned by nrpe do no inherit these Environment Variables.

This was working fine with nrpe Version 2.12 using xinetd and the xinetd option "env ="

hariwe commented 4 years ago

I just found in the sourcecode the config value "keep_env_vars". Setting this in the config with the desired env_var is working fine.

I think this should be documented?

sawolf commented 4 years ago

Hi @hariwe,

Thanks for catching this. It looks like the relevant code for that was added around NRPE 3.0, but I haven't found documentation for it anywhere. I'll try to fix that soon.