Agent Environment Variables (not to be confused with AnthillPro Environment Properties) are set at the time of agent installation, and are stored on the central server. The agent-installation reads the environment variables of the machine the agent is being installed on and then sets the variables. Once set, AnthillPro does not check for changes in the machine's environment variables. However, you can configure the agent to dynamically set the environment variables every time the agent restarts.
When dynamically setting the variables, the agent needs two files in
the /bin
directory: one named env.properties
and
one named either setenv.bat
(for Windows) or
setenv.sh
(for UNIX-like systems). The setenv
shell script is responsible for dynamically generating the environment
variables in a format that AnthillPro can use, as well as writing out the
env.properties
file. The env.properties
file
includes all the variables in a pattern similar to
DYNAMIC_ENV_VAR=value
.
When the agent is restarted, it will first look for the
setenv
script. If the script is found, it will be executed to
update (or write out) the env.properties
file. Then, the new
variables in the env.properties
file will be delivered to the
AnthillPro server.
Access the agent's /bin
directory.
Ability to write a shell script that can generate the environment variables in the proper format.
Stop the agent.
Create setenv
file. In a text editor, create the setenv.bat
file if the agent is running on Windows or setenv.sh
file
if the agent is running on a UNIX-like system. Save it to the agent's
/bin
directory.
You will need to have the shell script read the environment
variables and then writes them out to the env.properties
file. The script should be similar to the example below:
echo DYNAMIC_ENV_VAR=value >
env.properites
Note that the env.properties
cannot reference other
environment variables such as PATH=%PATH%;...
,
etc.
AnthillPro requires the variables to be set using this exact pattern.
Restart the agent. Upon restart, the variables will be updated. To update the environment variables in the future, simply restart the agent again.