You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2016/04/16 16:48:42 UTC

[1/2] ambari git commit: AMBARI-15700: Stack advisor - Component layout recommendation needs support for avoiding hosts in maintenance mode

Repository: ambari
Updated Branches:
  refs/heads/alerts [created] b7ee82491


AMBARI-15700: Stack advisor - Component layout recommendation needs support for avoiding hosts in maintenance mode


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/54271dc0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/54271dc0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/54271dc0

Branch: refs/heads/alerts
Commit: 54271dc0d123ea779903268348e8885dd8a25bdc
Parents: 67cb6a4
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Mon Apr 11 10:34:25 2016 -0700
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Sat Apr 16 07:33:34 2016 -0700

----------------------------------------------------------------------
 .../stacks/BIGTOP/0.8/services/stack_advisor.py | 11 +--
 .../stacks/HDP/2.0.6/services/stack_advisor.py  | 12 +--
 .../stacks/HDPWIN/2.1/services/stack_advisor.py | 11 +--
 .../src/main/resources/stacks/stack_advisor.py  | 34 +++++++--
 .../src/test/python/TestStackAdvisor.py         | 80 ++++++++++++++++++++
 5 files changed, 127 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/54271dc0/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/stack_advisor.py
index 53591cd..701d0d4 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/stack_advisor.py
@@ -29,8 +29,8 @@ class BaseBIGTOP08StackAdvisor(DefaultStackAdvisor):
     items = []
 
     # Validating NAMENODE and SECONDARY_NAMENODE are on different hosts if possible
-    hostsList = [host["Hosts"]["host_name"] for host in hosts["items"]]
-    hostsCount = len(hostsList)
+    hostsSet = set(super(BaseBIGTOP08StackAdvisor, self).getActiveHosts([host["Hosts"] for host in hosts["items"]]))
+    hostsCount = len(hostsSet)
 
     componentsListList = [service["components"] for service in services["services"]]
     componentsList = [item for sublist in componentsListList for item in sublist]
@@ -42,9 +42,10 @@ class BaseBIGTOP08StackAdvisor(DefaultStackAdvisor):
       if component["StackServiceComponents"]["cardinality"] is not None:
          componentName = component["StackServiceComponents"]["component_name"]
          componentDisplayName = component["StackServiceComponents"]["display_name"]
-         componentHostsCount = 0
+         componentHosts = []
          if component["StackServiceComponents"]["hostnames"] is not None:
-           componentHostsCount = len(component["StackServiceComponents"]["hostnames"])
+           componentHosts = [componentHost for componentHost in component["StackServiceComponents"]["hostnames"] if componentHost in hostsSet]
+         componentHostsCount = len(componentHosts)
          cardinality = str(component["StackServiceComponents"]["cardinality"])
          # cardinality types: null, 1+, 1-2, 1, ALL
          message = None
@@ -71,7 +72,7 @@ class BaseBIGTOP08StackAdvisor(DefaultStackAdvisor):
     # Validating host-usage
     usedHostsListList = [component["StackServiceComponents"]["hostnames"] for component in componentsList if not self.isComponentNotValuable(component)]
     usedHostsList = [item for sublist in usedHostsListList for item in sublist]
-    nonUsedHostsList = [item for item in hostsList if item not in usedHostsList]
+    nonUsedHostsList = [item for item in hostsSet if item not in usedHostsList]
     for host in nonUsedHostsList:
       items.append( { "type": 'host-component', "level": 'ERROR', "message": 'Host is not used', "host": str(host) } )
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/54271dc0/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 0130483..6dd1d84 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -32,8 +32,9 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
     items = []
 
     # Validating NAMENODE and SECONDARY_NAMENODE are on different hosts if possible
-    hostsList = [host["Hosts"]["host_name"] for host in hosts["items"]]
-    hostsCount = len(hostsList)
+    # Use a set for fast lookup
+    hostsSet =  set(super(HDP206StackAdvisor, self).getActiveHosts([host["Hosts"] for host in hosts["items"]]))  #[host["Hosts"]["host_name"] for host in hosts["items"]]
+    hostsCount = len(hostsSet)
 
     componentsListList = [service["components"] for service in services["services"]]
     componentsList = [item for sublist in componentsListList for item in sublist]
@@ -45,9 +46,10 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
       if component["StackServiceComponents"]["cardinality"] is not None:
          componentName = component["StackServiceComponents"]["component_name"]
          componentDisplayName = component["StackServiceComponents"]["display_name"]
