# Environments for all check commands

**URL:** <https://community.icinga.com/t/environments-for-all-check-commands/9092>\
**Category:** Icinga 2\
**Created:** [January 27, 2022, 11:50am UTC](https://community.icinga.com/t/environments-for-all-check-commands/9092 "2022-01-27T11:50:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lx183](https://community.icinga.com/user_avatar/community.icinga.com/lx183/32/2125_2.png) [@lx183](https://community.icinga.com/u/lx183)\
**Post date:** [January 27, 2022, 11:50am UTC](https://community.icinga.com/t/environments-for-all-check-commands/9092/1 "2022-01-27T11:50:09Z")

</div>

Hi,

I’d like to set an environment variable (LANG=“en\_US.UTF-8”) for all check commands in order to handle non ascii characters within with python2 checks.

There is the import “plugin-check-command” statement in all of my custom commands, so I would except it makes sense to put it in there. Unfortunately I cannot find the configuration for plugin-check-command.

Is there a recommended may to set environment variables for all commands?

System Information

icinga2 --version  
icinga2 - The Icinga 2 network monitoring daemon (version: 2.13.2-1)

Copyright (c) 2012-2022 Icinga GmbH ([https://icinga.com/](https://icinga.com/))  
License GPLv2+: GNU GPL version 2 or later [https://gnu.org/licenses/gpl2.html](https://gnu.org/licenses/gpl2.html)  
This is free software: you are free to change and redistribute it.  
There is NO WARRANTY, to the extent permitted by law.

System information:  
Platform: Red Hat Enterprise Linux Server  
Platform version: 7.9 (Maipo)  
Kernel: Linux  
Kernel version: 3.10.0-1160.53.1.el7.x86\_64  
Architecture: x86\_64

Build information:  
Compiler: GNU 4.8.5  
Build host: runner-hh8q3bz2-project-322-concurrent-0  
OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017

Application information:

General paths:  
Config directory: /etc/icinga2  
Data directory: /var/lib/icinga2  
Log directory: /var/log/icinga2  
Cache directory: /var/cache/icinga2  
Spool directory: /var/spool/icinga2  
Run directory: /run/icinga2

Old paths (deprecated):  
Installation root: /usr  
Sysconf directory: /etc  
Run directory (base): /run  
Local state directory: /var

Internal paths:  
Package data directory: /usr/share/icinga2  
State path: /var/lib/icinga2/icinga2.state  
Modified attributes path: /var/lib/icinga2/modified-attributes.conf  
Objects path: /var/cache/icinga2/icinga2.debug  
Vars path: /var/cache/icinga2/icinga2.vars  
PID path: /run/icinga2/icinga2.pid

icinga2 feature list  
Disabled features: compatlog debuglog elasticsearch gelf icingadb influxdb influxdb2 livestatus opentsdb perfdata statusdata syslog  
Enabled features: api checker command graphite ido-pgsql mainlog notificatio

Icinga is running as standalone server (no satellites, no agents)

 ![image](https://community.icinga.com/uploads/default/original/2X/7/794c853a94a8084ea0a68f89d68c1af3d734153a.png)

---

<div class="post-metadata">

**Author:** ![Al2Klimov](https://community.icinga.com/user_avatar/community.icinga.com/al2klimov/32/959_2.png) [@Al2Klimov](https://community.icinga.com/u/Al2Klimov)\
**Post date:** [January 27, 2022, 5:28pm UTC](https://community.icinga.com/t/environments-for-all-check-commands/9092/2 "2022-01-27T17:28:37Z")

</div>

```auto
template CheckCommand default {
  env.LANG = "en_US.UTF-8"
}

```

---

<div class="post-metadata">

**Author:** ![lx183](https://community.icinga.com/user_avatar/community.icinga.com/lx183/32/2125_2.png) [@lx183](https://community.icinga.com/u/lx183)\
**Post date:** [February 8, 2022, 2:33pm UTC](https://community.icinga.com/t/environments-for-all-check-commands/9092/3 "2022-02-08T14:33:23Z")

</div>

> [@Al2Klimov](#):
>
> `default `

Hi,

thank you. It works.

For my specific use case I had to use:

template CheckCommand “utf8\_python” default {  
env.PYTHONIOENCODING = “UTF-8”  
}
