AMBARI-15063 : Metrics monitor fails on restart (avijayan)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d412ca11 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d412ca11 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d412ca11 Branch: refs/heads/branch-dev-patch-upgrade Commit: d412ca11c8347fb89e7a5318c72a7dc24d0c2ff9 Parents: 21fd70c Author: Aravindan Vijayan <avija...@hortonworks.com> Authored: Tue Feb 16 14:41:00 2016 -0800 Committer: Aravindan Vijayan <avija...@hortonworks.com> Committed: Tue Feb 16 14:41:00 2016 -0800 ---------------------------------------------------------------------- .../conf/unix/ambari-metrics-monitor | 6 +++--- .../conf/unix/ambari-metrics-collector | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/d412ca11/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 815b3e4..aa4ae02 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 -o pid | grep ${PID}`" ]; then + if [ -z "`ps ax -o pid | grep -w ${PID} | grep resource_monitoring`" ]; then echo "${PIDFILE} found with no process. Removing ${PID}..." rm -f ${PIDFILE} else @@ -152,7 +152,7 @@ case "$1" in sleep 2 echo "Verifying ${METRIC_MONITOR} process status..." - if [ -z "`ps ax -o pid | grep ${PID}`" ]; then + if [ -z "`ps ax -o pid | grep -w ${PID} | grep resource_monitoring`" ]; then if [ -s ${OUTFILE} ]; then echo "ERROR: ${METRIC_MONITOR} start failed. For more details, see ${OUTFILE}:" echo "====================" @@ -173,7 +173,7 @@ case "$1" in if [ -f ${PIDFILE} ]; then PID=`cat ${PIDFILE}` echo "Found ${METRIC_MONITOR} PID: $PID" - if [ -z "`ps ax -o pid | grep ${PID}`" ]; then + if [ -z "`ps ax -o pid | grep -w ${PID} | grep resource_monitoring`" ]; then echo "${METRIC_MONITOR} not running. Stale PID File at: $PIDFILE" retcode=2 else http://git-wip-us.apache.org/repos/asf/ambari/blob/d412ca11/ambari-metrics/ambari-metrics-timelineservice/conf/unix/ambari-metrics-collector ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/conf/unix/ambari-metrics-collector b/ambari-metrics/ambari-metrics-timelineservice/conf/unix/ambari-metrics-collector index f83af50..e319d73 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/conf/unix/ambari-metrics-collector +++ b/ambari-metrics/ambari-metrics-timelineservice/conf/unix/ambari-metrics-collector @@ -267,7 +267,7 @@ function start() sleep 2 echo "Verifying ${METRIC_COLLECTOR} process status..." | tee -a $STARTUPFILE - if [ -z "`ps ax -o pid | grep ${PID}`" ]; then + if [ -z "`ps ax | grep -w ${PID} | grep ApplicationHistoryServer`" ]; then if [ -s ${OUTFILE} ]; then echo "ERROR: ${METRIC_COLLECTOR} start failed. For more details, see ${OUTFILE}:" | tee -a $STARTUPFILE echo "===================="