-         componentHostsCount = 0
+         componentHosts = []
          if component["StackServiceComponents"]["hostnames"] is not None:
-           componentHostsCount = len(component["StackServiceComponents"]["hostnames"])
+           componentHosts = [componentHost for componentHost in component["StackServiceComponents"]["hostnames"] if componentHost in hostsSet]
+         componentHostsCount = len(componentHosts)
          cardinality = str(component["StackServiceComponents"]["cardinality"])
          # cardinality types: null, 1+, 1-2, 1, ALL
          message = None
@@ -74,7 +76,7 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
     # Validating host-usage
     usedHostsListList = [component["StackServiceComponents"]["hostnames"] for component in componentsList if not self.isComponentNotValuable(component)]
     usedHostsList = [item for sublist in usedHostsListList for item in sublist]
-    nonUsedHostsList = [item for item in hostsList if item not in usedHostsList]
+    nonUsedHostsList = [item for item in hostsSet if item not in usedHostsList]
     for host in nonUsedHostsList:
       items.append( { "type": 'host-component', "level": 'ERROR', "message": 'Host is not used', "host": str(host) } )
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/54271dc0/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/stack_advisor.py
index b99c484..cf52ade 100644
--- a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/stack_advisor.py
@@ -31,8 +31,8 @@ class HDPWIN21StackAdvisor(DefaultStackAdvisor):
     items = []
 
     # Validating NAMENODE and SECONDARY_NAMENODE are on different hosts if possible
-    hostsList = [host["Hosts"]["host_name"] for host in hosts["items"]]
-    hostsCount = len(hostsList)
+    hostsSet =  set(super(HDPWIN21StackAdvisor, self).getActiveHosts([host["Hosts"] for host in hosts["items"]]))
+    hostsCount = len(hostsSet)
 
     componentsListList = [service["components"] for service in services["services"]]
     componentsList = [item for sublist in componentsListList for item in sublist]
@@ -44,9 +44,10 @@ class HDPWIN21StackAdvisor(DefaultStackAdvisor):
       if component["StackServiceComponents"]["cardinality"] is not None:
          componentName = component["StackServiceComponents"]["component_name"]
          componentDisplayName = component["StackServiceComponents"]["display_name"]
-         componentHostsCount = 0
+         componentHosts = []
          if component["StackServiceComponents"]["hostnames"] is not None:
-           componentHostsCount = len(component["StackServiceComponents"]["hostnames"])
+           componentHosts = [componentHost for componentHost in component["StackServiceComponents"]["hostnames"] if componentHost in hostsSet]
+         componentHostsCount = len(componentHosts)
          cardinality = str(component["StackServiceComponents"]["cardinality"])
          # cardinality types: null, 1+, 1-2, 1, ALL
          message = None
@@ -73,7 +74,7 @@ class HDPWIN21StackAdvisor(DefaultStackAdvisor):
     # Validating host-usage
     usedHostsListList = [component["StackServiceComponents"]["hostnames"] for component in componentsList if not self.isComponentNotValuable(component)]
     usedHostsList = [item for sublist in usedHostsListList for item in sublist]
