I have a server that hosts multiple .NET web apps and we have collectors specific to our customers so the .NET agents associated with those apps are configured to connect to the appropriate collector. I used the powershell scripts to automate the agent instrumentation and I noticed a larger number of connected agents to the last collector used by the script. In the agent configuration tool on the server the collector info defined per agent is correct. There is a DT_SERVER variable that the powershell script sets that is overriding the defined collector info in the agent. Shouldn't the opposite be occurring? We logically split our collector traffic by customer for isolation purposes. I plan to modify the powershell script so that it does not set this variable any more to get around this issue.
Per the documentation:
Environment variables are global, so setting one may affect other Agents. Please also mind different orders of precedence if you happen to have both, the option and the environment variable set. For example, the environment variable for .NET precedes over the argument / parameter / option.
Given my particular need I will comment out the line in InstallDotNetAgent.pms1 that sets the ENV VAR since my wrapper scripts always specify collector server:port when calling into The Dynatrace scripts.
Can you check if the DT_Server variable in the script is setting the environment variables or if it is setting the registry keys in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\dynaTrace\Agent\Whitelist or HKEY_LOCAL_MACHINE\SOFTWARE\dynaTrace\Agent\Whitelist. The environment variables will override the .NET Configuration tool (which adds the registry keys), which sounds like the issue you're describing. For more information, check out: https://community.dynatrace.com/community/display/...
Also, keep in mind that collectors that are grouped will auto-load balance the agents upon agent start up, therefore, if you want to isolate agents from collectors, do not group those collectors together.
Hope this helps!