Knowledge Base

cancel
Showing results for 
Search instead for 
Did you mean: 

HttpClient used in Extensions

Table of Contents

Scope

Goal

Usage

Configuration

 

Scope

This document explains the HttpClient used by the extensions commons library, part of the Java SDK for AppDynamics Extensions.

 

Goal

Most of the extensions collect metrics from an HTTP(s) endpoint. Instead of creating a HttpClient in every extension, we have created an HttpClient in the commons library that can be used in all the extensions.

 

Usage

CloseableHttpClient httpClient = configuration.getContext().getHttpClient() where configuration is an object of the MonitorContextConfiguration class.

 

Configuration

To use HttpClient in any extension, the following configuration needs to be provided in the config.yml file:

 

Server Configuration

The two servers configured below are valid and Config1 is preferred over Config2.

 

Config1

servers:
 - uri: ""
   username: ""
   password: ""
   encryptedPassword: ""

 

Config2

servers:
 - host: "" # Avoid this, use uri instead
   port: "" # Avoid this, use uri instead
   useSsl: false # Avoid this, use uri instead.
   username: ""
   password: ""
   encryptedPassword: ""

 

Configuring multiple servers in a single config.yml is also supported.

servers:
  - uri: ""
    username: ""
    password: ""
    encryptedPassword: ""
 
    # Uri is preferred instead of host-port-useSsl combo.
  - host: "" # Avoid this, use uri instead
    port: "" # Avoid this, use uri instead
    useSsl: false # Avoid this, use uri instead.
    username: ""
    password: ""
    encryptedPassword: ""

 

A username and password can also be provided or you can provide the encrypted password and leave the password field empty. Note that you can add an encrypted password for each server, but the encryptionKey will be the same for all the servers as defined in the config.yml file.

 

If you provide values for both the password and encryptedPassword, the extension will give precedence to the value provided in the password field and the encryptedPassword will be disregarded.

 

If you would like to use HTTPS, specify protocol as https in Config1 or change the value of useSsl to true in Config2.

 

Connection Configuration

This section is optional, but enables you to have more choices when trying to establish a new connection with a server. This section, just like the encryptionKey, is universal for all the servers listed in the config.yml file.

connection:
  socketTimeout: 3000
  connectTimeout: 1000
  sslProtocols: ["TLSV1.2"]
  sslCertCheckEnabled: true
  sslVerifyHostname: true
 
  sslCipherSuites: []
  sslTrustStorePath: ""
  sslTrustStorePassword: ""
  sslTrustStoreEncryptedPassword: ""
 
  sslKeyStorePath: ""
  sslKeyStorePassword: ""
  sslKeyStoreEncryptedPassword: ""

 

 

Flag

Description

Remarks

socketTimeout

Time limit in milliseconds for a socket to time out after establishing a connection

 

connectTimeout

The connection will timeout after this number of milliseconds

 

sslProtocols

Array of strings of all the protocols to be followed

Defaults to "default"

sslCertCheckEnabled

Set this to true to enable Certificate checks

Ideally it is suggested that both sslCertCheckEnabled and sslVerifyHostname   listed about should be true for security reasons.

sslVerifyHostname

Set this to true to enable host name verification

 

sslTrustStorePath

Path to the SSL TrustStore

Defaults to machine-agent/conf/extensions-cacerts.jks

sslTrustStorePassword

Truststore password in cleartext

The keystore needs to have either sslTrustStorePassword or  sslTrustStoreEncryptedPassword

sslTrustStoreEncryptedPassword

Encrypted TrustStore password

 

sslKeyStorePath

Path to the SSL KeyStore

Defaults to

machine-agent/conf/extensions-clientcerts.jks

sslKeyStorePassword

SSL Keystore password in cleartext

 

sslKeyStoreEncryptedPassword

Encrypted SSL Keystore password  
Version history
Revision #:
5 of 5
Last update:
‎03-01-2019 01:56 PM
Updated by:
 
Labels (1)


Found this article helpful? Click the Thumbs Up button.
Have an additional comment? Post it below.
0 Kudos