-    nonUsedHostsList = [item for item in hostsList if item not in usedHostsList]
+    nonUsedHostsList = [item for item in hostsSet if item not in usedHostsList]
     for host in nonUsedHostsList:
       items.append( { "type": 'host-component', "level": 'ERROR', "message": 'Host is not used', "host": str(host) } )
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/54271dc0/ambari-server/src/main/resources/stacks/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/stack_advisor.py b/ambari-server/src/main/resources/stacks/stack_advisor.py
index 539bd25..9979e7e 100644
--- a/ambari-server/src/main/resources/stacks/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/stack_advisor.py
@@ -309,12 +309,25 @@ class DefaultStackAdvisor(StackAdvisor):
   implement
   """
 
+  """
+  Filters the list of specified hosts object and returns
+  a list of hosts which are not in maintenance mode.
+  """
+  def getActiveHosts(self, hosts):
+    hostsList = []
+
+    if (hosts is not None):
+      hostsList = [host['host_name'] for host in hosts
+                   if host.get('maintenance_state') is None or host.get('maintenance_state') == "OFF"]
+
+    return hostsList
+
   def recommendComponentLayout(self, services, hosts):
     """Returns Services object with hostnames array populated for components"""
 
     stackName = services["Versions"]["stack_name"]
     stackVersion = services["Versions"]["stack_version"]
-    hostsList = [host["Hosts"]["host_name"] for host in hosts["items"]]
+    hostsList = self.getActiveHosts([host["Hosts"] for host in hosts["items"]])
     servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
 
     layoutRecommendations = self.createComponentLayoutRecommendations(services, hosts)
@@ -339,14 +352,17 @@ class DefaultStackAdvisor(StackAdvisor):
       }
     }
 
-    hostsList = [host["Hosts"]["host_name"] for host in hosts["items"]]
+    hostsList = self.getActiveHosts([host["Hosts"] for host in hosts["items"]])
+
+    # for fast lookup
+    hostsSet = set(hostsList)
 
     hostsComponentsMap = {}
     for hostName in hostsList:
       if hostName not in hostsComponentsMap:
         hostsComponentsMap[hostName] = []
 
-    #extend 'hostsComponentsMap' with MASTER components
+    #extend hostsComponentsMap' with MASTER components
     for service in services["services"]:
       masterComponents = [component for component in service["components"] if self.isMasterComponent(component)]
       for component in masterComponents:
@@ -373,7 +389,9 @@ class DefaultStackAdvisor(StackAdvisor):
 
         #extend 'hostsComponentsMap' with 'hostsForComponent'
         for hostName in hostsForComponent:
-          hostsComponentsMap[hostName].append( { "name":componentName } )
+          if hostName in hostsSet:
+            hostsComponentsMap[hostName].append( { "name":componentName } )
+
     #extend 'hostsComponentsMap' with Slave and Client Components
     componentsListList = [service["components"] for service in services["services"]]
     componentsList = [item for sublist in componentsListList for item in sublist]
@@ -422,9 +440,10 @@ class DefaultStackAdvisor(StackAdvisor):
 
         #extend 'hostsComponentsMap' with 'hostsForComponent'
         for hostName in hostsForComponent:
-          if hostName not in hostsComponentsMap:
+          if hostName not in hostsComponentsMap and hostName in hostsSet:
             hostsComponentsMap[hostName] = []
-          hostsComponentsMap[hostName].append( { "name": componentName } )
+          if hostName in hostsSet:
+            hostsComponentsMap[hostName].append( { "name": componentName } )
 
     #prepare 'host-group's from 'hostsComponentsMap'
     host_groups = recommendations["blueprint"]["host_groups"]
@@ -621,6 +640,9 @@ class DefaultStackAdvisor(StackAdvisor):
     return self.getCardinalitiesDict().get(componentName, {"min": 1, "max": 1})
 
   def getHostForComponent(self, component, hostsList):
+    if (len(hostsList) == 0):
+      return None
+
     componentName = self.getComponentName(component)
 
     if len(hostsList) != 1:

http://git-wip-us.apache.org/repos/asf/ambari/blob/54271dc0/ambari-server/src/test/python/TestStackAdvisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestStackAdvisor.py b/ambari-server/src/test/python/TestStackAdvisor.py
index 149ae1d..87d2d15 100644
--- a/ambari-server/src/test/python/TestStackAdvisor.py
+++ b/ambari-server/src/test/python/TestStackAdvisor.py
@@ -340,6 +340,86 @@ class TestStackAdvisorInitialization(TestCase):
     }
     self.assertEquals(actualRecommendLayoutResponse, expectedRecommendLayoutResponse)
 
+    # Test with maintenance_state. One host is in maintenance mode.
+    hosts= {
+      "items": [
+        {"Hosts": {"host_name": "host1", "maintenance_state":"OFF"}},
+        {"Hosts": {"host_name": "host2", "maintenance_state":"ON"}}
+      ]
+    }
+
+    actualRecommendLayoutResponse = default_stack_advisor.recommendComponentLayout(services, hosts)
+    expectedRecommendLayoutResponse = {
+      "services": ["GANGLIA", "HBASE", "HDFS", "PIG", "TEZ", "ZOOKEEPER"],
+      "recommendations": {
+        "blueprint": {
+          "host_groups": [
+            {
+              "name": "host-group-1",
+              "components": [
+                {
+                  "name": "GANGLIA_SERVER"
+                },
+                {
+                  "name": "HBASE_MASTER"
+                },
+                {
+                  "name": "NAMENODE"
+                },
+                {
+                  "name": "SECONDARY_NAMENODE"
+                },
+                {
+                  "name": "ZOOKEEPER_SERVER"
+                },
+                {
+                  "name": "ZOOKEEPER_CLIENT"
+                }
+              ]
+            }
+          ]
+        },
+        "blueprint_cluster_binding":
+          {
+            "host_groups": [
+              {
+                "hosts": [{"fqdn": "host1"}],
+                "name": "host-group-1"
+              }
+            ]
+          }
+      },
+      "hosts": ["host1"],
+      "Versions": {"stack_name": "HDP1", "stack_version": "2.0.6"}
+    }
+    self.assertEquals(actualRecommendLayoutResponse, expectedRecommendLayoutResponse)
+
+    # Test with maintenance_state. Both hosts are in maintenance mode.
+    hosts= {
+      "items": [
+        {"Hosts": {"host_name": "host1", "maintenance_state":"ON"}},
+        {"Hosts": {"host_name": "host2", "maintenance_state":"ON"}}
+      ]
+    }
+
+    actualRecommendLayoutResponse = default_stack_advisor.recommendComponentLayout(services, hosts)
+
+    expectedRecommendLayoutResponse = {
+      "Versions": {"stack_name": "HDP1", "stack_version": "2.0.6"},
+      "hosts": [],
+      "services": ['GANGLIA', 'HBASE', 'HDFS', 'PIG', 'TEZ', 'ZOOKEEPER'],
+      "recommendations": {
+        "blueprint": {
+          "host_groups": []
+        },
+        "blueprint_cluster_binding": {
+          "host_groups": []
+        }
+      }
+    }
+
+    self.assertEquals(actualRecommendLayoutResponse, expectedRecommendLayoutResponse)
+
     # Config groups support by default
     services["config-groups"] = [{
       "configurations": {


[2/2] ambari git commit: AMBARI-15815: Direct Ambari Upgrade from 2.0.1 to 2.4.x failed with error.

Posted by sm...@apache.org.
AMBARI-15815: Direct Ambari Upgrade from 2.0.1 to 2.4.x failed with error.


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b7ee8249
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b7ee8249
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b7ee8249

Branch: refs/heads/alerts
Commit: b7ee8249174b95de3af32087daa6453c0bf1a558
Parents: 54271dc
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Sat Apr 16 07:47:37 2016 -0700
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Sat Apr 16 07:47:37 2016 -0700

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog240.java       | 116 ++++++++++++++++++-
 1 file changed, 114 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b7ee8249/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
index 1a82698..b66ad66 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
@@ -23,6 +23,7 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -506,8 +507,12 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
             Integer multiplier = entry.getValue();
             String source = alertDefinition.getSource();
             Float oldValue = getParamFloatValue(source, paramName);
-            Integer newValue = Math.round(oldValue * multiplier);
-            alertDefinition.setSource(setParamIntegerValue(source, paramName, newValue));
+            if (oldValue == null) {
+              alertDefinition.setSource(addParam(source, Arrays.asList(paramName)));
+            } else {
+              Integer newValue = Math.round(oldValue * multiplier);
+              alertDefinition.setSource(setParamIntegerValue(source, paramName, newValue));
+            }
           }
         }
 
@@ -762,7 +767,114 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
       paramsToAdd.add(param);
 
     }
+    if (params.contains("minimum.free.space")) {
+      JsonObject param = new JsonObject();
+      param.add("name", new JsonPrimitive("minimum.free.space"));
+      param.add("display_name", new JsonPrimitive("Minimum Free Space"));
+      param.add("value", new JsonPrimitive("5000000000"));
+      param.add("type", new JsonPrimitive("NUMERIC"));
+      param.add("description", new JsonPrimitive("The overall amount of free disk space left before an alert is triggered."));
+      param.add("units", new JsonPrimitive("bytes"));
+      param.add("threshold", new JsonPrimitive("WARNING"));
+      paramsToAdd.add(param);
 
+    }
+    if (params.contains("percent.used.space.warning.threshold")) {
+      JsonObject param = new JsonObject();
+      param.add("name", new JsonPrimitive("percent.used.space.warning.threshold"));
+      param.add("display_name", new JsonPrimitive("Warning"));
+      param.add("value", new JsonPrimitive("50"));
+      param.add("type", new JsonPrimitive("PERCENT"));
+      param.add("description", new JsonPrimitive("The percent of disk space consumed before a warning is triggered."));
+      param.add("units", new JsonPrimitive("%"));
+      param.add("threshold", new JsonPrimitive("WARNING"));
+      paramsToAdd.add(param);
+
+    }
+    if (params.contains("percent.free.space.critical.threshold")) {
+      JsonObject param = new JsonObject();
+      param.add("name", new JsonPrimitive("percent.free.space.critical.threshold"));
+      param.add("display_name", new JsonPrimitive("Critical"));
+      param.add("value", new JsonPrimitive("80"));
+      param.add("type", new JsonPrimitive("PERCENT"));
+      param.add("description", new JsonPrimitive("The percent of disk space consumed before a critical alert is triggered."));
+      param.add("units", new JsonPrimitive("%"));
+      param.add("threshold", new JsonPrimitive("CRITICAL"));
+      paramsToAdd.add(param);
+
+    }
+    if (params.contains("request.by.status.warning.threshold")) {
+      JsonObject param = new JsonObject();
+      param.add("name", new JsonPrimitive("request.by.status.warning.threshold"));
+      param.add("display_name", new JsonPrimitive("Warning Request Time"));
+      param.add("value", new JsonPrimitive("3000"));
+      param.add("type", new JsonPrimitive("NUMERIC"));
+      param.add("description", new JsonPrimitive("The time to find requests in progress before a warning alert is triggered."));
+      param.add("units", new JsonPrimitive("ms"));
+      param.add("threshold", new JsonPrimitive("WARNING"));
+      paramsToAdd.add(param);
+
+    }
+    if (params.contains("request.by.status.critical.threshold")) {
+      JsonObject param = new JsonObject();
+      param.add("name", new JsonPrimitive("request.by.status.critical.threshold"));
+      param.add("display_name", new JsonPrimitive("Critical Request Time"));
+      param.add("value", new JsonPrimitive("5000"));
+      param.add("type", new JsonPrimitive("NUMERIC"));
+      param.add("description", new JsonPrimitive("The time to find requests in progress before a critical alert is triggered."));
+      param.add("units", new JsonPrimitive("ms"));
+      param.add("threshold", new JsonPrimitive("CRITICAL"));
+      paramsToAdd.add(param);
+
+    }
+    if (params.contains("task.status.aggregation.warning.threshold")) {
+      JsonObject param = new JsonObject();
+      param.add("name", new JsonPrimitive("task.status.aggregation.warning.threshold"));
+      param.add("display_name", new JsonPrimitive("Warning Process Time"));
+      param.add("value", new JsonPrimitive("3000"));
+      param.add("type", new JsonPrimitive("NUMERIC"));
+      param.add("description", new JsonPrimitive("The time to calculate a request's status from its tasks before a warning alert is triggered."));
+      param.add("units", new JsonPrimitive("ms"));
+      param.add("threshold", new JsonPrimitive("WARNING"));
+      paramsToAdd.add(param);
+
+    }
+    if (params.contains("task.status.aggregation.critical.threshold")) {
+      JsonObject param = new JsonObject();
+      param.add("name", new JsonPrimitive("task.status.aggregation.critical.threshold"));
+      param.add("display_name", new JsonPrimitive("Critical Process Time"));
+      param.add("value", new JsonPrimitive("5000"));
+      param.add("type", new JsonPrimitive("NUMERIC"));
+      param.add("description", new JsonPrimitive("The time to calculate a request's status from its tasks before a critical alert is triggered."));
+      param.add("units", new JsonPrimitive("ms"));
+      param.add("threshold", new JsonPrimitive("CRITICAL"));
+      paramsToAdd.add(param);
+
+    }
+    if (params.contains("rest.api.cluster.warning.threshold")) {
+      JsonObject param = new JsonObject();
+      param.add("name", new JsonPrimitive("rest.api.cluster.warning.threshold"));
+      param.add("display_name", new JsonPrimitive("Warning Response Time"));
+      param.add("value", new JsonPrimitive("5000"));
+      param.add("type", new JsonPrimitive("NUMERIC"));
+      param.add("description", new JsonPrimitive("The time to get a cluster via the REST API before a warning alert is triggered."));
+      param.add("units", new JsonPrimitive("ms"));
+      param.add("threshold", new JsonPrimitive("WARNING"));
+      paramsToAdd.add(param);
+
+    }
+    if (params.contains("rest.api.cluster.critical.threshold")) {
+      JsonObject param = new JsonObject();
+      param.add("name", new JsonPrimitive("rest.api.cluster.critical.threshold"));
+      param.add("display_name", new JsonPrimitive("Critical Response Time"));
+      param.add("value", new JsonPrimitive("7000"));
+      param.add("type", new JsonPrimitive("NUMERIC"));
+      param.add("description", new JsonPrimitive("The time to get a cluster via the REST API before a critical alert is triggered."));
+      param.add("units", new JsonPrimitive("ms"));
+      param.add("threshold", new JsonPrimitive("CRITICAL"));
+      paramsToAdd.add(param);
+
+    }
 
     if (!parameterExists) {
       parametersJson = new JsonArray();