cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Environment variable configuration 401 Unauthorized

Anthony.Dahanne
Creator

Hello!

I was able to connect fine to the controller using the provided `agent-info.xml` (after downloading the custom-config AppServerAgent-1.8-24.4.1.35880)

Now, what I'm trying to, is to reproduce the same configuration, but solely based on env. variables; because I'll be deploying my app with a "blank" AppServerAgent-1.8-24.4.1.35880 with no custom config.

Unfortunately, I can't make it work.

When it works fine using the provided `agent-info.xml`, I can see in the logs:

[AD Agent init] 30 May 2024 17:32:07,965  INFO XMLConfigManager - Full certificate chain validation performed using default certificate file
[AD Agent init] 30 May 2024 17:32:18,898 INFO ConfigurationChannel - Auto agent registration attempted: Application Name [anthony-app] Component Name [anthony-tier] Node Name [anthony-node]
[AD Agent init] 30 May 2024 17:32:18,898 INFO ConfigurationChannel - Auto agent registration SUCCEEDED!

When it fails, using env. variables, I'll get

[AD Agent init] 30 May 2024 17:29:22,398  INFO XMLConfigManager - Full certificate chain validation performed using default certificate file
[AD Agent init] 30 May 2024 17:29:22,600 ERROR ConfigurationChannel - HTTP Request failed: HTTP/1.1 401 Unauthorized
[AD Agent init] 30 May 2024 17:29:22,600 INFO ConfigurationChannel - Resetting AuthState for Proxy: [state:UNCHALLENGED;] and Target [state:FAILURE;]
[AD Agent init] 30 May 2024 17:29:22,601 WARN ConfigurationChannel - Could not connect to the controller/invalid response from controller, cannot get initialization information, controller host [xxx.saas.appdynamics.com], port[443], exception [null]
[AD Agent init] 30 May 2024 17:29:22,601 ERROR ConfigurationChannel - Exception: NULL

Although here are all the env. variables I've set:


APPDYNAMICS_CONTROLLER_HOST_NAME=xxx.saas.appdynamics.com
APPDYNAMICS_AGENT_TIER_NAME=anthony-tier
APPDYNAMICS_AGENT_APPLICATION_NAME=anthony-app
APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY=password-copy-pasted-from-config
APPDYNAMICS_AGENT_NODE_NAME=anthony-node
APPDYNAMICS_CONTROLLER_PORT=443
APPDYNAMICS_CONTROLLER_SSL_ENABLED=true

There's one thing that is troubling me in the logs though, is that using env. variables, I always get in the logs such messages:

[AD Agent init] 30 May 2024 17:29:18,333  WARN XMLConfigManager - XML Controller Info Resolver found invalid controller host information [] in controller-info.xml; Please specify a valid value if it is not already set in system properties.
[AD Agent init] 30 May 2024 17:29:18,333 WARN XMLConfigManager - XML Controller Info Resolver found invalid controller port information [] in controller-info.xml; Please specify a valid value if it is not already set in system properties.
[AD Agent init] 30 May 2024 17:29:18,335 WARN XMLConfigManager - XML Controller Info Resolver found invalid controller host information [] in controller-info.xml; Please specify a valid value if it is not already set in system properties.
[AD Agent init] 30 May 2024 17:29:18,335 WARN XMLConfigManager - XML Controller Info Resolver found invalid controller port information [] in controller-info.xml; Please specify a valid value if it is not already set in system properties.
[AD Agent init] 30 May 2024 17:29:18,339 INFO XMLConfigManager - XML Agent Account Info Resolver did not find account name. Using default account name [customer1]
[AD Agent init] 30 May 2024 17:29:18,339 WARN XMLConfigManager - XML Agent Account Info Resolver did not find account access key.
[AD Agent init] 30 May 2024 17:29:18,339 INFO XMLConfigManager - Configuration Channel is using ControllerInfo:: host:[xxx.saas.appdynamics.com] port:[443] sslEnabled:[true] keystoreFile:[DEFAULT:cacerts.jks] use-encrypted-credentials:[false] secureCredentialStoreFileName:[] secureCredentialStorePassword:[] secureCredentialStoreFormat:[] use-ssl-client-auth:[false] asymmetricKeysStoreFilename:[] asymmetricKeysStorePassword:[] asymmetricKeyPassword:[] asymmetricKeyAlias:[] validation:[UNSPECIFIED]

