AMBARI-19243 : Metric monitor start command failed though the process started successfully. (avijayan)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6da5935b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6da5935b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6da5935b Branch: refs/heads/branch-dev-patch-upgrade Commit: 6da5935bdffee119909741637f8404f7f807f7ec Parents: 8a125c5 Author: Aravindan Vijayan <[email protected]> Authored: Mon Dec 19 13:16:54 2016 -0800 Committer: Aravindan Vijayan <[email protected]> Committed: Mon Dec 19 13:16:54 2016 -0800 ---------------------------------------------------------------------- .../conf/unix/ambari-metrics-monitor | 9 +++++---- .../src/main/python/core/host_info.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6da5935b/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/ambari-metrics-monitor ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/ambari-metrics-monitor b/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/ambari-metrics-monitor index 220d533..967e133 100644 --- a/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/ambari-metrics-monitor +++ b/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/ambari-metrics-monitor @@ -131,7 +131,7 @@ case "$1" in echo "Checking for previously running Metric Monitor..." if [ -f ${PIDFILE} ]; then PID=`cat ${PIDFILE}` - if [ -z "`ps ax | grep -w ${PID} | grep resource_monitoring`" ]; then + if [ -z "`ps ax -o pid | grep -w ${PID}`" ]; then echo "${PIDFILE} found with no process. Removing ${PID}..." rm -f ${PIDFILE} else @@ -151,8 +151,9 @@ case "$1" in sleep 2 - echo "Verifying ${METRIC_MONITOR} process status..." - if [ -z "`ps ax | grep -w ${PID} | grep resource_monitoring`" ]; then + echo "Verifying ${METRIC_MONITOR} process status with PID : ${PID}" + if [ -z "`ps ax -o pid | grep -w ${PID}`" ]; then + echo "Output of PID check : `ps ax -o pid | grep -w ${PID}`" if [ -s ${OUTFILE} ]; then echo "ERROR: ${METRIC_MONITOR} start failed. For more details, see ${OUTFILE}:" echo "====================" @@ -173,7 +174,7 @@ case "$1" in if [ -f ${PIDFILE} ]; then PID=`cat ${PIDFILE}` echo "Found ${METRIC_MONITOR} PID: $PID" - if [ -z "`ps ax | grep -w ${PID} | grep resource_monitoring`" ]; then + if [ -z "`ps ax -o pid | grep -w ${PID}`" ]; then echo "${METRIC_MONITOR} not running. Stale PID File at: $PIDFILE" retcode=2 else http://git-wip-us.apache.org/repos/asf/ambari/blob/6da5935b/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 7992cff..90f73fa 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 @@ -191,7 +191,7 @@ class HostInfo(): try: usage = psutil.disk_usage(part.mountpoint) except Exception, e: - logger.error('Failed to read disk_usage for a mountpoint : ' + str(e)) + logger.debug('Failed to read disk_usage for a mountpoint : ' + str(e)) continue if part.device in devices: # Skip devices already seen.
