AMBARI-14799 Metric Monitor crashes with NoSuchProcess exception (dsen)

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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 34bbd8b458fd0bf01345abbeffd2906cc72c371b
Parents: d1e5913
Author: Dmytro Sen <d...@apache.org>
Authored: Wed Jan 27 14:06:18 2016 +0200
Committer: Dmytro Sen <d...@apache.org>
Committed: Wed Jan 27 14:06:18 2016 +0200

----------------------------------------------------------------------
 .../src/main/python/core/host_info.py                        | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/34bbd8b4/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 d5a8c36..2e8c442 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
@@ -90,8 +90,12 @@ class HostInfo():
     proc_total = 0
     for proc in proc_stats:
       proc_total += 1
-      if STATUS_RUNNING == proc.status():
-        proc_run += 1
+      try:
+        if STATUS_RUNNING == proc.status():
+          proc_run += 1
+      except (psutil.NoSuchProcess, psutil.AccessDenied) as e:
+        #NOP
+        pass
     pass
 
     return {

Reply via email to