Although all env. variables were properly loaded I believe:


[AD Agent init] 30 May 2024 17:29:18,295 INFO XMLConfigManager - Default Controller Info Resolver found env variable [APPDYNAMICS_CONTROLLER_HOST_NAME] for controller host name [xxx.saas.appdynamics.com]
[AD Agent init] 30 May 2024 17:29:18,295 INFO XMLConfigManager - Default Controller Info Resolver found env variable [APPDYNAMICS_CONTROLLER_PORT] for controller port [443]
[AD Agent init] 30 May 2024 17:29:18,295 INFO XMLConfigManager - Default Controller Info Resolver found env variable [APPDYNAMICS_CONTROLLER_SSL_ENABLED] for controller ssl enabled [true]
[AD Agent init] 30 May 2024 17:29:18,303 INFO XMLConfigManager - Default Agent Account Info Resolver found env variable [APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY] for account access key [****]
[AD Agent init] 30 May 2024 17:29:18,303 INFO XMLConfigManager - Full Agent Registration Info Resolver found env variable [APPDYNAMICS_AGENT_APPLICATION_NAME] for application name [anthony-app]
[AD Agent init] 30 May 2024 17:29:18,303 INFO XMLConfigManager - Full Agent Registration Info Resolver found env variable [APPDYNAMICS_AGENT_TIER_NAME] for tier name [anthony-tier]
[AD Agent init] 30 May 2024 17:29:18,303 INFO XMLConfigManager - Full Agent Registration Info Resolver found env variable [APPDYNAMICS_AGENT_NODE_NAME] for node name [anthony-node]

Anyways...
Is configuration solely provided by env. variable supposed to work?

Thank you!

3 REPLIES 3

Ryan.Paredez
Community Manager

Hi @Anthony.Dahanne,

Thanks for asking your question on the community. Since it's been a few days, have you discovered a solution or anything worth sharing? 


Thanks,

Ryan, Cisco AppDynamics Community Manager




Found something helpful? Click the Accept as Solution button to help others find answers faster.

Liked something? Click the Thumbs Up button.



Check out Observabiity in Action

new deep dive videos weekly in the Knowledge Base.

Well, actually, I think so!

The logs about the XmlConfig not finding configuration are a red herring: they don't mean anything is wrong with env. variables.
Those are the required env. variables that ALL need to be set explicitly to make it work without am xml config file:

APPDYNAMICS_CONTROLLER_HOST_NAME: <key-value>
APPDYNAMICS_CONTROLLER_SSL_ENABLED: "true"
APPDYNAMICS_CONTROLLER_PORT: "443"
APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY: <key-value>
APPDYNAMICS_AGENT_ACCOUNT_NAME: <key-value>
APPDYNAMICS_AGENT_TIER_NAME: <key-value>

APPDYNAMICS_AGENT_NODE_NAME: <key-value>
APPDYNAMICS_AGENT_APPLICATION_NAME: <key-value>

I forgot to add APPDYNAMICS_AGENT_ACCOUNT_NAME and there no messages in the logs pointing me into the right direction.

I would suggest the doc would insist on all of those values being set, or the agent won't connect.

Thanks!

 

Ryan.Paredez
Community Manager

Hi @Anthony.Dahanne,

I'm glad you were able to figure it out. Thanks for coming back and sharing the solution too!


Thanks,

Ryan, Cisco AppDynamics Community Manager




Found something helpful? Click the Accept as Solution button to help others find answers faster.

Liked something? Click the Thumbs Up button.



Check out Observabiity in Action

new deep dive videos weekly in the Knowledge Base.