diff --git a/.gitignore b/.gitignore
index ad1c6a2..bf0f551 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
target/
class_diagram.ucls
.idea
+.iml
\ No newline at end of file
diff --git a/aws-cloudwatch-exts-commons.iml b/aws-cloudwatch-exts-commons.iml
new file mode 100644
index 0000000..e0ae638
--- /dev/null
+++ b/aws-cloudwatch-exts-commons.iml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 59202e9..c3eef2f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.appdynamics.extensions
aws-cloudwatch-exts-commons
- 2.0.1
+ 2.0.2
jar
aws-cloudwatch-exts-commons
@@ -43,7 +43,7 @@
com.appdynamics
appd-exts-commons
- 2.1.0
+ 2.1.2
com.fasterxml.woodstox
diff --git a/src/main/java/com/appdynamics/extensions/aws/collectors/AccountMetricStatisticsCollector.java b/src/main/java/com/appdynamics/extensions/aws/collectors/AccountMetricStatisticsCollector.java
index d5723a0..d2f872d 100644
--- a/src/main/java/com/appdynamics/extensions/aws/collectors/AccountMetricStatisticsCollector.java
+++ b/src/main/java/com/appdynamics/extensions/aws/collectors/AccountMetricStatisticsCollector.java
@@ -7,12 +7,6 @@
package com.appdynamics.extensions.aws.collectors;
-import static com.appdynamics.extensions.aws.Constants.DEFAULT_MAX_ERROR_RETRY;
-import static com.appdynamics.extensions.aws.Constants.DEFAULT_NO_OF_THREADS;
-import static com.appdynamics.extensions.aws.util.AWSUtil.createAWSClientConfiguration;
-import static com.appdynamics.extensions.aws.util.AWSUtil.createAWSCredentials;
-import static com.appdynamics.extensions.aws.validators.Validator.validateAccount;
-
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.appdynamics.extensions.MonitorExecutorService;
@@ -32,14 +26,15 @@
import java.util.List;
import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
+import java.util.concurrent.*;
import java.util.concurrent.atomic.LongAdder;
+import static com.appdynamics.extensions.aws.Constants.DEFAULT_MAX_ERROR_RETRY;
+import static com.appdynamics.extensions.aws.Constants.DEFAULT_NO_OF_THREADS;
+import static com.appdynamics.extensions.aws.util.AWSUtil.createAWSClientConfiguration;
+import static com.appdynamics.extensions.aws.util.AWSUtil.createAWSCredentials;
+import static com.appdynamics.extensions.aws.validators.Validator.validateAccount;
+
/**
* Collects statistics (of specified regions) for specified account
*
diff --git a/src/main/java/com/appdynamics/extensions/aws/collectors/NamespaceMetricStatisticsCollector.java b/src/main/java/com/appdynamics/extensions/aws/collectors/NamespaceMetricStatisticsCollector.java
index 1842537..36f544a 100644
--- a/src/main/java/com/appdynamics/extensions/aws/collectors/NamespaceMetricStatisticsCollector.java
+++ b/src/main/java/com/appdynamics/extensions/aws/collectors/NamespaceMetricStatisticsCollector.java
@@ -7,16 +7,9 @@
package com.appdynamics.extensions.aws.collectors;
-import static com.appdynamics.extensions.aws.Constants.DEFAULT_NO_OF_THREADS;
-import static com.appdynamics.extensions.aws.validators.Validator.validateNamespace;
-
import com.appdynamics.extensions.MonitorExecutorService;
import com.appdynamics.extensions.MonitorThreadPoolExecutor;
-import com.appdynamics.extensions.aws.config.Account;
-import com.appdynamics.extensions.aws.config.ConcurrencyConfig;
-import com.appdynamics.extensions.aws.config.CredentialsDecryptionConfig;
-import com.appdynamics.extensions.aws.config.MetricsConfig;
-import com.appdynamics.extensions.aws.config.ProxyConfig;
+import com.appdynamics.extensions.aws.config.*;
import com.appdynamics.extensions.aws.exceptions.AwsException;
import com.appdynamics.extensions.aws.metric.AccountMetricStatistics;
import com.appdynamics.extensions.aws.metric.NamespaceMetricStatistics;
@@ -29,16 +22,12 @@
import java.util.List;
import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
+import java.util.concurrent.*;
import java.util.concurrent.atomic.LongAdder;
+import static com.appdynamics.extensions.aws.Constants.DEFAULT_NO_OF_THREADS;
+import static com.appdynamics.extensions.aws.validators.Validator.validateNamespace;
+
/**
* Collects statistics (of all specified accounts) for specified namespace
*
@@ -63,6 +52,8 @@ public class NamespaceMetricStatisticsCollector implements Callable
private LongAdder awsRequestsCounter = new LongAdder();
private String metricPrefix;
+ private DashboardConfig dashboardConfig;
+ private ControllerInformation controllerInformation;
private NamespaceMetricStatisticsCollector(Builder builder) {
this.accounts = builder.accounts;
@@ -72,6 +63,8 @@ private NamespaceMetricStatisticsCollector(Builder builder) {
this.credentialsDecryptionConfig = builder.credentialsDecryptionConfig;
this.proxyConfig = builder.proxyConfig;
this.metricPrefix = builder.metricPrefix;
+ this.dashboardConfig = builder.dashboardConfig;
+ this.controllerInformation = builder.controllerInfo;
}
/**
@@ -198,16 +191,20 @@ public static class Builder {
private CredentialsDecryptionConfig credentialsDecryptionConfig;
private ProxyConfig proxyConfig;
private String metricPrefix;
+ private DashboardConfig dashboardConfig;
+ private ControllerInformation controllerInfo;
public Builder(List accounts,
ConcurrencyConfig concurrencyConfig,
MetricsConfig metricsConfig,
- MetricsProcessor metricsProcessor, String metricPrefix) {
+ MetricsProcessor metricsProcessor, String metricPrefix, DashboardConfig dashboardConfig, ControllerInformation controllerInformation) {
this.accounts = accounts;
this.concurrencyConfig = concurrencyConfig;
this.metricsConfig = metricsConfig;
this.metricsProcessor = metricsProcessor;
this.metricPrefix = metricPrefix;
+ this.dashboardConfig = dashboardConfig;
+ this.controllerInfo = controllerInformation;
}
public Builder withCredentialsDecryptionConfig(CredentialsDecryptionConfig credentialsDecryptionConfig) {
diff --git a/src/main/java/com/appdynamics/extensions/aws/config/Configuration.java b/src/main/java/com/appdynamics/extensions/aws/config/Configuration.java
index 8e6d30c..eaee0a9 100644
--- a/src/main/java/com/appdynamics/extensions/aws/config/Configuration.java
+++ b/src/main/java/com/appdynamics/extensions/aws/config/Configuration.java
@@ -37,6 +37,26 @@ public class Configuration {
private List dimensions;
+ private ControllerInformation controllerInfo;
+
+ private DashboardConfig customDashboard;
+
+ public DashboardConfig getCustomDashboard() {
+ return customDashboard;
+ }
+
+ public void setCustomDashboard(DashboardConfig dashboardConfig) {
+ this.customDashboard = dashboardConfig;
+ }
+
+ public ControllerInformation getControllerInfo() {
+ return controllerInfo;
+ }
+
+ public void setControllerInfo(ControllerInformation controllerInformation) {
+ this.controllerInfo = controllerInformation;
+ }
+
public List getAccounts() {
return accounts;
}
diff --git a/src/main/java/com/appdynamics/extensions/aws/config/ControllerInformation.java b/src/main/java/com/appdynamics/extensions/aws/config/ControllerInformation.java
new file mode 100644
index 0000000..4ceeb60
--- /dev/null
+++ b/src/main/java/com/appdynamics/extensions/aws/config/ControllerInformation.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2018 . AppDynamics LLC and its affiliates.
+ * All Rights Reserved.
+ * This is unpublished proprietary source code of AppDynamics LLC and its affiliates.
+ * The copyright notice above does not evidence any actual or intended publication of such source code.
+ *
+ */
+
+package com.appdynamics.extensions.aws.config;
+
+/**
+ * Created by bhuvnesh.kumar on 8/16/18.
+ */
+public class ControllerInformation {
+
+ private String controllerHost;
+ private Integer controllerPort;
+ private String account;
+ private String username;
+ private String password;
+ private String encryptedPassword;
+ private String encryptionKey;
+ private Boolean simEnabled;
+ private String applicationName;
+ private String tierName;
+ private String nodeName;
+ private Boolean controllerSslEnabled;
+ protected Boolean enableOrchestration;
+ protected String uniqueHostId;
+ protected String accountAccessKey;
+ protected String machinePath;
+
+ public Boolean getEnableOrchestration() {
+ return enableOrchestration;
+ }
+
+ public void setEnableOrchestration(Boolean enableOrchestration) {
+ this.enableOrchestration = enableOrchestration;
+ }
+
+ public String getUniqueHostId() {
+ return uniqueHostId;
+ }
+
+ public void setUniqueHostId(String uniqueHostId) {
+ this.uniqueHostId = uniqueHostId;
+ }
+
+ public String getAccountAccessKey() {
+ return accountAccessKey;
+ }
+
+ public void setAccountAccessKey(String accountAccessKey) {
+ this.accountAccessKey = accountAccessKey;
+ }
+
+ public String getMachinePath() {
+ return machinePath;
+ }
+
+ public void setMachinePath(String machinePath) {
+ this.machinePath = machinePath;
+ }
+
+
+ public Boolean getControllerSslEnabled() {
+ return controllerSslEnabled;
+ }
+
+ public void setControllerSslEnabled(Boolean controllerSslEnabled) {
+ this.controllerSslEnabled = controllerSslEnabled;
+ }
+
+ public String getControllerHost() {
+ return controllerHost;
+ }
+
+ public void setControllerHost(String controllerHost) {
+ this.controllerHost = controllerHost;
+ }
+
+ public Integer getControllerPort() {
+ return controllerPort;
+ }
+
+ public void setControllerPort(Integer controllerPort) {
+ this.controllerPort = controllerPort;
+ }
+
+ public String getAccount() {
+ return account;
+ }
+
+ public void setAccount(String account) {
+ this.account = account;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getEncryptedPassword() {
+ return encryptedPassword;
+ }
+
+ public void setEncryptedPassword(String encryptedPassword) {
+ this.encryptedPassword = encryptedPassword;
+ }
+
+ public String getEncryptionKey() {
+ return encryptionKey;
+ }
+
+ public void setEncryptionKey(String encryptionKey) {
+ this.encryptionKey = encryptionKey;
+ }
+
+ public Boolean getSimEnabled() {
+ return simEnabled;
+ }
+
+ public void setSimEnabled(Boolean simEnabled) {
+ this.simEnabled = simEnabled;
+ }
+
+ public String getApplicationName() {
+ return applicationName;
+ }
+
+ public void setApplicationName(String applicationName) {
+ this.applicationName = applicationName;
+ }
+
+ public String getTierName() {
+ return tierName;
+ }
+
+ public void setTierName(String tierName) {
+ this.tierName = tierName;
+ }
+
+ public String getNodeName() {
+ return nodeName;
+ }
+
+ public void setNodeName(String nodeName) {
+ this.nodeName = nodeName;
+ }
+
+}
diff --git a/src/main/java/com/appdynamics/extensions/aws/config/DashboardConfig.java b/src/main/java/com/appdynamics/extensions/aws/config/DashboardConfig.java
new file mode 100644
index 0000000..eb2d3c3
--- /dev/null
+++ b/src/main/java/com/appdynamics/extensions/aws/config/DashboardConfig.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2018 . AppDynamics LLC and its affiliates.
+ * All Rights Reserved.
+ * This is unpublished proprietary source code of AppDynamics LLC and its affiliates.
+ * The copyright notice above does not evidence any actual or intended publication of such source code.
+ *
+ */
+
+package com.appdynamics.extensions.aws.config;
+
+/**
+ * Created by bhuvnesh.kumar on 8/16/18.
+ */
+public class DashboardConfig {
+
+ private Boolean enabled;
+ private String dashboardName;
+ private String pathToSIMDashboard;
+ private String pathToNormalDashboard;
+ private Integer periodicDashboardCheckInSeconds;
+ private Boolean sslCertCheckEnabled;
+
+ public Boolean getSslCertCheckEnabled() {
+ return sslCertCheckEnabled;
+ }
+
+ public void setSslCertCheckEnabled(Boolean sslCertCheckEnabled) {
+ this.sslCertCheckEnabled = sslCertCheckEnabled;
+ }
+
+ public Integer getPeriodicDashboardCheckInSeconds() {
+ return periodicDashboardCheckInSeconds;
+ }
+
+ public void setPeriodicDashboardCheckInSeconds(Integer periodicDashboardCheckInSeconds) {
+ this.periodicDashboardCheckInSeconds = periodicDashboardCheckInSeconds;
+ }
+
+ public Boolean getEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(Boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public String getDashboardName() {
+ return dashboardName;
+ }
+
+ public void setDashboardName(String dashboardName) {
+ this.dashboardName = dashboardName;
+ }
+
+
+ public String getPathToSIMDashboard() {
+ return pathToSIMDashboard;
+ }
+
+ public void setPathToSIMDashboard(String pathToSIMDashboard) {
+ this.pathToSIMDashboard = pathToSIMDashboard;
+ }
+
+ public String getPathToNormalDashboard() {
+ return pathToNormalDashboard;
+ }
+
+ public void setPathToNormalDashboard(String pathToNormalDashboard) {
+ this.pathToNormalDashboard = pathToNormalDashboard;
+ }
+
+}
diff --git a/src/main/java/com/appdynamics/extensions/aws/util/AWSUtil.java b/src/main/java/com/appdynamics/extensions/aws/util/AWSUtil.java
index 4d96cdd..2a8e657 100644
--- a/src/main/java/com/appdynamics/extensions/aws/util/AWSUtil.java
+++ b/src/main/java/com/appdynamics/extensions/aws/util/AWSUtil.java
@@ -7,6 +7,9 @@
package com.appdynamics.extensions.aws.util;
+import static com.appdynamics.extensions.TaskInputArgs.ENCRYPTED_PASSWORD;
+import static com.appdynamics.extensions.TaskInputArgs.ENCRYPTION_KEY;
+
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
@@ -55,8 +58,8 @@ public static AWSCredentials createAWSCredentials(Account account,
private static String getDecryptedPassword(String encryptedPassword, String encryptionKey) {
Map cryptoMap = Maps.newHashMap();
- cryptoMap.put("password-encrypted", encryptedPassword);
- cryptoMap.put("encryption-key", encryptionKey);
+ cryptoMap.put(ENCRYPTED_PASSWORD, encryptedPassword);
+ cryptoMap.put(ENCRYPTION_KEY, encryptionKey);
return CryptoUtil.getPassword(cryptoMap);
}
diff --git a/src/main/resources/conf/config-sample.yaml b/src/main/resources/conf/config-sample.yaml
index 05e1499..b02e71c 100644
--- a/src/main/resources/conf/config-sample.yaml
+++ b/src/main/resources/conf/config-sample.yaml
@@ -105,4 +105,36 @@ metricsConfig:
#This will create it in specific Tier/Component. Make sure to replace with the appropriate one from your environment.
#To find the in your environment, please follow the screenshot https://docs.appdynamics.com/display/PRO42/Build+a+Monitoring+Extension+Using+Java
-metricPrefix: "Server|Component:|Custom Metrics|Amazon EC2|"
\ No newline at end of file
+metricPrefix: "Server|Component:|Custom Metrics|Amazon EC2|"
+
+# Generate a custom dashboard based on the provided template
+customDashboard:
+ enabled: true
+ dashboardName: "AWS ELB Monitor Dashboard"
+ sslCertCheckEnabled: false
+ # Update the path to the dashboard file.
+ pathToSIMDashboard: "monitors/AWSELBMonitor/normalDashboard.json"
+ pathToNormalDashboard: "monitors/AWSELBMonitor/normalDashboard.json"
+ periodicDashboardCheckInSeconds: 300
+
+# To upload the dashboard, please create a user from Controller UI or
+# add the credentials of an existing user.
+
+controllerInfo:
+ controllerHost: "host"
+ controllerPort: 9090
+ controllerSslEnabled: false
+ enableOrchestration: false
+ uniqueHostId: ""
+ username: "username"
+ password: "password"
+ encryptedPassword: ""
+ encryptionKey: ""
+ accountAccessKey: ""
+ account: "account"
+ machinePath: ""
+ simEnabled: false
+ applicationName: "application"
+ tierName: "tier"
+ nodeName: "node"
+
diff --git a/src/main/resources/conf/config-template.yaml b/src/main/resources/conf/config-template.yaml
index a03da6e..4226fcc 100644
--- a/src/main/resources/conf/config-template.yaml
+++ b/src/main/resources/conf/config-template.yaml
@@ -110,4 +110,35 @@ metricsConfig:
#This will create it in specific Tier/Component. Make sure to replace with the appropriate one from your environment.
#To find the in your environment, please follow the screenshot https://docs.appdynamics.com/display/PRO42/Build+a+Monitoring+Extension+Using+Java
-metricPrefix: "Server|Component:|Custom Metrics|Amazon EC2|"
\ No newline at end of file
+metricPrefix: "Server|Component:|Custom Metrics|Amazon EC2|"
+
+# Generate a custom dashboard based on the provided template
+customDashboard:
+ enabled: true
+ dashboardName: "AWS ELB Monitor Dashboard"
+ sslCertCheckEnabled: false
+ # Update the path to the dashboard file.
+ pathToSIMDashboard: "monitors/AWSELBMonitor/normalDashboard.json"
+ pathToNormalDashboard: "monitors/AWSELBMonitor/normalDashboard.json"
+ periodicDashboardCheckInSeconds: 300
+
+# To upload the dashboard, please create a user from Controller UI or
+# add the credentials of an existing user.
+
+controllerInfo:
+ controllerHost: "host"
+ controllerPort: 9090
+ controllerSslEnabled: false
+ enableOrchestration: false
+ uniqueHostId: ""
+ username: "username"
+ password: "password"
+ encryptedPassword: ""
+ encryptionKey: ""
+ accountAccessKey: ""
+ account: "account"
+ machinePath: ""
+ simEnabled: false
+ applicationName: "application"
+ tierName: "tier"
+ nodeName: "node"
diff --git a/src/test/java/com/appdynamics/extensions/aws/collectors/NamespaceMetricStatisticsCollectorTest.java b/src/test/java/com/appdynamics/extensions/aws/collectors/NamespaceMetricStatisticsCollectorTest.java
index 911e506..a7414ce 100644
--- a/src/test/java/com/appdynamics/extensions/aws/collectors/NamespaceMetricStatisticsCollectorTest.java
+++ b/src/test/java/com/appdynamics/extensions/aws/collectors/NamespaceMetricStatisticsCollectorTest.java
@@ -17,13 +17,7 @@
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.whenNew;
-import com.appdynamics.extensions.aws.config.Account;
-import com.appdynamics.extensions.aws.config.ConcurrencyConfig;
-import com.appdynamics.extensions.aws.config.CredentialsDecryptionConfig;
-import com.appdynamics.extensions.aws.config.IncludeMetric;
-import com.appdynamics.extensions.aws.config.MetricsConfig;
-import com.appdynamics.extensions.aws.config.MetricsTimeRange;
-import com.appdynamics.extensions.aws.config.ProxyConfig;
+import com.appdynamics.extensions.aws.config.*;
import com.appdynamics.extensions.aws.dto.AWSMetric;
import com.appdynamics.extensions.aws.metric.AccountMetricStatistics;
import com.appdynamics.extensions.aws.metric.MetricStatistic;
@@ -64,6 +58,13 @@ public class NamespaceMetricStatisticsCollectorTest {
@Mock
private ConcurrencyConfig mockConcurrencyConfig;
+ @Mock
+ private DashboardConfig mockDashboardConfig;
+
+ @Mock
+ private ControllerInformation mockControllerInformation;
+
+
@SuppressWarnings("unchecked")
@Test
public void testMetricsRetrievalIsSuccessful() throws Exception {
@@ -112,7 +113,7 @@ public void testMetricsRetrievalIsSuccessful() throws Exception {
classUnderTest = new NamespaceMetricStatisticsCollector.Builder(testAccounts,
mockConcurrencyConfig,
mockMetricsConfig,
- mockMetricsProcessor, "Test|Prefix")
+ mockMetricsProcessor, "Test|Prefix", mockDashboardConfig, mockControllerInformation)
.build();
classUnderTest.call();
diff --git a/src/test/java/com/appdynamics/extensions/aws/config/ControllerInfoAndDashboardConfigTest.java b/src/test/java/com/appdynamics/extensions/aws/config/ControllerInfoAndDashboardConfigTest.java
new file mode 100644
index 0000000..0b5207a
--- /dev/null
+++ b/src/test/java/com/appdynamics/extensions/aws/config/ControllerInfoAndDashboardConfigTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2018 . AppDynamics LLC and its affiliates.
+ * All Rights Reserved.
+ * This is unpublished proprietary source code of AppDynamics LLC and its affiliates.
+ * The copyright notice above does not evidence any actual or intended publication of such source code.
+ *
+ */
+
+package com.appdynamics.extensions.aws.config;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.yaml.snakeyaml.Yaml;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+/**
+ * Created by bhuvnesh.kumar on 9/27/18.
+ */
+public class ControllerInfoAndDashboardConfigTest {
+
+ // this test verifies that a valid Configuration object is created when using the config with sections of controllerInfo and customDashboard present
+
+ @Test
+ public void ConfigAndDashboardPresentTest() throws IOException {
+
+ Yaml yaml = new Yaml();
+ File file = new File("src/test/resources/conf/test-controllerInfo-dashboard-config.yml");
+ Configuration config = yaml.loadAs(new FileInputStream(file), Configuration.class);
+
+ Assert.assertTrue(config.getCustomDashboard().getEnabled() == true);
+ Assert.assertTrue(config.getCustomDashboard().getDashboardName().equals("AWS ELB Monitor Dashboard"));
+ Assert.assertTrue(config.getCustomDashboard().getPathToNormalDashboard().equals("monitors/AWSELBMonitor/normalDashboard.json"));
+ Assert.assertTrue(config.getCustomDashboard().getPathToSIMDashboard().equals("monitors/AWSELBMonitor/simDashboard.json"));
+ Assert.assertTrue(config.getCustomDashboard().getPeriodicDashboardCheckInSeconds().equals(300));
+
+ Assert.assertTrue(config.getControllerInfo().getAccount().equals("account"));
+ Assert.assertTrue(config.getControllerInfo().getUsername().equals("admin"));
+ Assert.assertTrue(config.getControllerInfo().getPassword().equals("root"));
+ Assert.assertTrue(config.getControllerInfo().getControllerHost().equals("host"));
+ Assert.assertTrue(config.getControllerInfo().getControllerPort().equals(9000));
+
+ }
+
+}
diff --git a/src/test/java/com/appdynamics/extensions/aws/util/AWSUtilTest.java b/src/test/java/com/appdynamics/extensions/aws/util/AWSUtilTest.java
new file mode 100644
index 0000000..9b590e0
--- /dev/null
+++ b/src/test/java/com/appdynamics/extensions/aws/util/AWSUtilTest.java
@@ -0,0 +1,57 @@
+package com.appdynamics.extensions.aws.util;
+
+import com.amazonaws.auth.AWSCredentials;
+import com.appdynamics.extensions.aws.config.Account;
+import com.appdynamics.extensions.aws.config.CredentialsDecryptionConfig;
+import com.appdynamics.extensions.crypto.Encryptor;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+
+/**
+ * @author Satish Muddam
+ */
+
+@RunWith(MockitoJUnitRunner.class)
+public class AWSUtilTest {
+
+ @Mock
+ private Account account;
+
+ @Mock
+ private CredentialsDecryptionConfig credentialsDecryptionConfig;
+
+ @Test
+ public void testCreateAWSCredentialsWithoutEncryption() {
+
+ Mockito.when(account.getAwsAccessKey()).thenReturn("accessKey1");
+ Mockito.when(account.getAwsSecretKey()).thenReturn("secretKey1");
+
+ AWSCredentials awsCredentials = AWSUtil.createAWSCredentials(account, null);
+
+ Assert.assertEquals("accessKey1", awsCredentials.getAWSAccessKeyId());
+ Assert.assertEquals("secretKey1", awsCredentials.getAWSSecretKey());
+ }
+
+ @Test
+ public void testCreateAWSCredentialsWithEncryption() {
+
+
+ Encryptor encryptor = new Encryptor("test");
+
+ Mockito.when(account.getAwsAccessKey()).thenReturn(encryptor.encrypt("accessKey1"));
+ Mockito.when(account.getAwsSecretKey()).thenReturn(encryptor.encrypt("secretKey1"));
+
+
+ Mockito.when(credentialsDecryptionConfig.isDecryptionEnabled()).thenReturn(true);
+ Mockito.when(credentialsDecryptionConfig.getEncryptionKey()).thenReturn("test");
+
+ AWSCredentials awsCredentials = AWSUtil.createAWSCredentials(account, credentialsDecryptionConfig);
+
+ Assert.assertEquals("accessKey1", awsCredentials.getAWSAccessKeyId());
+ Assert.assertEquals("secretKey1", awsCredentials.getAWSSecretKey());
+ }
+}
diff --git a/src/test/resources/conf/test-controllerInfo-dashboard-config.yml b/src/test/resources/conf/test-controllerInfo-dashboard-config.yml
new file mode 100644
index 0000000..50eb5a4
--- /dev/null
+++ b/src/test/resources/conf/test-controllerInfo-dashboard-config.yml
@@ -0,0 +1,238 @@
+
+#This will create this metric in all the tiers, under this path. Please make sure to have a trailing |
+#metricPrefix: "Custom Metrics|Amazon ELB|"
+
+#This will create it in specific Tier aka Component. Replace . Please make sure to have a trailing |.
+#To find out the COMPONENT_ID, please see the screen shot here https://docs.appdynamics.com/display/PRO42/Build+a+Monitoring+Extension+Using+Java
+
+# Metric list can be found here : https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/elb-metricscollected.html
+
+metricPrefix: "Server|Component:29|Custom Metrics|Amazon ELB|"
+
+accounts:
+ - awsAccessKey: ""
+ awsSecretKey: "7ETG/"
+ displayAccountName: "Appd"
+
+ # Regions where cloudwatch is registered
+ # Allowed values: ap-southeast-1, ap-southeast-2, ap-northeast-1, eu-central-1,
+ # us-east-1, eu-west-1, us-west-1, us-west-2, sa-east-1
+ #
+ regions: ["us-east-1"]
+
+#Provide Encryption key for Encrypted password.
+credentialsDecryptionConfig:
+ enableDecryption: "false"
+ encryptionKey:
+
+proxyConfig:
+ host:
+ port:
+ username:
+ password:
+
+# Classic (namespace : "AWS/ELB")
+# Dimensions : AvailabilityZone, LoadBalancerName
+
+# dimensions:
+# - name: "LoadBalancerName"
+# displayName: "Load Balancer Name"
+# values: []
+# - name: "AvailabilityZone"
+# displayName: "Availability Zone"
+# values: []
+
+dimensions:
+ - name: "LoadBalancerName"
+ displayName: "LoadBalancer Name"
+ values: [".*"]
+ - name: "AvailabilityZone"
+ displayName: "Availability Zone"
+ values: [".*"]
+
+# Global metrics config for all accounts
+metricsConfig:
+
+ # By default, all metrics retrieved from cloudwatch are 'Average' values.
+ # This option allows you to override the metric type.
+ #
+ # Allowed statTypes are: ave, max, min, sum, samplecount
+ #
+ # Note: Irrespective of the metric type, value will still be reported as
+ # Observed value to the Controller
+ includeMetrics:
+ - name: "BackendConnectionErrors"
+ alias: "Backend Connection Errors"
+ statType: "sum"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "HealthyHostCount"
+ alias: "Healthy Host Count"
+ statType: "ave"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "HTTPCode_Backend_2XX"
+ alias: "HTTPCode_Backend_2XX"
+ statType: "sum"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "HTTPCode_Backend_3XX"
+ alias: "HTTPCode_Backend_3XX"
+ statType: "sum"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "HTTPCode_Backend_4XX"
+ alias: "HTTPCode_Backend_4XX"
+ statType: "sum"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "HTTPCode_Backend_5XX"
+ alias: "HTTPCode_Backend_5XX"
+ statType: "sum"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "HTTPCode_ELB_4XX"
+ alias: "HTTPCode_ELB_4XX"
+ statType: "sum"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "HTTPCode_ELB_5XX"
+ alias: "HTTPCode_ELB_5XX"
+ statType: "sum"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "Latency"
+ alias: "Latencyx1000"
+ statType: "ave"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1000
+ - name: "RequestCount"
+ alias: "Request Count"
+ statType: "sum"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "SpilloverCount"
+ alias: "Spillover Count"
+ statType: "sum"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "SurgeQueueLength"
+ alias: "Surge Queue Length"
+ statType: "ave"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+ - name: "UnHealthyHostCount"
+ alias: "UnHealthy Host Count"
+ statType: "ave"
+ aggregationType: "AVERAGE"
+ timeRollUpType: "AVERAGE"
+ clusterRollUpType: "INDIVIDUAL"
+ delta: false
+ multiplier: 1
+
+
+ metricsTimeRange:
+ startTimeInMinsBeforeNow: 5
+ endTimeInMinsBeforeNow: 0
+
+ # Rate limit ( per second ) for GetMetricStatistics, default value is 400. https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_limits.html
+ getMetricStatisticsRateLimit: 400
+
+ #
+ # The max number of retry attempts for failed retryable requests
+ # (ex: 5xx error responses from a service) or throttling errors
+ #
+ maxErrorRetrySize: 3
+
+#Allowed values are Basic and Detailed. Refer https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch-new.html for more information
+# Basic will fire CloudWatch API calls every 5 minutes
+# Detailed will fire CloudWatch API calls every 1 minutes
+cloudWatchMonitoring: "Basic"
+
+concurrencyConfig:
+ noOfAccountThreads: 3
+ noOfRegionThreadsPerAccount: 3
+ noOfMetricThreadsPerRegion: 3
+ #Thread timeout in seconds
+ threadTimeOut: 30
+
+# Generate a custom dashboard based on the provided template
+customDashboard:
+ enabled: true
+ dashboardName: "AWS ELB Monitor Dashboard"
+
+ # Update the path to the dashboard file.
+ pathToSIMDashboard: "monitors/AWSELBMonitor/simDashboard.json"
+ pathToNormalDashboard: "monitors/AWSELBMonitor/normalDashboard.json"
+ periodicDashboardCheckInSeconds: 300
+
+# To upload the dashboard, please create a user from Controller UI or
+# add the credentials of an existing user.
+
+controllerInfo:
+ controllerHost: "host"
+ controllerPort: 9000
+ account: "account"
+ username: "admin"
+ password: "root"
+ # OPTIONAL Items
+ encryptedPassword: ""
+ encryptionKey: ""
+
+
+regionEndPoints:
+ us-east-1 : monitoring.us-east-1.amazonaws.com
+ us-east-2 : monitoring.us-east-2.amazonaws.com
+ us-west-1 : monitoring.us-west-1.amazonaws.com
+ us-west-2 : monitoring.us-west-2.amazonaws.com
+ ap-northeast-1 : monitoring.ap-northeast-1.amazonaws.com
+ ap-northeast-2: monitoring.ap-northeast-2.amazonaws.com
+ ap-northeast-3 : monitoring.ap-northeast-3.amazonaws.com
+ ap-south-1 : monitoring.ap-south-1.amazonaws.com
+ ap-southeast-1 : monitoring.ap-southeast-1.amazonaws.com
+ ap-southeast-2 : monitoring.ap-southeast-2.amazonaws.com
+ ca-central-1 : monitoring.ca-central-1.amazonaws.com
+ cn-north-1 : monitoring.cn-north-1.amazonaws.com.cn
+ cn-northwest-1 : monitoring.cn-northwest-1.amazonaws.com.cn
+ eu-central-1 : monitoring.eu-central-1.amazonaws.com
+ eu-west-1 : monitoring.eu-west-1.amazonaws.com
+ eu-west-2 : monitoring.eu-west-2.amazonaws.com
+ eu-west-3 : monitoring.eu-west-3.amazonaws.com
+ sa-east-1 : monitoring.sa-east-1.amazonaws.com
+ us-gov-west-1 : monitoring.us-gov-west-1.amazonaws.com