You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2015/01/22 22:34:05 UTC
ambari git commit: AMBARI-9278. Allow hostname customization for
metric monitor. Use agent conf. (swagle)
Repository: ambari
Updated Branches:
refs/heads/trunk 08738a55d -> af5372656
AMBARI-9278. Allow hostname customization for metric monitor. Use agent conf. (swagle)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/af537265
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/af537265
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/af537265
Branch: refs/heads/trunk
Commit: af5372656b9679b10e2792da8dd0ca4510ba1962
Parents: 08738a5
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Thu Jan 22 13:26:29 2015 -0800
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Thu Jan 22 13:33:50 2015 -0800
----------------------------------------------------------------------
.../src/main/python/core/config_reader.py | 16 ++++++++++++++--
.../src/main/python/core/host_info.py | 1 -
2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/af537265/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
index f43f512..62a5f16 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
@@ -61,7 +61,6 @@ class ConfigDefaultsLinux(ConfigDefaults):
configDefaults = ConfigDefaults()
-
config = ConfigParser.RawConfigParser()
CONFIG_FILE_PATH = configDefaults.get_config_file_path()
@@ -84,6 +83,8 @@ STOP_ACTION = "stop"
RESTART_ACTION = "restart"
STATUS_ACTION = "status"
+AMBARI_AGENT_CONF = '/etc/ambari-agent/conf/ambari-agent.ini'
+
config_content = """
[default]
debug_level = INFO
@@ -139,6 +140,7 @@ metric_group_info = """
}
"""
+
class Configuration:
def __init__(self):
@@ -160,6 +162,13 @@ class Configuration:
}
pass
+ self.hostname_script = None
+ ambari_agent_config = ConfigParser.RawConfigParser()
+ if os.path.exists(AMBARI_AGENT_CONF):
+ ambari_agent_config.read(AMBARI_AGENT_CONF)
+ self.hostname_script = ambari_agent_config.get('agent', 'hostname_script')
+ pass
+
def getConfig(self):
return self.config
@@ -183,7 +192,10 @@ class Configuration:
return self.get("default", "metrics_server")
def get_hostname_script(self):
- return self.get("default", "hostname_script")
+ if self.hostname_script:
+ return self.hostname_script
+ else:
+ return self.get("default", "hostname_script")
def get_log_level(self):
return self.get("default", "debug_level", "INFO")
http://git-wip-us.apache.org/repos/asf/ambari/blob/af537265/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
index 37c55cb..caa972c 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
@@ -23,7 +23,6 @@ import psutil
import os
from collections import namedtuple
import platform
-import socket
import time
import threading
import socket