Repository: ambari
Updated Branches:
  refs/heads/trunk 50ee8e029 -> 9f2eb9f16


AMBARI-9503 AMS monitor alert failing on Windows

Implemented the Windows-specific Monitor service status check


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

Branch: refs/heads/trunk
Commit: 9f2eb9f16210bec63166816732d071afc8675192
Parents: 50ee8e0
Author: Florian Barca <fba...@hortonworks.com>
Authored: Thu Feb 5 16:06:10 2015 -0800
Committer: Florian Barca <fba...@hortonworks.com>
Committed: Thu Feb 5 16:06:10 2015 -0800

----------------------------------------------------------------------
 .../0.1.0/package/alerts/alert_ambari_metrics_monitor.py  | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9f2eb9f1/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/alerts/alert_ambari_metrics_monitor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/alerts/alert_ambari_metrics_monitor.py
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/alerts/alert_ambari_metrics_monitor.py
index 40f8c60..a9eb6fa 100644
--- 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/alerts/alert_ambari_metrics_monitor.py
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/alerts/alert_ambari_metrics_monitor.py
@@ -21,6 +21,8 @@ limitations under the License.
 import os
 import socket
 
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 from resource_management.libraries.functions.check_process_status import 
check_process_status
 from resource_management.core.exceptions import ComponentIsNotRunning
 
@@ -38,6 +40,14 @@ def get_tokens():
   return (AMS_MONITOR_PID_DIR,)
 
 
+@OsFamilyFuncImpl(OSConst.WINSRV_FAMILY)
+def is_monitor_process_live(pid_file):
+  from ambari_commons.os_windows import WinServiceController, 
SERVICE_STATUS_RUNNING
+
+  svcStatus = WinServiceController.QueryStatus("AmbariMetricsHostMonitoring")
+  return (SERVICE_STATUS_RUNNING == svcStatus)
+
+@OsFamilyFuncImpl(OsFamilyImpl.DEFAULT)
 def is_monitor_process_live(pid_file):
   """
   Gets whether the AMS monitor represented by the specified file is running.

Reply via email to