You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2017/06/06 10:57:59 UTC

[1/2] ambari git commit: AMBARI-21182. Agent Host Disk Usage Alert Hardcodes the Stack Directory (aonishuk)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 9496c0170 -> 533ec274c
  refs/heads/trunk 4dba161a6 -> 119d2624f


AMBARI-21182. Agent Host Disk Usage Alert Hardcodes the Stack Directory (aonishuk)


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

Branch: refs/heads/trunk
Commit: 119d2624f96d66c9a4d5d559ca436de73adae444
Parents: 4dba161
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Jun 6 13:57:52 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Jun 6 13:57:52 2017 +0300

----------------------------------------------------------------------
 .../resources/host_scripts/alert_disk_space.py  | 22 +++++++-------------
 1 file changed, 8 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/119d2624/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/host_scripts/alert_disk_space.py b/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
index d2b4f36..4c5834f 100644
--- a/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
+++ b/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
@@ -36,18 +36,14 @@ MIN_FREE_SPACE_DEFAULT = 5000000000L
 PERCENT_USED_WARNING_DEFAULT = 50
 PERCENT_USED_CRITICAL_DEFAULT = 80
 
-# the location where HDP installs components when using HDP 2.2+
-STACK_HOME_DIR = "/usr/hdp"
-
-# the location where HDP installs components when using HDP 2.0 to 2.1
-STACK_HOME_LEGACY_DIR = "/usr/lib"
+STACK_ROOT = '{{cluster-env/stack_root}}'
 
 def get_tokens():
   """
   Returns a tuple of tokens in the format {{site/property}} that will be used
   to build the dictionary passed into execute
   """
-  return None
+  return (STACK_ROOT, )
 
 
 @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
@@ -65,15 +61,13 @@ def execute(configurations={}, parameters={}, host_name=None):
   host_name (string): the name of this host where the alert is running
   """
 
-  # determine the location of HDP home
-  stack_home = None
-  if os.path.isdir(STACK_HOME_DIR):
-    stack_home = STACK_HOME_DIR
-  elif os.path.isdir(STACK_HOME_LEGACY_DIR):
-    stack_home = STACK_HOME_LEGACY_DIR
+  if configurations is None:
+    return (('UNKNOWN', ['There were no configurations supplied to the script.']))
+
+  if not STACK_ROOT in configurations:
+    return (('STACK_ROOT', ['cluster-env/stack_root is not specified']))
 
-  # if stack home was found, use it; otherwise default to None
-  path = stack_home if stack_home is not None else None
+  path = configurations[STACK_ROOT]
 
   try:
     disk_usage = _get_disk_usage(path)


[2/2] ambari git commit: AMBARI-21182. Agent Host Disk Usage Alert Hardcodes the Stack Directory (aonishuk)

Posted by ao...@apache.org.
AMBARI-21182. Agent Host Disk Usage Alert Hardcodes the Stack Directory (aonishuk)


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

Branch: refs/heads/branch-2.5
Commit: 533ec274c271626c4d38e3b9e236deaa6cbc17a9
Parents: 9496c01
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Jun 6 13:57:56 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Jun 6 13:57:56 2017 +0300

----------------------------------------------------------------------
 .../resources/host_scripts/alert_disk_space.py  | 22 +++++++-------------
 1 file changed, 8 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/533ec274/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/host_scripts/alert_disk_space.py b/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
index d2b4f36..4c5834f 100644
--- a/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
+++ b/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
@@ -36,18 +36,14 @@ MIN_FREE_SPACE_DEFAULT = 5000000000L
 PERCENT_USED_WARNING_DEFAULT = 50
 PERCENT_USED_CRITICAL_DEFAULT = 80
 
-# the location where HDP installs components when using HDP 2.2+
-STACK_HOME_DIR = "/usr/hdp"
-
-# the location where HDP installs components when using HDP 2.0 to 2.1
-STACK_HOME_LEGACY_DIR = "/usr/lib"
+STACK_ROOT = '{{cluster-env/stack_root}}'
 
 def get_tokens():
   """
   Returns a tuple of tokens in the format {{site/property}} that will be used
   to build the dictionary passed into execute
   """
-  return None
+  return (STACK_ROOT, )
 
 
 @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
@@ -65,15 +61,13 @@ def execute(configurations={}, parameters={}, host_name=None):
   host_name (string): the name of this host where the alert is running
   """
 
-  # determine the location of HDP home
-  stack_home = None
-  if os.path.isdir(STACK_HOME_DIR):
-    stack_home = STACK_HOME_DIR
-  elif os.path.isdir(STACK_HOME_LEGACY_DIR):
-    stack_home = STACK_HOME_LEGACY_DIR
+  if configurations is None:
+    return (('UNKNOWN', ['There were no configurations supplied to the script.']))
+
+  if not STACK_ROOT in configurations:
+    return (('STACK_ROOT', ['cluster-env/stack_root is not specified']))
 
-  # if stack home was found, use it; otherwise default to None
-  path = stack_home if stack_home is not None else None
+  path = configurations[STACK_ROOT]
 
   try:
     disk_usage = _get_disk_usage(path)