How get environment variables with getenv


I would like to store variable in environment variable and use it in vars.dummy_text in my Service. The problem is, that getenv function don’t work properly in .conf files. It can’t get as simple env var as HOME, USER etc… The only environment variable, that i could get with getenv is PATH.

interesting thing is that going into icinga2 console its all ok, getenv prints any env variable from linux printenv command

in .conf files don’t work:

vars.dummy_text = {{ getenv("USER") }}
vars.dummy_text = {{ getenv("HOME") }}

I just get empty string / no output in Web

vars.dummy_text = {{ getenv("PATH") }}

is there a difference between getenv from icinga2 console and conf files?
is there a way to print all variables that getenv can get?
where icinga looks for env variables in icinga2 console and conf files?

I am using icinga2 (version: r2.13.2-1)


just bump. anyone can confirm it?

Yes. Maybe it’s worth to file an issue at github.

right, I’ll create an issue then