Bläddra i källkod

AMBARI-3266. Contribute Ambari-SCOM. (Tom Beerbower via mahadev)

Mahadev Konar 11 år sedan
förälder
incheckning
873b3502be
100 ändrade filer med 11412 tillägg och 0 borttagningar
  1. 26 0
      LICENSE.txt
  2. 2 0
      NOTICE.txt
  3. 11 0
      contrib/ambari-scom/.gitignore
  4. 65 0
      contrib/ambari-scom/README.md
  5. 97 0
      contrib/ambari-scom/ambari-scom-server/Ambari-SCOM-install-instructions.md
  6. 28 0
      contrib/ambari-scom/ambari-scom-server/conf/ambari.properties
  7. 123 0
      contrib/ambari-scom/ambari-scom-server/pom.xml
  8. 29 0
      contrib/ambari-scom/ambari-scom-server/src/assembly/conf.xml
  9. 29 0
      contrib/ambari-scom/ambari-scom-server/src/assembly/lib.xml
  10. 274 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/AbstractResourceProvider.java
  11. 59 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/BaseResourceProvider.java
  12. 545 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterDefinition.java
  13. 79 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterProvider.java
  14. 102 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ComponentProvider.java
  15. 112 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/HostComponentProvider.java
  16. 111 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/HostProvider.java
  17. 67 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/NoOpProvider.java
  18. 68 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/RequestProvider.java
  19. 95 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ServiceProvider.java
  20. 65 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/StateProvider.java
  21. 92 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/TaskProvider.java
  22. 449 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/AmbariServer.java
  23. 176 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/ClusterDefinitionProvider.java
  24. 63 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/HostInfoProvider.java
  25. 304 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SQLPropertyProvider.java
  26. 332 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SQLProviderModule.java
  27. 120 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SinkConnectionFactory.java
  28. 185 0
      contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/logging/JpaLogger.java
  29. 46 0
      contrib/ambari-scom/ambari-scom-server/src/main/resources/META-INF/spring-security.xml
  30. 37 0
      contrib/ambari-scom/ambari-scom-server/src/main/resources/log4j.properties
  31. 118 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ClusterDefinitionTest.java
  32. 99 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ClusterProviderTest.java
  33. 124 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ComponentProviderTest.java
  34. 165 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/HostComponentProviderTest.java
  35. 157 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/HostProviderTest.java
  36. 47 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/NoOpProviderTest.java
  37. 80 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/RequestProviderTest.java
  38. 168 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ServiceProviderTest.java
  39. 80 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/TaskProviderTest.java
  40. 73 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/TestStateProvider.java
  41. 83 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/ClusterDefinitionProviderTest.java
  42. 442 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/SQLPropertyProviderTest.java
  43. 51 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/SQLProviderModuleTest.java
  44. 68 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/SinkConnectionFactoryTest.java
  45. 30 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/TestClusterDefinitionProvider.java
  46. 58 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/TestHostInfoProvider.java
  47. 163 0
      contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/logging/JpaLoggerTest.java
  48. 34 0
      contrib/ambari-scom/ambari-scom-server/src/test/resources/ambari.properties
  49. 47 0
      contrib/ambari-scom/ambari-scom-server/src/test/resources/clusterproperties.txt
  50. 21 0
      contrib/ambari-scom/ambari-scom-server/src/test/resources/log4j.properties
  51. 35 0
      contrib/ambari-scom/management-pack/Hadoop_MP/BUILDING.md
  52. 161 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp.sln
  53. 63 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/AmbariAccessorRole.mpx
  54. 66 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/AmbariEntity.mpx
  55. 76 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/AmbariSeed.mpx
  56. 55 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/AmbariWatcherNode.mpx
  57. 94 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/Cluster.mpx
  58. 65 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/ClusterHardwareProjection.mpx
  59. 37 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/ClusterProjection.mpx
  60. 189 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/ClusterService.mpx
  61. 66 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/ClusterSoftwareProjection.mpx
  62. 46 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/ClustersGroup.mpx
  63. 87 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/Host.mpx
  64. 159 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/HostComponent.mpx
  65. 62 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Discoveries/ClustersGroupPopulator.mpx
  66. 73 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Discoveries/HostComponentsDiscovery.mpx
  67. 773 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/HadoopMp.mpproj
  68. 28 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/HadoopMp.mpproj.user
  69. 116 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Images/Icons.mpx
  70. 29 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/ManagementPack.mpx
  71. 102 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/ConditionDetections/PropertyBagMultiplePerformanceDataMapper.mpx
  72. 88 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/ConditionDetections/PropertyBagPerformanceDataMapper.mpx
  73. 87 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/AmbariSeedDiscoveryDataSource.mpx
  74. 102 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/ClusterServicesDiscoveryDataSource.mpx
  75. 117 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/ClustersDiscoveryDataSource.mpx
  76. 107 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/HostComponentsDiscoveryDataSource.mpx
  77. 102 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/HostsDiscoveryDataSource.mpx
  78. 85 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/PowerShellDiscoveryDataSource.mpx
  79. 80 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/Scripts/ClusterServicesDiscovery.ps1
  80. 92 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/Scripts/ClustersDiscovery.ps1
  81. 134 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/Scripts/HostComponentsDiscovery.ps1
  82. 64 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/Scripts/HostsDiscovery.ps1
  83. 94 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/BaseScriptedPropertyBagDataSource.mpx
  84. 102 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/ClusterServiceMetricsDataSource.mpx
  85. 72 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/HdfsServiceMetricsDataSource.mpx
  86. 81 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/HdfsServiceMetricsPerformanceDataSource.mpx
  87. 87 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/HostComponentHealthStateDataSource.mpx
  88. 86 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/HostComponentMetricsDataSource.mpx
  89. 81 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/HostComponentMetricsPerformanceDataSource.mpx
  90. 72 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/MapReduceServiceMetricsDataSource.mpx
  91. 81 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/MapReduceServiceMetricsPerformanceDataSource.mpx
  92. 95 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/Scripts/HdfsServiceMetrics.ps1
  93. 29 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/Scripts/HostComponentHealthState.ps1
  94. 53 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/Scripts/HostComponentMetrics.ps1
  95. 62 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/Scripts/MapReduceServiceMetrics.ps1
  96. 68 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/ProbeActions/ImpersonatedPowerShellPropertyBagProbe.mpx
  97. 332 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/MonitorTypes/HdfsServiceThreeStateThresholdMonitorType.mpx
  98. 214 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/MonitorTypes/HdfsServiceTwoStateThresholdMonitorType.mpx
  99. 132 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/MonitorTypes/HostComponentHealthStateMonitorType.mpx
  100. 332 0
      contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/MonitorTypes/HostComponentThreeStateThresholdMonitorType.mpx

+ 26 - 0
LICENSE.txt

@@ -260,3 +260,29 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+For some parts of contrib/ambari-scom:
+
+Microsoft Public License (MS-PL)
+[OSI Approved License]
+
+This license governs use of the accompanying software. If you use the software, you
+accept this license. If you do not accept the license, do not use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
+same meaning here as under U.S. copyright law.
+A "contribution" is the original software, or any additions or changes to the software.
+A "contributor" is any person that distributes its contribution under this license.
+"Licensed patents" are a contributor's patent claims that read directly on its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
+(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
+

+ 2 - 0
NOTICE.txt

@@ -8,3 +8,5 @@ Component ambari-common/src/test/python are under the following copyright:
 
 Copyright (c) 2003-2012, Michael Foord
 All rights reserved.
+
+

+ 11 - 0
contrib/ambari-scom/.gitignore

@@ -0,0 +1,11 @@
+.classpath
+.project
+.settings
+.idea/
+.iml/
+target
+*.iml
+pass.txt
+.DS_Store
+
+

+ 65 - 0
contrib/ambari-scom/README.md

@@ -0,0 +1,65 @@
+<!---
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+Ambari SCOM Management Pack
+============
+
+The *Ambari SCOM Management Pack* gives insight into the performance and health of an Apache Hadoop cluster to users of
+Microsoft System Center Operations Manager (SCOM). *Ambari SCOM* integrates with the Ambari REST API which aggregates and exposes cluster information and metrics.
+
+## Documentation
+
+Look for *Ambari SCOM* documentation on the [Apache Ambari Wiki](https://cwiki.apache.org/confluence/display/AMBARI/Ambari+SCOM+Management+Pack). Please also visit the [Apache Ambari Project](http://incubator.apache.org/ambari/) page for more information.
+
+## License
+
+*Ambari SCOM* is released under [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
+
+## Issue Tracking
+
+Report any issues via the [Ambari JIRA](https://issues.apache.org/jira/browse/AMBARI) using component `Ambari-SCOM`.
+
+## Build
+
+####Ambari-SCOM and Metrics Sink
+
+######Requirements
+* JDK 1.6
+* Maven 3.0
+    
+######Maven modules
+* ambari-scom-project (Parent POM for all modules)
+  * ambari-scom (ambari MSI and SQL Server provider)
+  * metrics-sink (Metrics SQL Server sink)       
+  
+######Maven build goals
+ * Clean : mvn clean
+ * Compile : mvn compile
+ * Run tests : mvn test 
+ * Create JAR : mvn package
+ * Install JAR in M2 cache : mvn install     
+    
+######Tests options
+  * -DskipTests to skip tests when running the following Maven goals:
+    'package', 'install', 'deploy' or 'verify'
+  * -Dtest=\<TESTCLASSNAME>,\<TESTCLASSNAME#METHODNAME>,....
+  * -Dtest.exclude=\<TESTCLASSNAME>
+  * -Dtest.exclude.pattern=\*\*/\<TESTCLASSNAME1>.java,\*\*/\<TESTCLASSNAME2>.java
+
+####Management Pack
+
+See [Building the Management Pack](management-pack/Hadoop_MP/BUILDING.md) for more information.
+
+

+ 97 - 0
contrib/ambari-scom/ambari-scom-server/Ambari-SCOM-install-instructions.md

@@ -0,0 +1,97 @@
+<!---
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+Instructions to setup ambari-scom
+======
+
+
+###Setup the HadoopMonitoring database
+
+
+1. Setup SQLServer for mixed mode authentication (the metrics2 sink and Ambari metrics provider will connect through SQLServer authentication).
+2. Create SQLServer login and password (or use the default sa login)
+3. Use SQLServer Configuration Manager to make sure that TCP/IP is active and enabled (note the port : default 1433).
+4. Run the DDL script from the ambari-scom project to create the HadoopMoitoring database.  The script should be available as **db/MonitoringDatabase.sql** in the ambari-scom project folder.
+5. Download the SqlServer JDBC driver jar **(sqljdbc4.jar)** from [here](http://msdn.microsoft.com/en-us/data/aa937724.aspx).
+
+###Install Hadoop and SQLServerSink
+
+
+1. Follow the hadoop install instructions [here](http://docs.hortonworks.com/HDPDocuments/HDP1/HDP-Win-1.3.0/index.html), making sure you download the 1.3 MSI.
+2. Note the location of the **clusterproperties.txt** configuration file.
+3. Setup Metrics2 SqlServerSink by editing the **hadoop-metrics2.properties** file in the hadoop bin folder (e.g. C:\HDP\hadoop-1.2.0.1.3.0.0-0380\bin\hadoop-metrics2.properties).  
+Note that this step should be repeated on each node of the cluster installed above.  Set the following properties…
+
+        *.sink.sql.class=org.apache.hadoop.metrics2.sink.SqlServerSink
+
+        namenode.sink.sql.databaseUrl=jdbc:sqlserver://[server]:[port];databaseName=HadoopMonitoring;user=[user];password=[password]
+        datanode.sink.sql.databaseUrl=jdbc:sqlserver://[server]:[port];databaseName=HadoopMonitoring;user=[user];password=[password]
+        jobtracker.sink.sql.databaseUrl=jdbc:sqlserver://[server]:[port];databaseName=HadoopMonitoring;user=[user];password=[password]
+        tasktracker.sink.sql.databaseUrl=jdbc:sqlserver://[server]:[port];databaseName=HadoopMonitoring;user=[user];password=[password]
+        maptask.sink.sql.databaseUrl=jdbc:sqlserver://[server]:[port];databaseName=HadoopMonitoring;user=[user];password=[password]
+        reducetask.sink.sql.databaseUrl=jdbc:sqlserver://[server]:[port];databaseName=HadoopMonitoring;user=[user];password=[password]
+
+   Note that the server, port, user and password should work with the SQLServer install from above 
+   (e.g. jdbc:sqlserver://ambari1:1433;databaseName=HadoopMonitoring;user=sa;password=BigData1).
+4. Copy the SqlServer JDBC driver jar and the ambari-scom jar to each node of the cluster.
+5. Set ambari-scom jar and SQLServer driver jar in class path by editing the class path in the **namenode.xml, datanode.xml, jobtracker.xml, tasktracker.xml and other component xml files** of the hadoop bin folder (e.g. C:\HDP\hadoop-1.2.0.1.3.0.0-0380\bin\namenode xml).  
+Note that this step should be repeated on each node of the cluster.  In each file prepend the following to -classpath… 
+  
+        [path to ambari-scom jar];[path to SqlServer JDBC jar]; 
+For example, '-classpath C:\ambari-scom\target\ambari-scom-1.0.jar;C:\hadoop\sqljdbc4.jar;…'.
+
+6. Start (or restart) Hadoop by using the scripts in the HDP install folder to start the services as directed by the link in step 1.
+
+        C:\HDP>start_local_hdp_services.cmd
+       
+7. Check to see that metrics are being directed to the SQLServer database by querying the records table. 
+
+        select * from HadoopMonitoring.dbo.MetricRecord
+   The table should not be empty.
+
+
+###Run AmbariServer
+
+
+1. Edit the **ambari.properties** file from the ambari-scom project (ambari-scom/config/ambari.properties or unzip target/ambari-scom-1.0-conf.zip to desired location).  Add the following properties ...
+
+        scom.sink.db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
+        scom.sink.db.url=jdbc:sqlserver://[server]:[port];databaseName=HadoopMonitoring;user=[user];password=[password]
+    Note that the server, port, user and password should work with the SQLServer install from above (e.g. jdbc:sqlserver://ambari1:1433;databaseName=HadoopMonitoring;user=sa;password=BigData1).
+
+2. Use java to run the ambari server **(org.apache.ambari.scom.AmbariServer)** from a Windows command prompt.  Include the following in the classpath ...
+
+   * the folder containing the **ambari.properties** file (see step #1).
+   * the folder containing the **clusterproperties.txt** file from the hadoop install.
+   * the SqlServer JDBC jar **(sqljdbc4.jar)** from the steps above.
+   * the ambari-scom jar from the ambari-scom build target.
+   * the lib folder containing the dependency jars from the ambari-scom build target.
+   
+
+   The command should look something like this ...
+    
+        java -server -XX:NewRatio=3 -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -XX:CMSInitiatingOccupancyFraction=60 -Xms512m -Xmx2048m -cp "c:\ambari-scom\conf;c:\hadoop\sqljdbc4.jar;c:\ambari-scom\target\ambari-scom-1.0.jar;c:\ambari-scom\target\lib\*" org.apache.ambari.scom.AmbariServer
+
+
+###Test the API
+
+
+1. From a browser access the API...
+  
+        http://[server]:8080/api/v1/clusters
+
+2. Verify that metrics are being reported…
+
+        http://[server]:8080/api/v1/clusters/ambari/services/HDFS/components/NAMENODE

+ 28 - 0
contrib/ambari-scom/ambari-scom-server/conf/ambari.properties

@@ -0,0 +1,28 @@
+#
+# Copyright 2011 The Apache Software Foundation
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+
+server.connection.max.idle.millis=900000
+api.authenticate=false
+server.os_type=windows2012
+server.persistence.type=in-memory
+security.passwords.encryption.enabled=false
+scom.sink.db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
+scom.sink.db.url=jdbc:sqlserver://[server]:[port];databaseName=[databaseName];user=[user];password=[password]

+ 123 - 0
contrib/ambari-scom/ambari-scom-server/pom.xml

@@ -0,0 +1,123 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.ambari</groupId>
+        <artifactId>ambari-scom-project</artifactId>
+        <version>0.9.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>ambari-scom-server</artifactId>
+    <packaging>jar</packaging>
+    <name>Ambari SCOM Server</name>
+    <url>http://maven.apache.org</url>
+    <properties>
+        <ambari.version>1.3.0-SNAPSHOT</ambari.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <version>3.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ambari</groupId>
+            <artifactId>ambari-server</artifactId>
+            <version>${ambari.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-server</artifactId>
+            <version>1.8</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>2.12</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>rpm-maven-plugin</artifactId>
+                <version>2.0.1</version>
+                <executions>
+                    <execution>
+                        <phase>none</phase>
+                        <goals>
+                            <goal>rpm</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>2.1</version>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
+                            <overWriteReleases>false</overWriteReleases>
+                            <overWriteSnapshots>false</overWriteSnapshots>
+                            <overWriteIfNewer>true</overWriteIfNewer>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <descriptors>
+                        <descriptor>src/assembly/lib.xml</descriptor>
+                        <descriptor>src/assembly/conf.xml</descriptor>
+                    </descriptors>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>make-assembly</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>attached</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 29 - 0
contrib/ambari-scom/ambari-scom-server/src/assembly/conf.xml

@@ -0,0 +1,29 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<assembly>
+    <id>conf</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>conf/</directory>
+            <outputDirectory>conf</outputDirectory>
+        </fileSet>
+    </fileSets>
+</assembly>

+ 29 - 0
contrib/ambari-scom/ambari-scom-server/src/assembly/lib.xml

@@ -0,0 +1,29 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<assembly>
+    <id>lib</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>target/lib/</directory>
+            <outputDirectory>lib</outputDirectory>
+        </fileSet>
+    </fileSets>
+</assembly>

+ 274 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/AbstractResourceProvider.java

@@ -0,0 +1,274 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.server.controller.internal.RequestStatusImpl;
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
+import org.apache.ambari.server.controller.spi.NoSuchResourceException;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.RequestStatus;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
+import org.apache.ambari.server.controller.spi.ResourceProvider;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
+import org.apache.ambari.server.controller.utilities.PredicateHelper;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * An abstract resource provider for a MSI defined cluster.
+ */
+public abstract class AbstractResourceProvider implements ResourceProvider {
+
+  private final ClusterDefinition clusterDefinition;
+
+  private final Resource.Type type;
+
+  private final Set<String> propertyIds;
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  /**
+   * Construct a resource provider based on the given cluster definition.
+   *
+   * @param clusterDefinition  the cluster definition
+   */
+  public AbstractResourceProvider(Resource.Type type, ClusterDefinition clusterDefinition) {
+    this.type              = type;
+    this.clusterDefinition = clusterDefinition;
+
+    Set<String> propertyIds = PropertyHelper.getPropertyIds(type);
+    this.propertyIds = new HashSet<String>(propertyIds);
+    this.propertyIds.addAll(PropertyHelper.getCategories(propertyIds));
+  }
+
+
+  // ----- ResourceProvider --------------------------------------------------
+
+  @Override
+  public RequestStatus createResources(Request request)
+      throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException {
+    throw new UnsupportedOperationException("Management operations are not supported");
+  }
+
+  @Override
+  public Set<Resource> getResources(Request request, Predicate predicate)
+      throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
+
+    Set<Resource> resultSet = new HashSet<Resource>();
+
+    for (Resource resource : getResources()) {
+      if (predicate == null || predicate.evaluate(resource)) {
+        ResourceImpl newResource = new ResourceImpl(resource);
+        updateProperties(newResource, request, predicate);
+        resultSet.add(newResource);
+      }
+    }
+    return resultSet;
+  }
+
+  @Override
+  public RequestStatus updateResources(Request request, Predicate predicate)
+      throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
+
+    Set<Resource> resources = getResources(request, predicate);
+
+    Integer requestId = -1;
+
+    Iterator<Map<String,Object>> iterator = request.getProperties().iterator();
+    if (iterator.hasNext()) {
+      Map<String, Object> properties = iterator.next();
+
+      for (Resource resource : resources) {
+        requestId = updateProperties(resource, properties);
+      }
+    }
+    return getRequestStatus(requestId == -1 ? null : requestId);
+  }
+
+  @Override
+  public RequestStatus deleteResources(Predicate predicate)
+      throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
+    throw new UnsupportedOperationException("Management operations are not supported");
+  }
+
+  @Override
+  public Map<Resource.Type, String> getKeyPropertyIds() {
+    return PropertyHelper.getKeyPropertyIds(type);
+  }
+
+  @Override
+  public Set<String> checkPropertyIds(Set<String> propertyIds) {
+    propertyIds = new HashSet<String>(propertyIds);
+    propertyIds.removeAll(this.propertyIds);
+    return propertyIds;
+  }
+
+
+  // ----- AbstractResourceProvider ------------------------------------------
+
+  /**
+   * Get the set of resources for this provider.
+   *
+   * @return the set of resources
+   */
+  abstract protected Set<Resource> getResources();
+
+  /**
+   * Update the resource with any properties handled by the resource provider.
+   *
+   * @param resource   the resource to update
+   * @param request    the request
+   * @param predicate  the predicate
+   */
+  public abstract void updateProperties(Resource resource, Request request, Predicate predicate);
+
+  /**
+   * Update the resource with the given properties.
+   *
+   * @param resource    the resource to update
+   * @param properties  the properties
+   *
+   * @return the request id; -1 for none
+   */
+  public abstract int updateProperties(Resource resource, Map<String, Object> properties);
+
+  /**
+   * Get a request status
+   *
+   * @return the request status
+   */
+  protected RequestStatus getRequestStatus(Integer requestId) {
+    if (requestId != null){
+      Resource requestResource = new ResourceImpl(Resource.Type.Request);
+      requestResource.setProperty(PropertyHelper.getPropertyId("Requests", "id"), requestId);
+      requestResource.setProperty(PropertyHelper.getPropertyId("Requests", "status"), "InProgress");
+      return new RequestStatusImpl(requestResource);
+    }
+    return new RequestStatusImpl(null);
+  }
+
+
+  // ----- accessors ---------------------------------------------------------
+
+  /**
+   * Get the configuration provider.
+   *
+   * @return the configuration provider
+   */
+  protected ClusterDefinition getClusterDefinition() {
+    return clusterDefinition;
+  }
+
+  /**
+   * Get the resource provider type.
+   *
+   * @return the type
+   */
+  public Resource.Type getType() {
+    return type;
+  }
+
+
+// ----- helper methods ----------------------------------------------------
+
+  /**
+   * Get the set of property ids required to satisfy the given request.
+   *
+   * @param request              the request
+   * @param predicate            the predicate
+   *
+   * @return the set of property ids needed to satisfy the request
+   */
+  protected Set<String> getRequestPropertyIds(Request request, Predicate predicate) {
+    Set<String> propertyIds  = request.getPropertyIds();
+
+    // if no properties are specified, then return them all
+    if (propertyIds == null || propertyIds.isEmpty()) {
+      return new HashSet<String>(this.propertyIds);
+    }
+
+    propertyIds = new HashSet<String>(propertyIds);
+
+    if (predicate != null) {
+      propertyIds.addAll(PredicateHelper.getPropertyIds(predicate));
+    }
+    return propertyIds;
+  }
+
+  /**
+   * Check to see if the given set contains a property or category id that matches the given property id.
+   *
+   * @param ids         the set of property/category ids
+   * @param propertyId  the property id
+   *
+   * @return true if the given set contains a property id or category that matches the given property id
+   */
+  protected static boolean contains(Set<String> ids, String propertyId) {
+    boolean contains = ids.contains(propertyId);
+
+    if (!contains) {
+      String category = PropertyHelper.getPropertyCategory(propertyId);
+      while (category != null && !contains) {
+        contains = ids.contains(category);
+        category = PropertyHelper.getPropertyCategory(category);
+      }
+    }
+    return contains;
+  }
+
+  /**
+   * Factory method for obtaining a resource provider based on a given type.
+   *
+   * @param type               the resource type
+   * @param clusterDefinition  the cluster definition
+   *
+   * @return a new resource provider
+   */
+  public static ResourceProvider getResourceProvider(Resource.Type type,
+                                                     ClusterDefinition clusterDefinition) {
+    switch (type) {
+      case Cluster:
+        return new ClusterProvider(clusterDefinition);
+      case Service:
+        return new ServiceProvider(clusterDefinition);
+      case Component:
+        return new ComponentProvider(clusterDefinition);
+      case Host:
+        return new HostProvider(clusterDefinition);
+      case HostComponent:
+        return new HostComponentProvider(clusterDefinition);
+      case Request:
+        return new RequestProvider(clusterDefinition);
+      case Task:
+        return new TaskProvider(clusterDefinition);
+      default:
+        return new NoOpProvider(type, clusterDefinition);
+    }
+  }
+}

+ 59 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/BaseResourceProvider.java

@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.server.controller.spi.Resource;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * An abstract resource provider for a MSI defined cluster.
+ */
+public abstract class BaseResourceProvider extends AbstractResourceProvider {
+
+  private final Set<Resource> resources = new HashSet<Resource>();
+
+  /**
+   * Construct a resource provider based on the given cluster definition.
+   *
+   * @param clusterDefinition the cluster definition
+   */
+  public BaseResourceProvider(Resource.Type type, ClusterDefinition clusterDefinition) {
+    super(type, clusterDefinition);
+  }
+
+  /**
+   * Get the set of resources for this provider.
+   *
+   * @return the set of resources
+   */
+  protected Set<Resource> getResources() {
+    return resources;
+  }
+
+  /**
+   * Add a resource to the set of resources provided by this provider.
+   *
+   * @param resource  the resource to add
+   */
+  protected void addResource(Resource resource) {
+    resources.add(resource);
+  }
+}

+ 545 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterDefinition.java

@@ -0,0 +1,545 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.scom.ClusterDefinitionProvider;
+import org.apache.ambari.scom.HostInfoProvider;
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Resource;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Defines the cluster created by the MSI.
+ */
+public class ClusterDefinition {
+
+  private static final String HEADER_TAG              = "#";
+  private static final String HOSTS_HEADER            = "Hosts";
+
+  private final Set<String> services = new HashSet<String>();
+  private final Set<String> hosts = new HashSet<String>();
+  private final Map<String, Set<String>> components = new HashMap<String, Set<String>>();
+  private final Map<String, Map<String, Set<String>>> hostComponents = new HashMap<String, Map<String, Set<String>>>();
+  private final Map<Integer, StateProvider.Process> processes = new HashMap<Integer, StateProvider.Process>();
+
+  private final Set<Resource> requestResources = new HashSet<Resource>();
+  private final Set<Resource> taskResources    = new HashSet<Resource>();
+
+
+  private final StateProvider stateProvider;
+  private final ClusterDefinitionProvider definitionProvider;
+  private final HostInfoProvider hostInfoProvider;
+  private String clusterName;
+  private String versionId;
+
+  private int nextRequestId = 1;
+  private int nextTaskId = 1;
+
+  /**
+   * Component name mapping to account for differences in what is provided by the MSI
+   * and what is expected by the Ambari providers.
+   */
+  private static final Map<String, Set<String>> componentNameMap = new HashMap<String, Set<String>>();
+
+  static {
+    componentNameMap.put("NAMENODE_HOST",           Collections.singleton("NAMENODE"));
+    componentNameMap.put("SECONDARY_NAMENODE_HOST", Collections.singleton("SECONDARY_NAMENODE"));
+    componentNameMap.put("OOZIE_SERVER_HOST",       Collections.singleton("OOZIE_SERVER"));
+    componentNameMap.put("WEBHCAT_HOST",            Collections.singleton("WEBHCAT_SERVER"));
+    componentNameMap.put("FLUME_HOSTS",             Collections.singleton("FLUME_SERVER"));
+    componentNameMap.put("HBASE_MASTER",            Collections.singleton("HBASE_MASTER"));
+    componentNameMap.put("HBASE_REGIONSERVERS",     Collections.singleton("HBASE_REGIONSERVER"));
+    componentNameMap.put("ZOOKEEPER_HOSTS",         Collections.singleton("ZOOKEEPER_SERVER"));
+
+    Set<String> mapReduceComponents = new HashSet<String>();
+    mapReduceComponents.add("JOBTRACKER");
+    mapReduceComponents.add("HISTORY_SERVER");
+    componentNameMap.put("JOBTRACKER_HOST", mapReduceComponents);
+
+    Set<String> slaveComponents = new HashSet<String>();
+    slaveComponents.add("DATANODE");
+    slaveComponents.add("TASKTRACKER");
+
+    componentNameMap.put("SLAVE_HOSTS", slaveComponents);
+
+    Set<String> hiveComponents = new HashSet<String>();
+    hiveComponents.add("HIVE_SERVER");
+    hiveComponents.add("HIVE_SERVER2");
+    hiveComponents.add("HIVE_METASTORE");
+    hiveComponents.add("HIVE_CLIENT");
+
+    componentNameMap.put("HIVE_SERVER_HOST", hiveComponents);
+  }
+
+  /**
+   * Component service mapping .
+   */
+  private static final Map<String, String> componentServiceMap = new HashMap<String, String>();
+
+  static {
+    componentServiceMap.put("NAMENODE",           "HDFS");
+    componentServiceMap.put("DATANODE",           "HDFS");
+    componentServiceMap.put("SECONDARY_NAMENODE", "HDFS");
+    componentServiceMap.put("JOBTRACKER",         "MAPREDUCE");
+    componentServiceMap.put("HISTORY_SERVER",     "MAPREDUCE");
+    componentServiceMap.put("TASKTRACKER",        "MAPREDUCE");
+    componentServiceMap.put("HIVE_SERVER",        "HIVE");
+    componentServiceMap.put("HIVE_SERVER2",       "HIVE");
+    componentServiceMap.put("HIVE_METASTORE",     "HIVE");
+    componentServiceMap.put("HIVE_CLIENT",        "HIVE");
+    componentServiceMap.put("OOZIE_SERVER",       "OOZIE");
+    componentServiceMap.put("WEBHCAT_SERVER",     "WEBHCAT");
+    componentServiceMap.put("FLUME_SERVER",       "FLUME");
+    componentServiceMap.put("HBASE_MASTER",       "HBASE");
+    componentServiceMap.put("HBASE_REGIONSERVER", "HBASE");
+    componentServiceMap.put("ZOOKEEPER_SERVER",   "ZOOKEEPER");
+  }
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  /**
+   * Create a cluster definition.
+   *
+   * @param stateProvider  the state provider
+   */
+  public ClusterDefinition(StateProvider stateProvider,
+                           ClusterDefinitionProvider definitionProvider,
+                           HostInfoProvider hostInfoProvider) {
+    this.stateProvider      = stateProvider;
+    this.definitionProvider = definitionProvider;
+    this.hostInfoProvider   = hostInfoProvider;
+    this.clusterName        = definitionProvider.getClusterName();
+    this.versionId          = definitionProvider.getVersionId();
+
+    try {
+      readClusterDefinition();
+    } catch (IOException e) {
+      String msg = "Caught exception reading cluster definition file.";
+      throw new IllegalStateException(msg, e);
+    }
+  }
+
+  // ----- ClusterDefinition -------------------------------------------------
+
+  /**
+   * Get the name of the cluster.
+   *
+   * @return the cluster name
+   */
+  public String getClusterName() {
+    return clusterName;
+  }
+
+  /**
+   * Get the name of the cluster.
+   *
+   * @return the cluster name
+   */
+  public String getVersionId() {
+    return versionId;
+  }
+
+  /**
+   * Get the services for the cluster.
+   *
+   * @return the set of service names
+   */
+  public Set<String> getServices() {
+    return services;
+  }
+
+  /**
+   * Get the hosts for the cluster.
+   *
+   * @return the set of hosts names
+   */
+  public Set<String> getHosts() {
+    return hosts;
+  }
+
+  /**
+   * Get the host info provider associated with this cluster definition.
+   *
+   * @return the host info provider
+   */
+  public HostInfoProvider getHostInfoProvider() {
+    return hostInfoProvider;
+  }
+
+  /**
+   * Get the components for the given service.
+   *
+   * @param service  the service name
+   *
+   * @return the set of component names for the given service name
+   */
+  public Set<String> getComponents(String service) {
+    Set<String> componentSet = components.get(service);
+    return componentSet == null ? Collections.<String>emptySet() : componentSet;
+  }
+
+  /**
+   * Get the host components for the given service and host.
+   *
+   * @param service  the service name
+   * @param host     the host name
+   *
+   * @return the set of host component names for the given service and host names
+   */
+  public Set<String> getHostComponents(String service, String host) {
+    Set<String> resultSet = null;
+    Map<String, Set<String>> serviceHostComponents = hostComponents.get(service);
+    if (serviceHostComponents != null) {
+      resultSet = serviceHostComponents.get(host);
+    }
+    return resultSet == null ? Collections.<String>emptySet() : resultSet;
+  }
+
+  /**
+   * Get the host state from the given host name.
+   *
+   * @param hostName  the host name
+   *
+   * @return the host state
+   */
+  public String getHostState(String hostName) {
+    for (Map.Entry<String, Map<String, Set<String>>> entry : hostComponents.entrySet()) {
+      Map<String, Set<String>> serviceHostComponents = entry.getValue();
+      for (Map.Entry<String, Set<String>> hostEntry : serviceHostComponents.entrySet()) {
+        if (hostEntry.getKey().equals(hostName)) {
+          Set<String> componentNames = hostEntry.getValue();
+          for (String componentName : componentNames) {
+            if (stateProvider.getRunningState(hostName, componentName) == StateProvider.State.Unknown) {
+              return "UNHEALTHY";
+            }
+          }
+        }
+      }
+    }
+    return "HEALTHY";
+  }
+
+  /**
+   * Get the service state from the given service name.
+   *
+   * @param serviceName  the service name
+   *
+   * @return the service state
+   */
+  public String getServiceState(String serviceName) {
+    Map<String, Set<String>> serviceHostComponents = hostComponents.get(serviceName);
+    if (serviceHostComponents != null) {
+
+      for (Map.Entry<String, Set<String>> entry : serviceHostComponents.entrySet()) {
+        String      hostName       = entry.getKey();
+        Set<String> componentNames = entry.getValue();
+
+        for (String componentName : componentNames) {
+          if (stateProvider.getRunningState(hostName, componentName) != StateProvider.State.Running) {
+            return "INSTALLED";
+          }
+        }
+      }
+    }
+
+    return "STARTED";
+  }
+
+  /**
+   * Set the service state for the given service name.
+   *
+   * @param serviceName  the service name
+   *
+   * @return the request id
+   */
+  public int setServiceState(String serviceName, String state) {
+    StateProvider.State s = state.equals("STARTED") ? StateProvider.State.Running :
+        state.equals("INSTALLED") ? StateProvider.State.Stopped : StateProvider.State.Unknown;
+
+    int requestId = -1;
+
+    if (s != StateProvider.State.Unknown) {
+      Map<String, Set<String>> serviceHostComponents = hostComponents.get(serviceName);
+      if (serviceHostComponents != null) {
+
+        for (Map.Entry<String, Set<String>> entry : serviceHostComponents.entrySet()) {
+          String      hostName       = entry.getKey();
+          Set<String> componentNames = entry.getValue();
+
+          for (String componentName : componentNames) {
+            requestId = recordProcess(stateProvider.setRunningState(hostName, componentName, s), requestId,
+                "Set service " + serviceName + " state to " + s);
+          }
+        }
+      }
+    }
+    return requestId;
+  }
+
+  /**
+   * Get the component state from the give service name and component name.
+   *
+   * @param serviceName    the service name
+   * @param componentName  the component name
+   *
+   * @return the component state
+   */
+  public String getComponentState(String serviceName, String componentName) {
+    Map<String, Set<String>> serviceHostComponents = hostComponents.get(serviceName);
+    if (serviceHostComponents != null) {
+
+      for (Map.Entry<String, Set<String>> entry : serviceHostComponents.entrySet()) {
+        String      hostName       = entry.getKey();
+        Set<String> componentNames = entry.getValue();
+
+        for (String name : componentNames) {
+          if (name.equals(componentName)) {
+            if (stateProvider.getRunningState(hostName, componentName) != StateProvider.State.Running) {
+              return "INSTALLED";
+            }
+          }
+        }
+      }
+    }
+
+    return "STARTED";
+  }
+
+  /**
+   * Set the component state for the given service name.
+   *
+   * @param serviceName    the service name
+   * @param componentName  the component name
+   * @param state          the state
+   *
+   * @return the request id
+   */
+  public int setComponentState(String serviceName, String componentName, String state) {
+    StateProvider.State s = state.equals("STARTED") ? StateProvider.State.Running :
+        state.equals("INSTALLED") ? StateProvider.State.Stopped : StateProvider.State.Unknown;
+
+    int requestId = -1;
+
+    if (s != StateProvider.State.Unknown) {
+      Map<String, Set<String>> serviceHostComponents = hostComponents.get(serviceName);
+      if (serviceHostComponents != null) {
+
+        for (Map.Entry<String, Set<String>> entry : serviceHostComponents.entrySet()) {
+          String      hostName       = entry.getKey();
+          Set<String> componentNames = entry.getValue();
+
+          for (String name : componentNames) {
+            if (name.equals(componentName)) {
+              requestId = recordProcess(stateProvider.setRunningState(hostName, componentName, s), requestId,
+                  "Set component " + componentName + " state to " + s);
+            }
+          }
+        }
+      }
+    }
+    return requestId;
+  }
+
+  /**
+    * Get the host component state from the given host name and component name.
+    *
+    * @param hostName       the host name
+    * @param componentName  the component name
+    *
+    * @return the host component state
+    */
+  public String getHostComponentState(String hostName, String componentName) {
+
+    boolean healthy = stateProvider.getRunningState(hostName, componentName) == StateProvider.State.Running;
+    return healthy ? "STARTED" : "INSTALLED";
+  }
+
+  /**
+   * Set the host component state for the given host name and component name.
+   *
+   * @param hostName       the host name
+   * @param componentName  the component name
+   *
+   * @return the request id
+   */
+  public int setHostComponentState(String hostName, String componentName, String state) {
+    StateProvider.State s = state.equals("STARTED") ? StateProvider.State.Running :
+        state.equals("INSTALLED") ? StateProvider.State.Stopped : StateProvider.State.Unknown;
+
+    int requestId = -1;
+
+    if (s != StateProvider.State.Unknown) {
+      requestId = recordProcess(stateProvider.setRunningState(hostName, componentName, s), -1,
+          "Set host component " + componentName + " state to " + s);
+    }
+    return requestId;
+  }
+
+  /**
+   * Return the process that is associated with the given id.
+   *
+   * @param id  the id
+   *
+   * @return the process
+   */
+  public StateProvider.Process getProcess(Integer id) {
+    return processes.get(id);
+  }
+
+  /**
+   * Get the set of request resources.
+   *
+   * @return the set of request resources
+   */
+  public Set<Resource> getRequestResources() {
+    return requestResources;
+  }
+
+  /**
+   * Get the set of task resources
+   *
+   * @return the set of task resources
+   */
+  public Set<Resource> getTaskResources() {
+    return taskResources;
+  }
+
+
+  // ----- helper methods ----------------------------------------------------
+
+  // record a process and create the corresponding request and task resource
+  private synchronized int recordProcess(StateProvider.Process process, int requestId, String context) {
+
+    if (requestId == -1) {
+      requestId = nextRequestId++;
+
+      Resource request = new ResourceImpl(Resource.Type.Request);
+
+      request.setProperty(RequestProvider.REQUEST_ID_PROPERTY_ID, requestId);
+      request.setProperty(RequestProvider.REQUEST_CLUSTER_NAME_PROPERTY_ID, clusterName);
+      request.setProperty(RequestProvider.REQUEST_CONTEXT_ID, context);
+
+      requestResources.add(request);
+    }
+
+    Resource task = new ResourceImpl(Resource.Type.Task);
+    int taskId = nextTaskId++;
+
+    taskResources.add(task);
+
+    task.setProperty(TaskProvider.TASK_ID_PROPERTY_ID, taskId);
+    task.setProperty(TaskProvider.TASK_REQUEST_ID_PROPERTY_ID, requestId);
+    task.setProperty(TaskProvider.TASK_CLUSTER_NAME_PROPERTY_ID, clusterName);
+
+    processes.put(taskId, process);
+    return requestId;
+  }
+
+  /**
+   * Read the MSI cluster definition file.
+   */
+  private void readClusterDefinition() throws IOException {
+
+    InputStream is = definitionProvider.getInputStream();
+    try {
+      BufferedReader br = new BufferedReader(new InputStreamReader(is));
+
+      String  line;
+      boolean hostsSection = false;
+
+      while ((line = br.readLine()) != null) {
+        line = line.trim();
+
+
+        if (line.startsWith(HEADER_TAG)) {
+
+          String header = line.substring(HEADER_TAG.length());
+          hostsSection = header.equals(HOSTS_HEADER);
+
+          if (!hostsSection && (header.startsWith(HOSTS_HEADER) ) ){
+            char c = header.charAt(HOSTS_HEADER.length());
+            hostsSection = c == ' ' || c == '(';
+          }
+        } else {
+          if (hostsSection) {
+
+            int i = line.indexOf('=');
+            if (i > -1) {
+
+              String name = line.substring(0, i);
+              String hostLine = line.substring(i + 1);
+
+              Set<String> componentNames = componentNameMap.get(name);
+
+              if (componentNames != null) {
+
+                for (String componentName : componentNames) {
+
+
+                  String serviceName = componentServiceMap.get(componentName);
+
+                  services.add(serviceName);
+                  Set<String> serviceComponents = components.get(serviceName);
+                  if (serviceComponents == null) {
+                    serviceComponents = new HashSet<String>();
+                    components.put(serviceName, serviceComponents);
+                  }
+                  serviceComponents.add(componentName);
+
+                  Map<String, Set<String>> serviceHostComponents = hostComponents.get(serviceName);
+                  if (serviceHostComponents == null) {
+                    serviceHostComponents = new HashMap<String, Set<String>>();
+                    hostComponents.put(serviceName, serviceHostComponents);
+                  }
+
+                  String[] hostNames = hostLine.split(",");
+                  for (String hostName : hostNames) {
+
+                    hostName = hostName.trim();
+
+                    Set<String> hostHostComponents = serviceHostComponents.get(hostName);
+                    if (hostHostComponents == null) {
+                      hostHostComponents = new HashSet<String>();
+                      serviceHostComponents.put(hostName, hostHostComponents);
+                    }
+                    hostHostComponents.add(componentName);
+
+                    hosts.add(hostName);
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    } finally {
+      is.close();
+    }
+  }
+}

+ 79 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterProvider.java

@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+
+import java.util.Map;
+
+/**
+ * A cluster resource provider for a MSI defined cluster.
+ */
+public class ClusterProvider extends BaseResourceProvider {
+
+  // Clusters
+  protected static final String CLUSTER_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("Clusters", "cluster_name");
+  protected static final String CLUSTER_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "version");
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  /**
+   * Construct a resource provider based on the given cluster definition.
+   *
+   * @param clusterDefinition  the cluster definition
+   */
+  public ClusterProvider(ClusterDefinition clusterDefinition) {
+    super(Resource.Type.Cluster, clusterDefinition);
+    initClusterResources();
+  }
+
+
+  // ----- AbstractResourceProvider ------------------------------------------
+
+  @Override
+  public void updateProperties(Resource resource, Request request, Predicate predicate) {
+    // Do nothing
+  }
+
+  @Override
+  public int updateProperties(Resource resource, Map<String, Object> properties) {
+    // Do nothing
+    return -1;
+  }
+
+
+  // ----- helper methods ----------------------------------------------------
+
+  /**
+   * Create the resources based on the cluster definition.
+   */
+  private void initClusterResources() {
+    Resource cluster = new ResourceImpl(Resource.Type.Cluster);
+    ClusterDefinition clusterDefinition = getClusterDefinition();
+    cluster.setProperty(CLUSTER_NAME_PROPERTY_ID, clusterDefinition.getClusterName());
+    cluster.setProperty(CLUSTER_VERSION_PROPERTY_ID, clusterDefinition.getVersionId());
+
+    addResource(cluster);
+  }
+}

+ 102 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ComponentProvider.java

@@ -0,0 +1,102 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A component resource provider for a MSI defined cluster.
+ */
+public class ComponentProvider extends BaseResourceProvider {
+
+  // Components
+  protected static final String COMPONENT_CLUSTER_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("ServiceComponentInfo", "cluster_name");
+  protected static final String COMPONENT_SERVICE_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("ServiceComponentInfo", "service_name");
+  protected static final String COMPONENT_COMPONENT_NAME_PROPERTY_ID  = PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name");
+  protected static final String COMPONENT_STATE_PROPERTY_ID           = PropertyHelper.getPropertyId("ServiceComponentInfo", "state");
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  /**
+   * Construct a resource provider based on the given cluster definition.
+   *
+   * @param clusterDefinition  the cluster definition
+   */
+  public ComponentProvider(ClusterDefinition clusterDefinition) {
+    super(Resource.Type.Component, clusterDefinition);
+    initComponentResources();
+  }
+
+
+  // ----- AbstractResourceProvider ------------------------------------------
+
+  @Override
+  public void updateProperties(Resource resource, Request request, Predicate predicate) {
+
+    Set<String> propertyIds = getRequestPropertyIds(request, predicate);
+    if (contains(propertyIds, COMPONENT_STATE_PROPERTY_ID)) {
+      String serviceName   = (String) resource.getPropertyValue(COMPONENT_SERVICE_NAME_PROPERTY_ID);
+      String componentName = (String) resource.getPropertyValue(COMPONENT_COMPONENT_NAME_PROPERTY_ID);
+      resource.setProperty(COMPONENT_STATE_PROPERTY_ID, getClusterDefinition().getComponentState(serviceName, componentName));
+    }
+  }
+
+  @Override
+  public int updateProperties(Resource resource, Map<String, Object> properties) {
+    int requestId = -1;
+    if (properties.containsKey(COMPONENT_STATE_PROPERTY_ID)) {
+      String state         = (String) properties.get(COMPONENT_STATE_PROPERTY_ID);
+      String serviceName   = (String) resource.getPropertyValue(COMPONENT_SERVICE_NAME_PROPERTY_ID);
+      String componentName = (String) resource.getPropertyValue(COMPONENT_COMPONENT_NAME_PROPERTY_ID);
+
+      requestId = getClusterDefinition().setComponentState(serviceName, componentName, state);
+    }
+    return requestId;
+  }
+
+
+  // ----- helper methods ----------------------------------------------------
+
+  /**
+   * Create the resources based on the cluster definition.
+   */
+  private void initComponentResources() {
+    String      clusterName = getClusterDefinition().getClusterName();
+    Set<String> services    = getClusterDefinition().getServices();
+    for (String serviceName : services) {
+      Set<String> components = getClusterDefinition().getComponents(serviceName);
+      for (String componentName : components) {
+        Resource component = new ResourceImpl(Resource.Type.Component);
+        component.setProperty(COMPONENT_CLUSTER_NAME_PROPERTY_ID, clusterName);
+        component.setProperty(COMPONENT_SERVICE_NAME_PROPERTY_ID, serviceName);
+        component.setProperty(COMPONENT_COMPONENT_NAME_PROPERTY_ID, componentName);
+
+        addResource(component);
+      }
+    }
+  }
+}

+ 112 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/HostComponentProvider.java

@@ -0,0 +1,112 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A host component resource provider for a MSI defined cluster.
+ */
+public class HostComponentProvider extends BaseResourceProvider {
+
+  // Host Components
+  protected static final String HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID   = PropertyHelper.getPropertyId("HostRoles", "cluster_name");
+  protected static final String HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID   = PropertyHelper.getPropertyId("HostRoles", "service_name");
+  protected static final String HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("HostRoles", "component_name");
+  protected static final String HOST_COMPONENT_HOST_NAME_PROPERTY_ID      = PropertyHelper.getPropertyId("HostRoles", "host_name");
+  protected static final String HOST_COMPONENT_STATE_PROPERTY_ID          = PropertyHelper.getPropertyId("HostRoles", "state");
+  protected static final String HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID  = PropertyHelper.getPropertyId("HostRoles", "desired_state");
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  /**
+   * Construct a resource provider based on the given cluster definition.
+   *
+   * @param clusterDefinition  the cluster definition
+   */
+  public HostComponentProvider(ClusterDefinition clusterDefinition) {
+    super(Resource.Type.HostComponent, clusterDefinition);
+    initHostComponentResources();
+  }
+
+
+  // ----- AbstractResourceProvider ------------------------------------------
+
+  @Override
+  public void updateProperties(Resource resource, Request request, Predicate predicate) {
+    Set<String> propertyIds = getRequestPropertyIds(request, predicate);
+    if (contains(propertyIds, HOST_COMPONENT_STATE_PROPERTY_ID) ||
+        contains(propertyIds, HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID)) {
+      String componentName = (String) resource.getPropertyValue(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID);
+      String hostName      = (String) resource.getPropertyValue(HOST_COMPONENT_HOST_NAME_PROPERTY_ID);
+
+      String hostComponentState = getClusterDefinition().getHostComponentState(hostName, componentName);
+
+      resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, hostComponentState);
+      resource.setProperty(HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID, hostComponentState);
+    }
+  }
+
+  @Override
+  public int updateProperties(Resource resource, Map<String, Object> properties) {
+    int requestId = -1;
+    if (properties.containsKey(HOST_COMPONENT_STATE_PROPERTY_ID)) {
+      String state         = (String) properties.get(HOST_COMPONENT_STATE_PROPERTY_ID);
+      String componentName = (String) resource.getPropertyValue(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID);
+      String hostName      = (String) resource.getPropertyValue(HOST_COMPONENT_HOST_NAME_PROPERTY_ID);
+
+      requestId = getClusterDefinition().setHostComponentState(hostName, componentName, state);
+    }
+    return requestId;
+  }
+
+
+  // ----- helper methods ----------------------------------------------------
+
+  /**
+   * Create the resources based on the cluster definition.
+   */
+  private void initHostComponentResources() {
+    String      clusterName = getClusterDefinition().getClusterName();
+    Set<String> services    = getClusterDefinition().getServices();
+    for (String serviceName : services) {
+      Set<String> hosts = getClusterDefinition().getHosts();
+      for (String hostName : hosts) {
+        Set<String> hostComponents = getClusterDefinition().getHostComponents(serviceName, hostName);
+        for (String componentName : hostComponents) {
+          Resource hostComponent = new ResourceImpl(Resource.Type.HostComponent);
+          hostComponent.setProperty(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID, clusterName);
+          hostComponent.setProperty(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID, serviceName);
+          hostComponent.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, componentName);
+          hostComponent.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, hostName);
+
+          addResource(hostComponent);
+        }
+      }
+    }
+  }
+}

+ 111 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/HostProvider.java

@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A host resource provider for a MSI defined cluster.
+ */
+public class HostProvider extends BaseResourceProvider {
+
+  // Hosts
+  protected static final String HOST_CLUSTER_NAME_PROPERTY_ID =
+      PropertyHelper.getPropertyId("Hosts", "cluster_name");
+  protected static final String HOST_NAME_PROPERTY_ID =
+      PropertyHelper.getPropertyId("Hosts", "host_name");
+  protected static final String HOST_STATE_PROPERTY_ID =
+      PropertyHelper.getPropertyId("Hosts", "host_state");
+  protected static final String HOST_IP_PROPERTY_ID =
+      PropertyHelper.getPropertyId("Hosts", "ip");
+
+
+  // ----- Constants ---------------------------------------------------------
+
+  protected final static Logger LOG =
+      LoggerFactory.getLogger(HostProvider.class);
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  /**
+   * Construct a resource provider based on the given cluster definition.
+   *
+   * @param clusterDefinition  the cluster definition
+   */
+  public HostProvider(ClusterDefinition clusterDefinition) {
+    super(Resource.Type.Host, clusterDefinition);
+    initHostResources();
+  }
+
+
+  // ----- AbstractResourceProvider ------------------------------------------
+
+  @Override
+  public void updateProperties(Resource resource, Request request, Predicate predicate) {
+    Set<String> propertyIds = getRequestPropertyIds(request, predicate);
+    if (contains(propertyIds, HOST_STATE_PROPERTY_ID)) {
+      String hostName = (String) resource.getPropertyValue(HOST_NAME_PROPERTY_ID);
+      resource.setProperty(HOST_STATE_PROPERTY_ID, getClusterDefinition().getHostState(hostName));
+    }
+  }
+
+  @Override
+  public int updateProperties(Resource resource, Map<String, Object> properties) {
+    // Do nothing
+    return -1;
+  }
+
+
+  // ----- helper methods ----------------------------------------------------
+
+  /**
+   * Create the resources based on the cluster definition.
+   */
+  private void initHostResources() {
+    ClusterDefinition clusterDefinition = getClusterDefinition();
+    String            clusterName       = clusterDefinition.getClusterName();
+    Set<String>       hosts             = clusterDefinition.getHosts();
+
+    for (String hostName : hosts) {
+      Resource host = new ResourceImpl(Resource.Type.Host);
+      host.setProperty(HOST_CLUSTER_NAME_PROPERTY_ID, clusterName);
+      host.setProperty(HOST_NAME_PROPERTY_ID, hostName);
+      try {
+        host.setProperty(HOST_IP_PROPERTY_ID, clusterDefinition.getHostInfoProvider().getHostAddress(hostName));
+      } catch (SystemException e) {
+        if (LOG.isErrorEnabled()) {
+          LOG.error("Can't set host ip address : caught exception", e);
+        }
+      }
+
+      addResource(host);
+    }
+  }
+}

+ 67 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/NoOpProvider.java

@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.msi;
+
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A NO-OP resource provider for a MSI defined cluster.
+ */
+public class NoOpProvider extends BaseResourceProvider {
+
+  private final Map<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>();
+
+  // ----- AbstractResourceProvider ------------------------------------------
+
+  @Override
+  public void updateProperties(Resource resource, Request request, Predicate predicate) {
+    // Do nothing
+  }
+
+  @Override
+  public int updateProperties(Resource resource, Map<String, Object> properties) {
+    // Do nothing
+    return -1;
+  }
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  public NoOpProvider(Resource.Type type, ClusterDefinition clusterDefinition) {
+    super(type, clusterDefinition);
+    keyPropertyIds.put(type, "id");
+  }
+
+
+  @Override
+  public Map<Resource.Type, String> getKeyPropertyIds() {
+    return keyPropertyIds;
+  }
+
+  @Override
+  public Set<String> checkPropertyIds(Set<String> propertyIds) {
+    return Collections.emptySet();
+  }
+}

+ 68 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/RequestProvider.java

@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A request resource provider for a MSI defined cluster.
+ */
+public class RequestProvider extends AbstractResourceProvider {
+
+  // Request properties
+  protected static final String REQUEST_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Requests", "cluster_name");
+  protected static final String REQUEST_ID_PROPERTY_ID           = PropertyHelper.getPropertyId("Requests", "id");
+  protected static final String REQUEST_CONTEXT_ID               = PropertyHelper.getPropertyId("Requests", "request_context");
+
+  // ----- Constructors ------------------------------------------------------
+
+  /**
+   * Construct a resource provider based on the given cluster definition.
+   *
+   * @param clusterDefinition  the cluster definition
+   */
+  public RequestProvider(ClusterDefinition clusterDefinition) {
+    super(Resource.Type.Request, clusterDefinition);
+  }
+
+
+  // ----- AbstractResourceProvider ------------------------------------------
+
+  @Override
+  protected Set<Resource> getResources() {
+    return getClusterDefinition().getRequestResources();
+  }
+
+  @Override
+  public void updateProperties(Resource resource, Request request, Predicate predicate) {
+    //Do nothing
+  }
+
+  @Override
+  public int updateProperties(Resource resource, Map<String, Object> properties) {
+    //Do nothing
+    return -1;
+  }
+}

+ 95 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ServiceProvider.java

@@ -0,0 +1,95 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A service resource provider for a MSI defined cluster.
+ */
+public class ServiceProvider extends BaseResourceProvider {
+
+  // Services
+  protected static final String SERVICE_CLUSTER_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("ServiceInfo", "cluster_name");
+  protected static final String SERVICE_SERVICE_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("ServiceInfo", "service_name");
+  protected static final String SERVICE_SERVICE_STATE_PROPERTY_ID   = PropertyHelper.getPropertyId("ServiceInfo", "state");
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  /**
+   * Construct a resource provider based on the given cluster definition.
+   *
+   * @param clusterDefinition  the cluster definition
+   */
+  public ServiceProvider(ClusterDefinition clusterDefinition) {
+    super(Resource.Type.Service, clusterDefinition);
+    initServiceResources();
+  }
+
+
+  // ----- AbstractResourceProvider ------------------------------------------
+
+  @Override
+  public void updateProperties(Resource resource, Request request, Predicate predicate) {
+    Set<String> propertyIds = getRequestPropertyIds(request, predicate);
+    if (contains(propertyIds, SERVICE_SERVICE_STATE_PROPERTY_ID)) {
+      String serviceName = (String) resource.getPropertyValue(SERVICE_SERVICE_NAME_PROPERTY_ID);
+      resource.setProperty(SERVICE_SERVICE_STATE_PROPERTY_ID, getClusterDefinition().getServiceState(serviceName));
+    }
+  }
+
+  @Override
+  public int updateProperties(Resource resource, Map<String, Object> properties) {
+    int requestId = -1;
+    if (properties.containsKey(SERVICE_SERVICE_STATE_PROPERTY_ID)) {
+      String state       = (String) properties.get(SERVICE_SERVICE_STATE_PROPERTY_ID);
+      String serviceName = (String) resource.getPropertyValue(SERVICE_SERVICE_NAME_PROPERTY_ID);
+
+      requestId = getClusterDefinition().setServiceState(serviceName, state);
+    }
+    return requestId;
+  }
+
+
+  // ----- helper methods ----------------------------------------------------
+
+  /**
+   * Create the resources based on the cluster definition.
+   */
+  private void initServiceResources() {
+    String      clusterName = getClusterDefinition().getClusterName();
+    Set<String> services    = getClusterDefinition().getServices();
+
+    for (String serviceName : services) {
+      Resource service = new ResourceImpl(Resource.Type.Service);
+      service.setProperty(SERVICE_CLUSTER_NAME_PROPERTY_ID, clusterName);
+      service.setProperty(SERVICE_SERVICE_NAME_PROPERTY_ID, serviceName);
+
+      addResource(service);
+    }
+  }
+}

+ 65 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/StateProvider.java

@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+/**
+ * Interface to provide component state to the MSI resource provider.
+ */
+public interface StateProvider {
+  /**
+   * Determine whether or not the host component identified by the given host name
+   * and component name is running.
+   *
+   * @param hostName       the host name
+   * @param componentName  the component name
+   *
+   * @return true if the host component is healthy
+   */
+  public State getRunningState(String hostName, String componentName);
+
+  /**
+   * Set the running state of the given component.
+   *
+   * @param hostName       the host name
+   * @param componentName  the component name
+   * @param state          the desired state
+   */
+  public Process setRunningState(String hostName, String componentName, State state);
+
+  /**
+   * Enum of possible states.
+   */
+  public enum State {
+    Stopped,
+    Running,
+    Paused,
+    Unknown
+  }
+
+  public interface Process {
+    public boolean isRunning();
+
+    public int getExitCode();
+
+    public String getOutput();
+
+    public String getError();
+  }
+
+}

+ 92 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/TaskProvider.java

@@ -0,0 +1,92 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A task resource provider for a MSI defined cluster.
+ */
+public class TaskProvider extends AbstractResourceProvider {
+
+  // Tasks properties
+  protected static final String TASK_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Tasks", "cluster_name");
+  protected static final String TASK_REQUEST_ID_PROPERTY_ID   = PropertyHelper.getPropertyId("Tasks", "request_id");
+  protected static final String TASK_ID_PROPERTY_ID           = PropertyHelper.getPropertyId("Tasks", "id");
+  protected static final String TASK_STATUS_PROPERTY_ID       = PropertyHelper.getPropertyId("Tasks", "status");
+  protected static final String TASK_EXIT_CODE_PROPERTY_ID    = PropertyHelper.getPropertyId("Tasks", "exit_code");
+  protected static final String TASK_STDERR_PROPERTY_ID       = PropertyHelper.getPropertyId("Tasks", "stderr");
+  protected static final String TASK_STOUT_PROPERTY_ID        = PropertyHelper.getPropertyId("Tasks", "stdout");
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  /**
+   * Construct a resource provider based on the given cluster definition.
+   *
+   * @param clusterDefinition  the cluster definition
+   */
+  public TaskProvider(ClusterDefinition clusterDefinition) {
+    super(Resource.Type.Task, clusterDefinition);
+  }
+
+
+  // ----- AbstractResourceProvider ------------------------------------------
+
+  @Override
+  protected Set<Resource> getResources() {
+    return getClusterDefinition().getTaskResources();
+  }
+
+  @Override
+  public void updateProperties(Resource resource, Request request, Predicate predicate) {
+
+    Integer taskId = (Integer) resource.getPropertyValue(TASK_ID_PROPERTY_ID);
+
+    StateProvider.Process process = getClusterDefinition().getProcess(taskId);
+
+    if (process != null) {
+      resource.setProperty(TASK_STATUS_PROPERTY_ID, process.isRunning() ? "IN_PROGRESS" : "COMPLETED");
+
+      Set<String> propertyIds = getRequestPropertyIds(request, predicate);
+
+      if (contains(propertyIds, TASK_EXIT_CODE_PROPERTY_ID)) {
+        resource.setProperty(TASK_EXIT_CODE_PROPERTY_ID, process.getExitCode());
+      }
+      if (contains(propertyIds, TASK_STDERR_PROPERTY_ID)) {
+        resource.setProperty(TASK_STDERR_PROPERTY_ID, process.getError());
+      }
+      if (contains(propertyIds, TASK_STOUT_PROPERTY_ID)) {
+        resource.setProperty(TASK_STOUT_PROPERTY_ID, process.getOutput());
+      }
+    }
+  }
+
+  @Override
+  public int updateProperties(Resource resource, Map<String, Object> properties) {
+    //Do nothing
+    return -1;
+  }
+}

+ 449 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/AmbariServer.java

@@ -0,0 +1,449 @@
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+
+import com.google.gson.Gson;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.Scopes;
+import com.google.inject.Singleton;
+import com.google.inject.persist.Transactional;
+import com.google.inject.persist.jpa.JpaPersistModule;
+import com.sun.jersey.spi.container.servlet.ServletContainer;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.api.AmbariPersistFilter;
+import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.controller.HostsMap;
+import org.apache.ambari.server.orm.GuiceJpaInitializer;
+import org.apache.ambari.server.orm.PersistenceType;
+import org.apache.ambari.server.security.authorization.AmbariLdapAuthenticationProvider;
+import org.apache.ambari.server.security.authorization.AmbariLocalUserDetailsService;
+import org.apache.ambari.server.security.authorization.Users;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
+import org.eclipse.jetty.servlet.DefaultServlet;
+import org.eclipse.jetty.servlet.FilterHolder;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.crypto.password.StandardPasswordEncoder;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.GenericWebApplicationContext;
+import org.springframework.web.filter.DelegatingFilterProxy;
+
+import javax.crypto.BadPaddingException;
+import java.io.File;
+import java.net.BindException;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Main Ambari server class.
+ */
+@Singleton
+public class AmbariServer {
+  /**
+   * The Jetty server.
+   */
+  private Server server = null;
+
+  /**
+   * The Ambari configuration.
+   */
+  @Inject
+  Configuration configuration;
+
+  /**
+   * The Guice injector.
+   */
+  @Inject
+  Injector injector;
+
+
+  // Set the SQLProviderModule for the API providers.
+  static {
+    System.setProperty("provider.module.class", "org.apache.ambari.scom.SQLProviderModule");
+  }
+
+  // ----- Constants ---------------------------------------------------------
+
+  private static final String CONTEXT_PATH = "/";
+
+  private static final String SPRING_CONTEXT_LOCATION =
+      "classpath:META-INF/spring-security.xml";
+
+  /**
+   * The logger.
+   */
+  private static final Logger LOG = LoggerFactory.getLogger(AmbariServer.class);
+
+
+  // ----- AmbariServer ------------------------------------------------------
+
+  public static void main(String[] args) throws Exception {
+    Injector injector = Guice.createInjector(new ControllerModule());
+    injector.getInstance(GuiceJpaInitializer.class);
+
+    AmbariServer ambariServer = null;
+    try {
+      LOG.info("Getting the controller");
+      ambariServer = injector.getInstance(AmbariServer.class);
+
+      ComponentSSLConfiguration.instance().init(ambariServer.configuration);
+      SinkConnectionFactory.instance().init(ambariServer.configuration);
+      ClusterDefinitionProvider.instance().init(ambariServer.configuration);
+
+      ambariServer.run();
+    } catch (Throwable t) {
+      LOG.error("Failed to run the Ambari Server", t);
+      if (ambariServer != null) {
+        ambariServer.stop();
+      }
+      System.exit(-1);
+    }
+  }
+
+
+  // ----- helper methods ----------------------------------------------------
+
+  // Run the server
+  private void run() throws Exception {
+    addInMemoryUsers();
+
+    server = new Server();
+
+    try {
+      ClassPathXmlApplicationContext parentSpringAppContext =
+          new ClassPathXmlApplicationContext();
+      parentSpringAppContext.refresh();
+      ConfigurableListableBeanFactory factory = parentSpringAppContext.
+          getBeanFactory();
+      factory.registerSingleton("guiceInjector",
+          injector);
+      factory.registerSingleton("passwordEncoder",
+          injector.getInstance(PasswordEncoder.class));
+      factory.registerSingleton("ambariLocalUserService",
+          injector.getInstance(AmbariLocalUserDetailsService.class));
+      factory.registerSingleton("ambariLdapAuthenticationProvider",
+          injector.getInstance(AmbariLdapAuthenticationProvider.class));
+
+      //Spring Security xml config depends on this Bean
+      String[] contextLocations = {SPRING_CONTEXT_LOCATION};
+      ClassPathXmlApplicationContext springAppContext = new
+          ClassPathXmlApplicationContext(contextLocations, parentSpringAppContext);
+
+      //setting ambari web context
+      ServletContextHandler root = new ServletContextHandler(server, CONTEXT_PATH,
+          ServletContextHandler.SECURITY | ServletContextHandler.SESSIONS);
+
+      //Changing session cookie name to avoid conflicts
+      root.getSessionHandler().getSessionManager().setSessionCookie("AMBARISESSIONID");
+
+      GenericWebApplicationContext springWebAppContext = new GenericWebApplicationContext();
+      springWebAppContext.setServletContext(root.getServletContext());
+      springWebAppContext.setParent(springAppContext);
+      /* Configure web app context */
+      root.setResourceBase(configuration.getWebAppDir());
+
+      root.getServletContext().setAttribute(
+          WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
+          springWebAppContext);
+
+      ServletHolder rootServlet = root.addServlet(DefaultServlet.class, "/");
+      rootServlet.setInitOrder(1);
+
+      //Spring Security Filter initialization
+      DelegatingFilterProxy springSecurityFilter = new DelegatingFilterProxy();
+      springSecurityFilter.setTargetBeanName("springSecurityFilterChain");
+
+      //session-per-request strategy for api
+      root.addFilter(new FilterHolder(injector.getInstance(AmbariPersistFilter.class)), "/api/*", 1);
+
+      if (configuration.getApiAuthentication()) {
+        root.addFilter(new FilterHolder(springSecurityFilter), "/api/*", 1);
+      }
+
+      //Secured connector for 2-way auth
+      SslSelectChannelConnector sslConnectorTwoWay = new
+          SslSelectChannelConnector();
+      sslConnectorTwoWay.setPort(configuration.getTwoWayAuthPort());
+
+      Map<String, String> configsMap = configuration.getConfigsMap();
+      String keystore = configsMap.get(Configuration.SRVR_KSTR_DIR_KEY) +
+          File.separator + configsMap.get(Configuration.KSTR_NAME_KEY);
+      String srvrCrtPass = configsMap.get(Configuration.SRVR_CRT_PASS_KEY);
+      sslConnectorTwoWay.setKeystore(keystore);
+      sslConnectorTwoWay.setTruststore(keystore);
+      sslConnectorTwoWay.setPassword(srvrCrtPass);
+      sslConnectorTwoWay.setKeyPassword(srvrCrtPass);
+      sslConnectorTwoWay.setTrustPassword(srvrCrtPass);
+      sslConnectorTwoWay.setKeystoreType("PKCS12");
+      sslConnectorTwoWay.setTruststoreType("PKCS12");
+      sslConnectorTwoWay.setNeedClientAuth(configuration.getTwoWaySsl());
+
+      //Secured connector for 1-way auth
+      SslContextFactory contextFactory = new SslContextFactory(true);
+      contextFactory.setKeyStorePath(keystore);
+      contextFactory.setTrustStore(keystore);
+      contextFactory.setKeyStorePassword(srvrCrtPass);
+      contextFactory.setKeyManagerPassword(srvrCrtPass);
+      contextFactory.setTrustStorePassword(srvrCrtPass);
+      contextFactory.setKeyStoreType("PKCS12");
+      contextFactory.setTrustStoreType("PKCS12");
+
+      contextFactory.setNeedClientAuth(false);
+      SslSelectChannelConnector sslConnectorOneWay = new SslSelectChannelConnector(contextFactory);
+      sslConnectorOneWay.setPort(configuration.getOneWayAuthPort());
+      sslConnectorOneWay.setAcceptors(2);
+      sslConnectorTwoWay.setAcceptors(2);
+
+      ServletHolder sh = new ServletHolder(ServletContainer.class);
+      sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",
+          "com.sun.jersey.api.core.PackagesResourceConfig");
+      sh.setInitParameter("com.sun.jersey.config.property.packages",
+          "org.apache.ambari.server.api.rest;" +
+              "org.apache.ambari.server.api.services;" +
+              "org.apache.ambari.eventdb.webservice;" +
+              "org.apache.ambari.server.api");
+      sh.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature",
+          "true");
+      root.addServlet(sh, "/api/v1/*");
+      sh.setInitOrder(2);
+
+
+      //Set jetty thread pool
+      server.setThreadPool(new QueuedThreadPool(25));
+
+      /* Configure the API server to use the NIO connectors */
+      SelectChannelConnector apiConnector;
+
+      if (configuration.getApiSSLAuthentication()) {
+        String httpsKeystore = configsMap.get(Configuration.CLIENT_API_SSL_KSTR_DIR_NAME_KEY) +
+            File.separator + configsMap.get(Configuration.CLIENT_API_SSL_KSTR_NAME_KEY);
+        LOG.info("API SSL Authentication is turned on. Keystore - " + httpsKeystore);
+
+        String httpsCrtPass = configsMap.get(Configuration.CLIENT_API_SSL_CRT_PASS_KEY);
+
+        SslSelectChannelConnector sapiConnector = new SslSelectChannelConnector();
+        sapiConnector.setPort(configuration.getClientSSLApiPort());
+        sapiConnector.setKeystore(httpsKeystore);
+        sapiConnector.setTruststore(httpsKeystore);
+        sapiConnector.setPassword(httpsCrtPass);
+        sapiConnector.setKeyPassword(httpsCrtPass);
+        sapiConnector.setTrustPassword(httpsCrtPass);
+        sapiConnector.setKeystoreType("PKCS12");
+        sapiConnector.setTruststoreType("PKCS12");
+        sapiConnector.setMaxIdleTime(configuration.getConnectionMaxIdleTime());
+        apiConnector = sapiConnector;
+      } else {
+        apiConnector = new SelectChannelConnector();
+        apiConnector.setPort(configuration.getClientApiPort());
+        apiConnector.setMaxIdleTime(configuration.getConnectionMaxIdleTime());
+      }
+
+      server.addConnector(apiConnector);
+
+      server.setStopAtShutdown(true);
+      springAppContext.start();
+
+      String osType = configuration.getServerOsType();
+      if (osType == null || osType.isEmpty()) {
+        throw new RuntimeException(Configuration.OS_VERSION_KEY + " is not "
+            + " set in the ambari.properties file");
+      }
+
+      /*
+       * Start the server after controller state is recovered.
+       */
+      server.start();
+      LOG.info("********* Started Server **********");
+
+      server.join();
+      LOG.info("Joined the Server");
+    } catch (BadPaddingException bpe) {
+
+      LOG.error("Bad keystore or private key password. " +
+          "HTTPS certificate re-importing may be required.");
+      throw bpe;
+    } catch (BindException bindException) {
+
+      LOG.error("Could not bind to server port - instance may already be running. " +
+          "Terminating this instance.", bindException);
+      throw bindException;
+    }
+  }
+
+  // Creates default users and roles if in-memory database is used
+  @Transactional
+  private void addInMemoryUsers() {
+    if (getPersistenceType(configuration) == PersistenceType.IN_MEMORY &&
+        configuration.getApiAuthentication()) {
+      LOG.info("In-memory database is used - creating default users");
+      Users users = injector.getInstance(Users.class);
+
+      users.createDefaultRoles();
+      users.createUser("admin", "admin");
+      users.createUser("user", "user");
+      try {
+        users.promoteToAdmin(users.getLocalUser("admin"));
+      } catch (AmbariException e) {
+        throw new RuntimeException(e);
+      }
+    }
+  }
+
+  // Stop the server
+  private void stop() throws Exception {
+    try {
+      server.stop();
+    } catch (Exception e) {
+      LOG.error("Error stopping the server", e);
+    }
+  }
+
+  // get the persistence type for the given configuration
+  private static PersistenceType getPersistenceType(Configuration configuration) {
+    String value = configuration.getProperty(Configuration.SERVER_PERSISTENCE_TYPE_KEY);
+    return value == null ? PersistenceType.IN_MEMORY : PersistenceType.fromString(value);
+  }
+
+
+  // ----- inner class : ControllerModule ------------------------------------
+
+  /**
+   * Used for injection purposes.
+   */
+  private static class ControllerModule extends AbstractModule {
+
+    private final Configuration configuration;
+    private final HostsMap hostsMap;
+
+
+    // ----- Constructors ----------------------------------------------------
+
+    /**
+     * Construct a controller module.
+     */
+    public ControllerModule(){
+      configuration = new Configuration();
+      hostsMap      = new HostsMap(configuration);
+    }
+
+
+    // ----- AbstractModule --------------------------------------------------
+
+    @Override
+    protected void configure() {
+      bind(Configuration.class).toInstance(configuration);
+      bind(HostsMap.class).toInstance(hostsMap);
+      bind(PasswordEncoder.class).toInstance(new StandardPasswordEncoder());
+
+      install(buildJpaPersistModule());
+      bind(Gson.class).in(Scopes.SINGLETON);
+    }
+
+
+    // ----- helper methods --------------------------------------------------
+
+    // Create the JPA persistence module
+    private JpaPersistModule buildJpaPersistModule() {
+      PersistenceType  persistenceType  = getPersistenceType(configuration);
+      JpaPersistModule jpaPersistModule = new JpaPersistModule(Configuration.JDBC_UNIT_NAME);
+      Properties       properties       = new Properties();
+      String           databaseDriver;
+      String           databaseUrl;
+
+      if (persistenceType == PersistenceType.LOCAL) {
+        databaseDriver = configuration.getLocalDatabaseUrl();
+        databaseUrl    = Configuration.JDBC_LOCAL_DRIVER;
+
+      } else {
+        databaseDriver = configuration.getDatabaseDriver();
+        databaseUrl    = configuration.getDatabaseUrl();
+
+        if (persistenceType == PersistenceType.IN_MEMORY) {
+          if(databaseDriver == null){
+            databaseDriver = Configuration.JDBC_IN_MEMROY_DRIVER;
+          }
+          if (databaseUrl == null) {
+            databaseUrl = Configuration.JDBC_IN_MEMORY_URL;
+          }
+        }
+      }
+      if (databaseDriver != null && databaseUrl != null) {
+
+        properties.setProperty("javax.persistence.jdbc.url",    databaseUrl);
+        properties.setProperty("javax.persistence.jdbc.driver", databaseDriver);
+
+        properties.setProperty("eclipselink.logging.level",  "INFO");
+        properties.setProperty("eclipselink.logging.logger", "org.apache.ambari.scom.logging.JpaLogger");
+
+        // custom jdbc properties
+        Map<String, String> custom = configuration.getDatabaseCustomProperties();
+
+        if (0 != custom.size()) {
+          for (Map.Entry<String, String> entry : custom.entrySet()) {
+            properties.setProperty("eclipselink.jdbc.property." + entry.getKey(),
+                entry.getValue());
+          }
+        }
+
+        if (persistenceType == PersistenceType.IN_MEMORY) {
+          properties.setProperty("eclipselink.ddl-generation",       "drop-and-create-tables");
+          properties.setProperty("eclipselink.orm.throw.exceptions", "true");
+          jpaPersistModule.properties(properties);
+        } else {
+          properties.setProperty("javax.persistence.jdbc.user",   configuration.getDatabaseUser());
+          properties.setProperty("javax.persistence.jdbc.password",
+              configuration.getProperty(Configuration.SERVER_JDBC_USER_PASSWD_KEY));
+
+          switch (configuration.getJPATableGenerationStrategy()) {
+            case CREATE:
+              properties.setProperty("eclipselink.ddl-generation", "create-tables");
+              break;
+            case DROP_AND_CREATE:
+              properties.setProperty("eclipselink.ddl-generation", "drop-and-create-tables");
+              break;
+            default:
+              break;
+          }
+          properties.setProperty("eclipselink.ddl-generation.output-mode", "both");
+          properties.setProperty("eclipselink.create-ddl-jdbc-file-name",  "DDL-create.jdbc");
+          properties.setProperty("eclipselink.drop-ddl-jdbc-file-name",    "DDL-drop.jdbc");
+
+          jpaPersistModule.properties(properties);
+        }
+      }
+      return jpaPersistModule;
+    }
+  }
+}
+

+ 176 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/ClusterDefinitionProvider.java

@@ -0,0 +1,176 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+import org.apache.ambari.server.configuration.Configuration;
+
+import java.io.InputStream;
+
+/**
+ * Provider for a input stream to the cluster definition file.
+ */
+public class ClusterDefinitionProvider {
+
+  /**
+   * The file name.
+   */
+  private String fileName;
+
+  /**
+   * The cluster name.
+   */
+  private String clusterName;
+
+  /**
+   * The hadoop version Id.
+   */
+  private String versionId;
+
+  /**
+   * The singleton.
+   */
+  private static ClusterDefinitionProvider singleton = new ClusterDefinitionProvider();
+
+  // ----- Constants ---------------------------------------------------------
+
+  protected static final String SCOM_CLUSTER_DEFINITION_FILENAME         = "scom.cluster.definition.filename";
+  protected static final String DEFAULT_SCOM_CLUSTER_DEFINITION_FILENAME = "clusterproperties.txt";
+
+  protected static final String SCOM_CLUSTER_NAME    = "scom.cluster.name";
+  protected static final String DEFAULT_CLUSTER_NAME = "ambari";
+
+  protected static final String SCOM_VERSION_ID    = "scom.version.id";
+  protected static final String DEFAULT_VERSION_ID = "HDP-1.3.0";
+
+
+  // ----- Constructor -------------------------------------------------------
+
+  protected ClusterDefinitionProvider() {
+  }
+
+
+  // ----- ClusterDefinitionProvider -----------------------------------
+
+  /**
+   * Initialize with the given configuration.
+   *
+   * @param configuration  the configuration
+   */
+  public void init(Configuration configuration) {
+    fileName = configuration.getProperty(SCOM_CLUSTER_DEFINITION_FILENAME);
+    if (fileName == null) {
+      fileName = DEFAULT_SCOM_CLUSTER_DEFINITION_FILENAME;
+    }
+
+    clusterName = configuration.getProperty(SCOM_CLUSTER_NAME);
+    if (clusterName == null) {
+      clusterName = DEFAULT_CLUSTER_NAME;
+    }
+
+    versionId = configuration.getProperty(SCOM_VERSION_ID);
+    if (versionId == null) {
+      versionId = DEFAULT_VERSION_ID;
+    }
+  }
+
+  /**
+   * Get the singleton instance.
+   *
+   * @return the singleton instance
+   */
+  public static ClusterDefinitionProvider instance() {
+    return singleton;
+  }
+
+  /**
+   * Get the cluster definition file name.
+   *
+   * @return the file name
+   */
+  public String getFileName() {
+    return fileName;
+  }
+
+  /**
+   * Get the cluster name.
+   *
+   * @return the cluster name
+   */
+  public String getClusterName() {
+    return clusterName;
+  }
+
+  /**
+   * Get the hadoop version Id.
+   *
+   * @return the version Id
+   */
+  public String getVersionId() {
+    return versionId;
+  }
+
+  /**
+   * Set the associated filename.
+   *
+   * @param fileName  the file name
+   */
+  protected void setFileName(String fileName) {
+    this.fileName = fileName;
+  }
+
+  /**
+   * Set the cluster name.
+   *
+   * @param clusterName  the cluster name
+   */
+  protected void setClusterName(String clusterName) {
+    this.clusterName = clusterName;
+  }
+
+  /**
+   * Set the version id.
+   *
+   * @param versionId  the version id
+   */
+  protected void setVersionId(String versionId) {
+    this.versionId = versionId;
+  }
+
+  /**
+   * Get an input stream to the cluster definition file.
+   *
+   * @return an input stream
+   */
+  public InputStream getInputStream() {
+    InputStream is;
+    String name = this.fileName == null ? DEFAULT_SCOM_CLUSTER_DEFINITION_FILENAME : this.fileName;
+
+    try {
+      is = this.getClass().getClassLoader().getResourceAsStream(name);
+
+      if (is == null) {
+        throw new IllegalStateException("Can't find the resource " + name + " in the classpath.");
+      }
+    } catch (Exception e) {
+      String msg = "Caught exception reading " + name + ".";
+      throw new IllegalStateException(msg, e);
+    }
+    return is;
+  }
+}

+ 63 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/HostInfoProvider.java

@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.scom;
+
+import org.apache.ambari.server.controller.spi.SystemException;
+
+/**
+ * Provider of host information.
+ */
+public interface HostInfoProvider {
+
+  /**
+   * Get the host name for the given cluster name and component name.
+   *
+   * @param clusterName    the cluster name
+   * @param componentName  the component name
+   *
+   * @return the host name
+   *
+   * @throws SystemException if unable to get the host name
+   */
+  public String getHostName(String clusterName, String componentName)
+      throws SystemException;
+
+  /**
+   * Get the host name.
+   *
+   * @param id  the host identifier
+   *
+   * @return the host name
+   *
+   * @throws SystemException if unable to get the host name
+   */
+  public String getHostName(String id)
+      throws SystemException;
+
+  /**
+   * Get the host ip address.
+   *
+   * @param id  the host identifier
+   *
+   * @return the host ip address
+   *
+   * @throws SystemException if unable to get the host address
+   */
+  public String getHostAddress(String id)
+      throws SystemException;
+}

+ 304 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SQLPropertyProvider.java

@@ -0,0 +1,304 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+import org.apache.ambari.server.controller.internal.AbstractPropertyProvider;
+import org.apache.ambari.server.controller.internal.PropertyInfo;
+import org.apache.ambari.server.controller.jdbc.ConnectionFactory;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.spi.TemporalInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.text.NumberFormat;
+import java.text.ParsePosition;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * SQL based property/metrics provider required for ambari-scom.
+ */
+public class SQLPropertyProvider extends AbstractPropertyProvider {
+
+  private final HostInfoProvider hostProvider;
+
+  private final String clusterNamePropertyId;
+
+  private final String hostNamePropertyId;
+
+  private final String componentNamePropertyId;
+
+  private final ConnectionFactory connectionFactory;
+
+
+  // ----- Constants ---------------------------------------------------------
+
+  private static final String GET_METRICS_STATEMENT = "select * from dbo.ufGetMetrics(?, ?, ?, ?, ?, ?, ?)";
+
+  protected final static Logger LOG =
+      LoggerFactory.getLogger(SQLPropertyProvider.class);
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  public SQLPropertyProvider(
+      Map<String, Map<String, PropertyInfo>> componentPropertyInfoMap,
+      HostInfoProvider hostProvider,
+      String clusterNamePropertyId,
+      String hostNamePropertyId,
+      String componentNamePropertyId,
+      ConnectionFactory connectionFactory) {
+    super(componentPropertyInfoMap);
+    this.hostProvider             = hostProvider;
+    this.clusterNamePropertyId    = clusterNamePropertyId;
+    this.hostNamePropertyId       = hostNamePropertyId;
+    this.componentNamePropertyId  = componentNamePropertyId;
+    this.connectionFactory        = connectionFactory;
+  }
+
+
+  // ----- PropertyProvider --------------------------------------------------
+
+  @Override
+  public Set<Resource> populateResources(Set<Resource> resources, Request request, Predicate predicate)
+      throws SystemException {
+    Set<Resource> keepers = new HashSet<Resource>();
+    try {
+      Connection connection = connectionFactory.getConnection();
+      try {
+        PreparedStatement preparedStatement = connection.prepareStatement(GET_METRICS_STATEMENT);
+        try {
+          for (Resource resource : resources) {
+            if (populateResource(resource, request, predicate, preparedStatement)) {
+              keepers.add(resource);
+            }
+          }
+        } finally {
+          preparedStatement.close();
+        }
+      } finally {
+        connection.close();
+      }
+    } catch (SQLException e) {
+      if (LOG.isErrorEnabled()) {
+        LOG.error("Error during populateResources call : caught exception", e);
+      }
+      throw new SystemException("Error during populateResources call : caught exception", e);
+    }
+    return keepers;
+  }
+
+
+  // ----- helper methods ----------------------------------------------------
+
+  // Populate the given resource
+  private boolean populateResource(Resource resource, Request request, Predicate predicate, PreparedStatement preparedStatement) throws SystemException {
+
+    Set<String> ids = getRequestPropertyIds(request, predicate);
+    if (ids.isEmpty()) {
+      // no properties requested ... nothing to do.
+      return true;
+    }
+
+    String componentName = (String) resource.getPropertyValue(componentNamePropertyId);
+
+    if (getComponentMetrics().get(componentName) == null) {
+      // no metrics defined for the given component ... nothing to do.
+      return true;
+    }
+
+    String clusterName = (String) resource.getPropertyValue(clusterNamePropertyId);
+    String hostName    = getHost(resource, clusterName, componentName);
+
+    if (hostName == null) {
+      throw new SystemException(
+          "Unable to get metrics.  No host name for " + componentName, null);
+    }
+
+    for (String id : ids) {
+      Map<String, PropertyInfo> propertyInfoMap = getPropertyInfoMap(componentName, id);
+
+      for (Map.Entry<String, PropertyInfo> entry: propertyInfoMap.entrySet()) {
+        String       propertyKey  = entry.getKey();
+        PropertyInfo propertyInfo = entry.getValue();
+        String       propertyId   = propertyInfo.getPropertyId();
+        TemporalInfo temporalInfo = request.getTemporalInfo(id);
+
+        if ((propertyInfo.isPointInTime() && temporalInfo == null) ||
+            (propertyInfo.isTemporal()    && temporalInfo != null)) {
+
+          long startTime;
+          long endTime;
+
+          if (temporalInfo != null) {
+            Long endTimeSeconds = temporalInfo.getEndTime();
+
+            endTime   = endTimeSeconds != -1 ? endTimeSeconds * 1000 : Long.MAX_VALUE;
+            startTime = temporalInfo.getStartTime() * 1000;
+          } else {
+            startTime = 0L;
+            endTime   = Long.MAX_VALUE;
+          }
+
+          String[] parts = propertyId.split("\\.");
+          int      size  = parts.length;
+
+          if (size >= 3) {
+            List<DataPoint> dataPoints = getMetric(startTime, endTime, parts[size - 3], parts[size - 2], parts[size - 1],
+                                                   componentName.toLowerCase(), hostName, preparedStatement);
+
+            if (dataPoints != null) {
+              if (temporalInfo == null){
+                // return the value of the last data point
+                int          length = dataPoints.size();
+                Serializable value  = length > 0 ? dataPoints.get(length - 1).getValue() : 0;
+                resource.setProperty(propertyKey, value);
+              } else {
+
+                Number[][] dp = new Number[dataPoints.size()][2];
+                for (int i = 0; i < dp.length; i++) {
+                  dp[i][0] = dataPoints.get(i).getValue();
+                  dp[i][1] = dataPoints.get(i).getTimestamp();
+                }
+                resource.setProperty(propertyKey, dp);
+              }
+            }
+          } else {
+            if (LOG.isWarnEnabled()) {
+              LOG.warn("Can't get metrics for " + id + " : " + propertyId);
+            }
+          }
+        }
+      }
+    }
+
+    return true;
+  }
+
+  // get a metric from a sql connection
+  private List<DataPoint> getMetric(long startTime, long endTime, String recordTypeContext,
+                        String recordTypeName, String metricName, String serviceName, String nodeName,
+                        PreparedStatement preparedStatement) throws SystemException {
+
+    if (recordTypeContext == null || recordTypeName == null || nodeName == null) {
+      return null;
+    }
+
+    int columnId = 1;
+    List<DataPoint> results;
+    try {
+      preparedStatement.clearParameters();
+
+      preparedStatement.setLong(columnId++, startTime);
+      preparedStatement.setLong(columnId++, endTime);
+      preparedStatement.setNString(columnId++, recordTypeContext);
+      preparedStatement.setNString(columnId++, recordTypeName);
+      preparedStatement.setNString(columnId++, metricName);
+      preparedStatement.setNString(columnId++, serviceName);
+      preparedStatement.setNString(columnId, nodeName);
+
+      ResultSet rs = preparedStatement.executeQuery();
+
+      results = new LinkedList<DataPoint>();
+
+      if (rs != null) {
+
+        //(RecordTimeStamp bigint, MetricValue NVARCHAR(512))
+        while (rs.next()) {
+
+          ParsePosition parsePosition = new ParsePosition(0);
+          NumberFormat  numberFormat  = NumberFormat.getInstance();
+          Number        parsedNumber  = numberFormat.parse(rs.getNString("MetricValue"), parsePosition);
+
+          results.add(new DataPoint(rs.getLong("RecordTimeStamp"), parsedNumber));
+        }
+      }
+    } catch (SQLException e) {
+      throw new SystemException("Error during getMetric call : caught exception - ", e);
+    }
+    return results;
+  }
+
+  // get the hostname for a given resource
+  private String getHost(Resource resource, String clusterName, String componentName) throws SystemException {
+    return hostNamePropertyId == null ?
+        hostProvider.getHostName(clusterName, componentName) :
+        hostProvider.getHostName((String) resource.getPropertyValue(hostNamePropertyId));
+  }
+
+
+  // ----- inner class : DataPoint -------------------------------------------
+
+  /**
+   * Structure to hold a single datapoint (value/timestamp pair) retrieved from the db.
+   */
+  private static class DataPoint {
+    private final long timestamp;
+    private final Number value;
+
+    // ----- Constructor -------------------------------------------------
+
+    /**
+     * Construct a data point from the given value and timestamp.
+     *
+     * @param timestamp  the timestamp
+     * @param value      the value
+     */
+    private DataPoint(long timestamp, Number value) {
+      this.timestamp = timestamp;
+      this.value = value;
+    }
+
+    // ----- DataPoint ---------------------------------------------------
+
+    /**
+     * Get the timestamp value.
+     * @return the timestamp
+     */
+    public long getTimestamp() {
+      return timestamp;
+    }
+
+    /**
+     * Get the value.
+     * @return the value
+     */
+    public Number getValue() {
+      return value;
+    }
+
+    // ----- Object overrides --------------------------------------------
+
+    @Override
+    public String toString() {
+      return "{" +value + " : " + timestamp + "}";
+    }
+  }
+}

+ 332 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SQLProviderModule.java

@@ -0,0 +1,332 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+import org.apache.ambari.msi.AbstractResourceProvider;
+import org.apache.ambari.msi.ClusterDefinition;
+import org.apache.ambari.msi.StateProvider;
+import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
+import org.apache.ambari.server.controller.internal.DefaultProviderModule;
+import org.apache.ambari.server.controller.internal.URLStreamProvider;
+import org.apache.ambari.server.controller.jdbc.ConnectionFactory;
+import org.apache.ambari.server.controller.jmx.JMXPropertyProvider;
+import org.apache.ambari.server.controller.spi.PropertyProvider;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceProvider;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Provider module used to install PropertyProviders required for ambari-scom.
+ */
+public class SQLProviderModule extends DefaultProviderModule implements HostInfoProvider, StateProvider {
+  private final ClusterDefinition clusterDefinition;
+
+  // TODO : these elements should be injected...
+  private final ConnectionFactory connectionFactory = SinkConnectionFactory.instance();
+  private final ComponentSSLConfiguration sslConfiguration = ComponentSSLConfiguration.instance();
+  private final URLStreamProvider urlStreamProvider = new URLStreamProvider(5000, 10000,
+      sslConfiguration.getTruststorePath(), sslConfiguration.getTruststorePassword(), sslConfiguration.getTruststoreType());
+
+
+  // ----- Constants ---------------------------------------------------------
+
+  private static Map<String, String> serviceNames = new HashMap<String, String>();
+
+  static {
+    serviceNames.put("NAMENODE",           "namenode");
+    serviceNames.put("SECONDARY_NAMENODE", "secondarynamenode");
+    serviceNames.put("JOBTRACKER",         "jobtracker");
+    serviceNames.put("HISTORY_SERVER",     "historyserver");
+    serviceNames.put("HIVE_SERVER",        "hiveserver");
+    serviceNames.put("HIVE_SERVER2",       "hiveserver2");
+    serviceNames.put("HIVE_METASTORE",     "metastore");
+    serviceNames.put("HIVE_CLIENT",        "hwi");
+    serviceNames.put("OOZIE_SERVER",       "oozieservice");
+    serviceNames.put("FLUME_SERVER",       "flumagent");
+    serviceNames.put("HBASE_MASTER",       "master");
+    serviceNames.put("HBASE_REGIONSERVER", "regionserver");
+    serviceNames.put("ZOOKEEPER_SERVER",   "zkServer");
+    serviceNames.put("DATANODE",           "datanode");
+    serviceNames.put("TASKTRACKER",        "tasktracker");
+    serviceNames.put("WEBHCAT_SERVER",     "templeton");
+  }
+
+  private static final String STATE_PREFIX = "STATE              : ";
+
+
+  // ----- Constructor -------------------------------------------------------
+
+  public SQLProviderModule() {
+    clusterDefinition = new ClusterDefinition(this, ClusterDefinitionProvider.instance(), this);
+  }
+
+
+  // ----- AbstractProviderModule --------------------------------------------
+
+  @Override
+  protected ResourceProvider createResourceProvider(Resource.Type type) {
+    return AbstractResourceProvider.getResourceProvider(type, clusterDefinition);
+  }
+
+  @Override
+  protected void createPropertyProviders(Resource.Type type) {
+
+    List<PropertyProvider> providers = new LinkedList<PropertyProvider>();
+
+    switch (type) {
+      case Component:
+
+        providers.add(new JMXPropertyProvider(
+            PropertyHelper.getJMXPropertyIds(type, PropertyHelper.MetricsVersion.HDP1),
+            urlStreamProvider,
+            this,
+            PropertyHelper.getPropertyId("ServiceComponentInfo", "cluster_name"),
+            null,
+            PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"),
+            PropertyHelper.getPropertyId("ServiceComponentInfo", "state"),
+            Collections.singleton("STARTED")));
+
+        providers.add(new SQLPropertyProvider(
+            PropertyHelper.getGangliaPropertyIds(type, PropertyHelper.MetricsVersion.HDP1),
+            this,
+            PropertyHelper.getPropertyId("ServiceComponentInfo", "cluster_name"),
+            null,
+            PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"),
+            connectionFactory));
+        break;
+      case HostComponent:
+
+        providers.add(new JMXPropertyProvider(
+            PropertyHelper.getJMXPropertyIds(type, PropertyHelper.MetricsVersion.HDP1),
+            urlStreamProvider,
+            this,
+            PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+            PropertyHelper.getPropertyId("HostRoles", "host_name"),
+            PropertyHelper.getPropertyId("HostRoles", "component_name"),
+            PropertyHelper.getPropertyId("HostRoles", "state"),
+            Collections.singleton("STARTED")));
+
+        providers.add(new SQLPropertyProvider(
+            PropertyHelper.getGangliaPropertyIds(type, PropertyHelper.MetricsVersion.HDP1),
+            this,
+            PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+            PropertyHelper.getPropertyId("HostRoles", "host_name"),
+            PropertyHelper.getPropertyId("HostRoles", "component_name"),
+            connectionFactory));
+        break;
+      default:
+        break;
+    }
+    putPropertyProviders(type, providers);
+  }
+
+  // ----- HostProvider ------------------------------------------------------
+
+  @Override
+  public String getHostName(String clusterName, String componentName) throws SystemException {
+    return getClusterNodeName(super.getHostName(clusterName, componentName));
+  }
+
+  @Override
+  public String getHostName(String id) throws SystemException {
+    return getClusterNodeName(id);
+  }
+
+  @Override
+  public String getHostAddress(String id) throws SystemException {
+    return getClusterHostAddress(id);
+  }
+
+
+  // ----- StateProvider -----------------------------------------------------
+
+  @Override
+  public State getRunningState(String hostName, String componentName) {
+    String serviceName = getServiceName(componentName);
+    if (serviceName != null) {
+      String[] cmdStrings = {"sc", "\\\\" + hostName, "query", "\"" + serviceName + "\""}; // Windows specific command
+
+      java.lang.Process process = runProcess(cmdStrings);
+
+      if (process.exitValue() == 0) {
+
+        String response = getProcessResponse(process.getInputStream());
+
+        int i = response.indexOf(STATE_PREFIX);
+        if (i >= 0) {
+          int state = Integer.parseInt(response.substring(i + STATE_PREFIX.length(), i + STATE_PREFIX.length() + 1));
+          switch (state) {
+            case (1): // service stopped
+              return State.Stopped;
+            case (4): // service started
+              return State.Running;
+          }
+        }
+      }
+    }
+    return State.Unknown;
+  }
+
+  @Override
+  public Process setRunningState(String hostName, String componentName, State state) {
+    String serviceName = getServiceName(componentName);
+    if (serviceName != null) {
+      String command = state == State.Running ? "start" : "stop";
+      String[] cmdStrings = {"sc", "\\\\" + hostName, command, "\"" + serviceName + "\""};  // Windows specific command
+
+      return new StateProcess(runProcess(cmdStrings));
+    }
+    return null;
+  }
+
+
+  // ----- utility methods ---------------------------------------------------
+
+  // get the hostname
+  private String getClusterNodeName(String hostname) throws SystemException {
+    try {
+      if (hostname.equalsIgnoreCase("localhost")) {
+        return InetAddress.getLocalHost().getCanonicalHostName();
+      }
+      return InetAddress.getByName(hostname).getCanonicalHostName();
+    } catch (Exception e) {
+      throw new SystemException("Error getting hostname.", e);
+    }
+  }
+
+  // get the hostname
+  private String getClusterHostAddress(String hostname) throws SystemException {
+    try {
+      if (hostname.equalsIgnoreCase("localhost")) {
+        return InetAddress.getLocalHost().getHostAddress();
+      }
+      return InetAddress.getByName(hostname).getHostAddress();
+    } catch (Exception e) {
+      throw new SystemException("Error getting ip address.", e);
+    }
+  }
+
+  // get the Windows service name from the given component name
+  private String getServiceName(String componentName) {
+    return serviceNames.get(componentName);
+  }
+
+  // run a process specified by the given command strings
+  private java.lang.Process runProcess(String... commands) {
+    Runtime runtime = Runtime.getRuntime();
+    java.lang.Process process;
+    try {
+      process = runtime.exec(commands);
+
+      process.waitFor();
+    } catch (Exception e) {
+      return null;
+    }
+    return process;
+  }
+
+  // get the response text from a completed process stream
+  private static String getProcessResponse(InputStream stream) {
+
+    StringBuilder  sb       = new StringBuilder();
+    BufferedReader stdInput = new BufferedReader(new InputStreamReader(stream));
+
+    try {
+
+      String line;
+
+      while ((line = stdInput.readLine()) != null) {
+        sb.append(line);
+      }
+
+    } catch (Exception e) {
+      return null;
+    }
+    return sb.toString();
+  }
+
+
+  // ----- inner class : StateProcess ----------------------------------------
+
+  public static class StateProcess implements Process {
+    private final java.lang.Process process;
+    private String output = null;
+    private String error = null;
+
+    public StateProcess(java.lang.Process process) {
+      this.process = process;
+    }
+
+    @Override
+    public boolean isRunning() {
+      try {
+        process.exitValue();
+      } catch (IllegalThreadStateException e) {
+        return true;
+      }
+      return false;
+    }
+
+    @Override
+    public int getExitCode() {
+      return process.exitValue();
+    }
+
+    @Override
+    public String getOutput() {
+      if (output != null) {
+        return output;
+      }
+
+      String processResponse = getProcessResponse(process.getInputStream());
+
+      if (!isRunning()){
+        output = processResponse;
+      }
+
+      return processResponse;
+    }
+
+    @Override
+    public String getError() {
+      if (error != null) {
+        return error;
+      }
+
+      String processResponse = getProcessResponse(process.getErrorStream());
+
+      if (!isRunning()){
+        error = processResponse;
+      }
+
+      return processResponse;
+    }
+  }
+}

+ 120 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SinkConnectionFactory.java

@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.controller.jdbc.ConnectionFactory;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+/**
+ * Factory for the sink database connection.
+ */
+public class SinkConnectionFactory implements ConnectionFactory {
+
+  /**
+   * The database URL.
+   */
+  private String databaseUrl;
+
+  /**
+   * The database driver.
+   */
+  private String databaseDriver;
+
+  /**
+   * Indicates whether or not the driver has been initialized
+   */
+  private boolean connectionInitialized = false;
+
+  /**
+   * The singleton.
+   */
+  private static SinkConnectionFactory singleton = new SinkConnectionFactory();
+
+  // ----- Constants ---------------------------------------------------------
+
+  protected static final String SCOM_SINK_DB_URL    = "scom.sink.db.url";
+  protected static final String SCOM_SINK_DB_DRIVER = "scom.sink.db.driver";
+
+
+  // ----- Constructor -------------------------------------------------------
+
+  protected SinkConnectionFactory() {
+  }
+
+
+  // ----- SinkConnectionFactory ---------------------------------------------
+
+  /**
+   * Initialize with the given configuration.
+   *
+   * @param configuration  the configuration
+   */
+  public void init(Configuration configuration) {
+    this.databaseUrl    = configuration.getProperty(SCOM_SINK_DB_URL);
+    this.databaseDriver = configuration.getProperty(SCOM_SINK_DB_DRIVER);
+  }
+
+  /**
+   * Get the singleton instance.
+   *
+   * @return the singleton instance
+   */
+  public static SinkConnectionFactory instance() {
+    return singleton;
+  }
+
+  /**
+   * Get the database URL.
+   *
+   * @return the database URL
+   */
+  public String getDatabaseUrl() {
+    return databaseUrl;
+  }
+
+  /**
+   * Get the database driver.
+   *
+   * @return the database driver
+   */
+  public String getDatabaseDriver() {
+    return databaseDriver;
+  }
+
+// ----- ConnectionFactory -----------------------------------------------
+
+  @Override
+  public Connection getConnection() throws SQLException {
+    synchronized (this) {
+      if (!connectionInitialized) {
+        connectionInitialized = true;
+        try {
+          Class.forName(databaseDriver);
+        } catch (ClassNotFoundException e) {
+          throw new SQLException("Can't load the driver class.", e);
+        }
+      }
+    }
+    return DriverManager.getConnection(databaseUrl);
+  }
+}

+ 185 - 0
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/logging/JpaLogger.java

@@ -0,0 +1,185 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom.logging;
+
+import org.eclipse.persistence.logging.AbstractSessionLog;
+import org.eclipse.persistence.logging.EclipseLinkLogRecord;
+import org.eclipse.persistence.logging.SessionLogEntry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.logging.Formatter;
+import java.util.logging.Level;
+import java.util.logging.SimpleFormatter;
+
+/**
+ * Logger for JPA log messages.
+ */
+public class JpaLogger extends AbstractSessionLog {
+
+  /**
+   * The formatter.
+   */
+  private final Formatter formatter = new SimpleFormatter();
+
+  /**
+   * The log level.
+   */
+  public Level logLevel = Level.WARNING;
+
+
+  // ----- Constants ---------------------------------------------------------
+
+  /**
+   * The logger.
+   */
+  private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(JpaLogger.class);
+
+  /**
+   * The java log levels.
+   */
+  public static final Level[] JAVA_LOG_LEVELS = new Level[]{
+      Level.ALL,     Level.FINEST, Level.FINER,
+      Level.FINE,    Level.CONFIG, Level.INFO,
+      Level.WARNING, Level.SEVERE, Level.OFF
+  };
+
+
+  // ----- AbstractSessionLog ------------------------------------------------
+
+  @Override
+  public void log(SessionLogEntry sessionLogEntry) {
+
+    Logger logger = getLogger();
+
+    switch (sessionLogEntry.getLevel()) {
+      case SEVERE:
+        logger.error(getLogMessage(sessionLogEntry));
+        break;
+
+      case WARNING:
+        logger.warn(getLogMessage(sessionLogEntry));
+        break;
+
+      case INFO:
+      case CONFIG:
+        logger.info(getLogMessage(sessionLogEntry));
+        break;
+
+      case FINE:
+      case FINER:
+      case FINEST:
+        logger.debug(getLogMessage(sessionLogEntry));
+        break;
+
+      case ALL:
+        logger.trace(getLogMessage(sessionLogEntry));
+        break;
+    }
+  }
+
+  @Override
+  public void throwing(Throwable throwable) {
+    getLogger().error(null, throwable);
+  }
+
+  @Override
+  public boolean shouldLog(int level, String category) {
+    return getJavaLogLevel(level).intValue() >= logLevel.intValue();
+  }
+
+
+// ----- accessors ---------------------------------------------------------
+
+  /**
+   * Get the log level.
+   *
+   * @return the log level
+   */
+  public Level getLogLevel() {
+    return logLevel;
+  }
+
+  /**
+   * Set the log level.
+   *
+   * @param logLevel the log level
+   */
+  public void setLogLevel(Level logLevel) {
+    this.logLevel = logLevel;
+  }
+
+  /**
+   * Get the associated logger.
+   *
+   * @return the logger
+   */
+  protected org.slf4j.Logger getLogger() {
+    return LOG;
+  }
+
+  /**
+   * Get the associated formatter.
+   *
+   * @return the formatter
+   */
+  protected Formatter getFormatter() {
+    return formatter;
+  }
+
+
+  // ----- helper methods ----------------------------------------------------
+
+  // gets the log message from the given session log entry
+  private String getLogMessage(SessionLogEntry sessionLogEntry) {
+    return getFormatter().format(getLogRecord(sessionLogEntry,
+        getJavaLogLevel(sessionLogEntry.getLevel())));
+  }
+
+  // get a log record for the given session log entry
+  private EclipseLinkLogRecord getLogRecord(SessionLogEntry sessionLogEntry, Level level) {
+    EclipseLinkLogRecord logRecord =
+        new EclipseLinkLogRecord(level, formatMessage(sessionLogEntry));
+
+    logRecord.setLoggerName(sessionLogEntry.getNameSpace());
+    logRecord.setShouldPrintDate(shouldPrintDate());
+    logRecord.setShouldPrintThread(shouldPrintThread());
+
+    Throwable exception = sessionLogEntry.getException();
+    if (exception != null) {
+      logRecord.setThrown(exception);
+      logRecord.setShouldLogExceptionStackTrace(shouldLogExceptionStackTrace());
+    }
+
+    if (shouldPrintConnection()) {
+      logRecord.setConnection(sessionLogEntry.getConnection());
+    }
+
+    if (shouldPrintSession()) {
+      logRecord.setSessionString(getSessionString(sessionLogEntry.getSession()));
+    }
+
+    return logRecord;
+  }
+
+  // get the Java log level for the given eclipse log level
+  private static Level getJavaLogLevel(int level) {
+    return level >= ALL && level <= OFF ? JAVA_LOG_LEVELS[level] : Level.OFF;
+  }
+}

+ 46 - 0
contrib/ambari-scom/ambari-scom-server/src/main/resources/META-INF/spring-security.xml

@@ -0,0 +1,46 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<beans:beans xmlns="http://www.springframework.org/schema/security"
+             xmlns:beans="http://www.springframework.org/schema/beans"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://www.springframework.org/schema/beans
+                    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                    http://www.springframework.org/schema/security
+                    http://www.springframework.org/schema/security/spring-security-3.1.xsd">
+
+    <http use-expressions="true"
+          disable-url-rewriting="true" entry-point-ref="ambariEntryPoint">
+        <http-basic entry-point-ref="ambariEntryPoint"/>
+        <intercept-url pattern="/**" access="isAuthenticated()" method="GET"/>
+        <intercept-url pattern="/**" access="hasRole('ADMIN')"/>
+    </http>
+
+    <!--<ldap-server id="ldapServer" root="dc=ambari,dc=apache,dc=org"/>-->
+
+    <authentication-manager>
+
+        <authentication-provider user-service-ref="ambariLocalUserService">
+            <password-encoder ref="passwordEncoder"/>
+        </authentication-provider>
+
+        <authentication-provider ref="ambariLdapAuthenticationProvider"/>
+
+    </authentication-manager>
+
+    <beans:bean id="ambariEntryPoint" class="org.apache.ambari.server.security.AmbariEntryPoint">
+    </beans:bean>
+</beans:beans>

+ 37 - 0
contrib/ambari-scom/ambari-scom-server/src/main/resources/log4j.properties

@@ -0,0 +1,37 @@
+# Copyright 2011 The Apache Software Foundation
+# 
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Define some default values that can be overridden by system properties
+# Root logger option
+log4j.rootLogger=INFO,file
+
+# Direct log messages to a log file
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=/var/log/ambari-server/ambari-server.log
+log4j.appender.file.MaxFileSize=10MB
+log4j.appender.file.MaxBackupIndex=20
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p [%t] %c{1}:%L - %m%n
+
+# Log config changes
+log4j.logger.configchange=INFO,configchange
+log4j.additivity.configchange=false
+log4j.appender.configchange=org.apache.log4j.FileAppender
+log4j.appender.configchange.File=/var/log/ambari-server/ambari-config-changes.log
+log4j.appender.configchange.layout=org.apache.log4j.PatternLayout
+log4j.appender.configchange.layout.ConversionPattern=%d{ISO8601} %5p - %m%n

+ 118 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ClusterDefinitionTest.java

@@ -0,0 +1,118 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import org.apache.ambari.scom.TestClusterDefinitionProvider;
+import org.apache.ambari.scom.TestHostInfoProvider;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Set;
+
+/**
+ */
+public class ClusterDefinitionTest {
+  @Test
+  public void testGetServices() throws Exception {
+
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+
+    Set<String> services = clusterDefinition.getServices();
+
+    Assert.assertTrue(services.contains("HDFS"));
+    Assert.assertTrue(services.contains("FLUME"));
+    Assert.assertTrue(services.contains("OOZIE"));
+    Assert.assertTrue(services.contains("MAPREDUCE"));
+    Assert.assertTrue(services.contains("HBASE"));
+    Assert.assertTrue(services.contains("ZOOKEEPER"));
+    Assert.assertTrue(services.contains("HIVE"));
+    Assert.assertTrue(services.contains("WEBHCAT"));
+  }
+
+  @Test
+  public void testGetHosts() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+
+    Set<String> hosts = clusterDefinition.getHosts();
+
+    Assert.assertTrue(hosts.contains("NAMENODE_MASTER.acme.com"));
+    Assert.assertTrue(hosts.contains("SECONDARY_NAMENODE_MASTER.acme.com"));
+    Assert.assertTrue(hosts.contains("FLUME_SERVICE1.acme.com"));
+    Assert.assertTrue(hosts.contains("FLUME_SERVICE2.acme.com"));
+    Assert.assertTrue(hosts.contains("FLUME_SERVICE3.acme.com"));
+    Assert.assertTrue(hosts.contains("HBASE_MASTER.acme.com"));
+    Assert.assertTrue(hosts.contains("HIVE_SERVER_MASTER.acme.com"));
+    Assert.assertTrue(hosts.contains("JOBTRACKER_MASTER.acme.com"));
+    Assert.assertTrue(hosts.contains("OOZIE_SERVER_MASTER.acme.com"));
+    Assert.assertTrue(hosts.contains("slave1.acme.com"));
+    Assert.assertTrue(hosts.contains("slave2.acme.com"));
+    Assert.assertTrue(hosts.contains("slave3.acme.com"));
+    Assert.assertTrue(hosts.contains("WEBHCAT_MASTER.acme.com"));
+  }
+
+  @Test
+  public void testGetComponents() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+
+    Set<String> components = clusterDefinition.getComponents("HDFS");
+    Assert.assertTrue(components.contains("NAMENODE"));
+    Assert.assertTrue(components.contains("SECONDARY_NAMENODE"));
+    Assert.assertTrue(components.contains("DATANODE"));
+
+    components = clusterDefinition.getComponents("MAPREDUCE");
+    Assert.assertTrue(components.contains("JOBTRACKER"));
+    Assert.assertTrue(components.contains("TASKTRACKER"));
+
+    components = clusterDefinition.getComponents("FLUME");
+    Assert.assertTrue(components.contains("FLUME_SERVER"));
+
+    components = clusterDefinition.getComponents("OOZIE");
+    Assert.assertTrue(components.contains("OOZIE_SERVER"));
+
+    components = clusterDefinition.getComponents("WEBHCAT");
+    Assert.assertTrue(components.contains("WEBHCAT_SERVER"));
+
+    components = clusterDefinition.getComponents("HBASE");
+    Assert.assertTrue(components.contains("HBASE_MASTER"));
+    Assert.assertTrue(components.contains("HBASE_REGIONSERVER"));
+
+    components = clusterDefinition.getComponents("ZOOKEEPER");
+    Assert.assertTrue(components.contains("ZOOKEEPER_SERVER"));
+
+    components = clusterDefinition.getComponents("HIVE");
+    Assert.assertTrue(components.contains("HIVE_SERVER"));
+  }
+
+  @Test
+  public void testGetHostComponents() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+
+    Set<String> hostComponents = clusterDefinition.getHostComponents("HDFS", "NAMENODE_MASTER.acme.com");
+
+    Assert.assertTrue(hostComponents.contains("NAMENODE"));
+
+    hostComponents = clusterDefinition.getHostComponents("HDFS", "slave1.acme.com");
+
+    Assert.assertTrue(hostComponents.contains("DATANODE"));
+
+    hostComponents = clusterDefinition.getHostComponents("HDFS", "slave2.acme.com");
+
+    Assert.assertTrue(hostComponents.contains("DATANODE"));
+  }
+}

+ 99 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ClusterProviderTest.java

@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import junit.framework.Assert;
+import org.apache.ambari.scom.TestClusterDefinitionProvider;
+import org.apache.ambari.scom.TestHostInfoProvider;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PredicateBuilder;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * Tests for ClusterProvider
+ */
+public class ClusterProviderTest {
+
+  @Test
+  public void testGetResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+
+    ClusterProvider provider = new ClusterProvider(clusterDefinition);
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
+    Assert.assertEquals(1, resources.size());
+    Assert.assertEquals("myCluster", resources.iterator().next().getPropertyValue(ClusterProvider.CLUSTER_NAME_PROPERTY_ID));
+  }
+
+  @Test
+  public void testGetResourcesWithPredicate() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+
+    ClusterProvider provider = new ClusterProvider(clusterDefinition);
+
+    Predicate predicate = new PredicateBuilder().property(ClusterProvider.CLUSTER_NAME_PROPERTY_ID).equals("myCluster").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+    Resource next = resources.iterator().next();
+    Assert.assertEquals("myCluster",    next.getPropertyValue(ClusterProvider.CLUSTER_NAME_PROPERTY_ID));
+    Assert.assertEquals("HDP-1.2.9", next.getPropertyValue(ClusterProvider.CLUSTER_VERSION_PROPERTY_ID));
+
+    predicate = new PredicateBuilder().property(ClusterProvider.CLUSTER_NAME_PROPERTY_ID).equals("non-existent Cluster").toPredicate();
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertTrue(resources.isEmpty());
+  }
+
+  @Test
+  public void testCreateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ClusterProvider provider = new ClusterProvider(clusterDefinition);
+
+    try {
+      provider.createResources(PropertyHelper.getReadRequest());
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+
+  @Test
+  public void testUpdateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ClusterProvider provider = new ClusterProvider(clusterDefinition);
+
+    provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>(), null), null);
+  }
+
+  @Test
+  public void testDeleteResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ClusterProvider provider = new ClusterProvider(clusterDefinition);
+
+    try {
+      provider.deleteResources(null);
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+}

+ 124 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ComponentProviderTest.java

@@ -0,0 +1,124 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import junit.framework.Assert;
+import org.apache.ambari.scom.TestClusterDefinitionProvider;
+import org.apache.ambari.scom.TestHostInfoProvider;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PredicateBuilder;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * Tests for ComponentProvider.
+ */
+public class ComponentProviderTest {
+
+  @Test
+  public void testGetResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ComponentProvider provider = new ComponentProvider(clusterDefinition);
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
+    Assert.assertEquals(16, resources.size());
+  }
+
+  @Test
+  public void testGetResourcesWithPredicate() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ComponentProvider provider = new ComponentProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(ComponentProvider.COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("TASKTRACKER").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    predicate = new PredicateBuilder().property(ComponentProvider.COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("TASKTRACKER").or().
+        property(ComponentProvider.COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("DATANODE").toPredicate();
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(2, resources.size());
+
+    predicate = new PredicateBuilder().property(ComponentProvider.COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("BadComponent").toPredicate();
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertTrue(resources.isEmpty());
+  }
+
+  @Test
+  public void testCreateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ComponentProvider provider = new ComponentProvider(clusterDefinition);
+
+    try {
+      provider.createResources(PropertyHelper.getReadRequest());
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+
+  @Test
+  public void testUpdateResources() throws Exception {
+    TestStateProvider stateProvider = new TestStateProvider();
+    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ComponentProvider provider = new ComponentProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(ComponentProvider.COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("TASKTRACKER").toPredicate();
+
+    HashMap<String, Object> properties = new HashMap<String, Object>();
+
+    properties.put(ComponentProvider.COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    Request updateRequest = PropertyHelper.getUpdateRequest(properties, null);
+
+    provider.updateResources(updateRequest, predicate);
+
+    Assert.assertEquals(StateProvider.State.Running, stateProvider.getState());
+
+    properties.put(ComponentProvider.COMPONENT_STATE_PROPERTY_ID, "INSTALLED");
+
+    updateRequest = PropertyHelper.getUpdateRequest(properties, null);
+
+    provider.updateResources(updateRequest, predicate);
+
+    Assert.assertEquals(StateProvider.State.Stopped, stateProvider.getState());
+
+    properties.put(ComponentProvider.COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    updateRequest = PropertyHelper.getUpdateRequest(properties, null);
+
+    provider.updateResources(updateRequest, predicate);
+
+    Assert.assertEquals(StateProvider.State.Running, stateProvider.getState());
+  }
+
+  @Test
+  public void testDeleteResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ComponentProvider provider = new ComponentProvider(clusterDefinition);
+
+    try {
+      provider.deleteResources(null);
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+}

+ 165 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/HostComponentProviderTest.java

@@ -0,0 +1,165 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import junit.framework.Assert;
+import org.apache.ambari.scom.TestClusterDefinitionProvider;
+import org.apache.ambari.scom.TestHostInfoProvider;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PredicateBuilder;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ *
+ */
+public class HostComponentProviderTest {
+
+  @Test
+  public void testGetResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
+    Assert.assertEquals(26, resources.size());
+  }
+
+  @Test
+  public void testGetResourcesWithPredicate() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(HostComponentProvider.HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID).equals("MAPREDUCE").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(5, resources.size());
+
+    predicate = new PredicateBuilder().property(HostComponentProvider.HOST_COMPONENT_HOST_NAME_PROPERTY_ID).equals("UnknownHost").toPredicate();
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertTrue(resources.isEmpty());
+  }
+
+  @Test
+  public void testGetResourcesCheckState() throws Exception {
+    TestStateProvider stateProvider = new TestStateProvider();
+    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(HostComponentProvider.HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("HBASE_REGIONSERVER").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(3, resources.size());
+
+    for (Resource resource : resources) {
+      Assert.assertEquals("STARTED", resource.getPropertyValue(HostComponentProvider.HOST_COMPONENT_STATE_PROPERTY_ID));
+    }
+
+    stateProvider.setHealthy(false);
+
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(3, resources.size());
+
+    for (Resource resource : resources) {
+      Assert.assertEquals("INSTALLED", resource.getPropertyValue(HostComponentProvider.HOST_COMPONENT_STATE_PROPERTY_ID));
+    }
+  }
+
+  @Test
+  public void testGetResourcesCheckStateFromCategory() throws Exception {
+    TestStateProvider stateProvider = new TestStateProvider();
+    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(HostComponentProvider.HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("HBASE_REGIONSERVER").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest("HostRoles"), predicate);
+    Assert.assertEquals(3, resources.size());
+
+    for (Resource resource : resources) {
+      Assert.assertEquals("STARTED", resource.getPropertyValue(HostComponentProvider.HOST_COMPONENT_STATE_PROPERTY_ID));
+    }
+
+    stateProvider.setHealthy(false);
+
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(3, resources.size());
+
+    for (Resource resource : resources) {
+      Assert.assertEquals("INSTALLED", resource.getPropertyValue(HostComponentProvider.HOST_COMPONENT_STATE_PROPERTY_ID));
+    }
+  }
+
+  @Test
+  public void testCreateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
+
+    try {
+      provider.createResources(PropertyHelper.getReadRequest());
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+
+  @Test
+  public void testUpdateResources() throws Exception {
+    TestStateProvider stateProvider = new TestStateProvider();
+    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(HostComponentProvider.HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("HBASE_REGIONSERVER").toPredicate();
+
+    HashMap<String, Object> properties = new HashMap<String, Object>();
+
+    properties.put(HostComponentProvider.HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    Request updateRequest = PropertyHelper.getUpdateRequest(properties, null);
+
+    provider.updateResources(updateRequest, predicate);
+
+    Assert.assertEquals(StateProvider.State.Running, stateProvider.getState());
+
+    properties.put(HostComponentProvider.HOST_COMPONENT_STATE_PROPERTY_ID, "INSTALLED");
+
+    updateRequest = PropertyHelper.getUpdateRequest(properties, null);
+
+    provider.updateResources(updateRequest, predicate);
+
+    Assert.assertEquals(StateProvider.State.Stopped, stateProvider.getState());
+
+    properties.put(HostComponentProvider.HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    updateRequest = PropertyHelper.getUpdateRequest(properties, null);
+
+    provider.updateResources(updateRequest, predicate);
+
+    Assert.assertEquals(StateProvider.State.Running, stateProvider.getState());
+  }
+
+  @Test
+  public void testDeleteResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
+
+    try {
+      provider.deleteResources(null);
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+}

+ 157 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/HostProviderTest.java

@@ -0,0 +1,157 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import junit.framework.Assert;
+import org.apache.ambari.scom.TestClusterDefinitionProvider;
+import org.apache.ambari.scom.TestHostInfoProvider;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PredicateBuilder;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ *
+ */
+public class HostProviderTest {
+
+  @Test
+  public void testGetResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostProvider provider = new HostProvider(clusterDefinition);
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
+    Assert.assertEquals(13, resources.size());
+  }
+
+  @Test
+  public void testGetResourcesWithPredicate() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostProvider provider = new HostProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(HostProvider.HOST_NAME_PROPERTY_ID).equals("NAMENODE_MASTER.acme.com").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    predicate = new PredicateBuilder().property(HostProvider.HOST_NAME_PROPERTY_ID).equals("HBASE_MASTER.acme.com").or().
+        property(HostProvider.HOST_NAME_PROPERTY_ID).equals("slave3.acme.com").toPredicate();
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(2, resources.size());
+
+    predicate = new PredicateBuilder().property(HostProvider.HOST_NAME_PROPERTY_ID).equals("unknownHost").toPredicate();
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertTrue(resources.isEmpty());
+  }
+
+  @Test
+  public void testGetResourcesHostIP() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostProvider provider = new HostProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(HostProvider.HOST_NAME_PROPERTY_ID).equals("NAMENODE_MASTER.acme.com").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    Resource resource = resources.iterator().next();
+
+    String ip = (String) resource.getPropertyValue(HostProvider.HOST_IP_PROPERTY_ID);
+
+    Assert.assertEquals("127.0.0.1", ip);
+  }
+
+  @Test
+  public void testGetResourcesCheckState() throws Exception {
+    TestStateProvider stateProvider = new TestStateProvider();
+    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostProvider provider = new HostProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(HostProvider.HOST_NAME_PROPERTY_ID).equals("slave3.acme.com").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    Resource resource = resources.iterator().next();
+
+    Assert.assertEquals("HEALTHY", resource.getPropertyValue(HostProvider.HOST_STATE_PROPERTY_ID));
+
+    stateProvider.setState(StateProvider.State.Unknown);
+
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    resource = resources.iterator().next();
+    Assert.assertEquals("UNHEALTHY", resource.getPropertyValue(HostProvider.HOST_STATE_PROPERTY_ID));
+  }
+
+  @Test
+  public void testGetResourcesCheckStateFromCategory() throws Exception {
+    TestStateProvider stateProvider = new TestStateProvider();
+    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostProvider provider = new HostProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(HostProvider.HOST_NAME_PROPERTY_ID).equals("slave3.acme.com").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest("Hosts"), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    Resource resource = resources.iterator().next();
+
+    Assert.assertEquals("HEALTHY", resource.getPropertyValue(HostProvider.HOST_STATE_PROPERTY_ID));
+
+    stateProvider.setState(StateProvider.State.Unknown);
+
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    resource = resources.iterator().next();
+    Assert.assertEquals("UNHEALTHY", resource.getPropertyValue(HostProvider.HOST_STATE_PROPERTY_ID));
+  }
+
+  @Test
+  public void testCreateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostProvider provider = new HostProvider(clusterDefinition);
+
+    try {
+      provider.createResources(PropertyHelper.getReadRequest());
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+
+  @Test
+  public void testUpdateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostProvider provider = new HostProvider(clusterDefinition);
+
+    provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>(), null), null);
+  }
+
+  @Test
+  public void testDeleteResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    HostProvider provider = new HostProvider(clusterDefinition);
+
+    try {
+      provider.deleteResources(null);
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+}
+

+ 47 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/NoOpProviderTest.java

@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import junit.framework.Assert;
+import org.apache.ambari.scom.TestClusterDefinitionProvider;
+import org.apache.ambari.scom.TestHostInfoProvider;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.junit.Test;
+
+import java.util.Collections;
+
+/**
+ * NoOpProvider tests.
+ */
+public class NoOpProviderTest {
+
+  @Test
+  public void testGetKeyPropertyIds() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    NoOpProvider provider = new NoOpProvider(Resource.Type.Workflow, clusterDefinition);
+    Assert.assertNotNull(provider.getKeyPropertyIds());
+  }
+
+  @Test
+  public void testCheckPropertyIds() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    NoOpProvider provider = new NoOpProvider(Resource.Type.Workflow, clusterDefinition);
+    Assert.assertTrue(provider.checkPropertyIds(Collections.singleton("id")).isEmpty());
+  }
+}

+ 80 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/RequestProviderTest.java

@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import junit.framework.Assert;
+import org.apache.ambari.scom.TestClusterDefinitionProvider;
+import org.apache.ambari.scom.TestHostInfoProvider;
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * Tests for RequestProvider
+ */
+public class RequestProviderTest {
+
+  @Test
+  public void testGetResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    clusterDefinition.getRequestResources().add(new ResourceImpl(Resource.Type.Request));
+
+    RequestProvider provider = new RequestProvider(clusterDefinition);
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
+    Assert.assertEquals(1, resources.size());
+  }
+
+  @Test
+  public void testCreateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    RequestProvider provider = new RequestProvider(clusterDefinition);
+
+    try {
+      provider.createResources(PropertyHelper.getReadRequest());
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+
+  @Test
+  public void testUpdateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    RequestProvider provider = new RequestProvider(clusterDefinition);
+
+    provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>(), null), null);
+  }
+
+  @Test
+  public void testDeleteResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    RequestProvider provider = new RequestProvider(clusterDefinition);
+
+    try {
+      provider.deleteResources(null);
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+}

+ 168 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ServiceProviderTest.java

@@ -0,0 +1,168 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import junit.framework.Assert;
+import org.apache.ambari.scom.TestClusterDefinitionProvider;
+import org.apache.ambari.scom.TestHostInfoProvider;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PredicateBuilder;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ *
+ */
+public class ServiceProviderTest {
+
+  @Test
+  public void testGetResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ServiceProvider provider = new ServiceProvider(clusterDefinition);
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
+    Assert.assertEquals(8, resources.size());
+  }
+
+  @Test
+  public void testGetResourcesWithPredicate() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ServiceProvider provider = new ServiceProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(ServiceProvider.SERVICE_SERVICE_NAME_PROPERTY_ID).equals("MAPREDUCE").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    predicate = new PredicateBuilder().property(ServiceProvider.SERVICE_SERVICE_NAME_PROPERTY_ID).equals("HDFS").or().
+        property(ServiceProvider.SERVICE_SERVICE_NAME_PROPERTY_ID).equals("FLUME").toPredicate();
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(2, resources.size());
+
+    predicate = new PredicateBuilder().property(ServiceProvider.SERVICE_SERVICE_NAME_PROPERTY_ID).equals("NO SERVICE").toPredicate();
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertTrue(resources.isEmpty());
+  }
+
+  @Test
+  public void testGetResourcesCheckState() throws Exception {
+    TestStateProvider stateProvider = new TestStateProvider();
+    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ServiceProvider provider = new ServiceProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(ServiceProvider.SERVICE_SERVICE_NAME_PROPERTY_ID).equals("MAPREDUCE").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    Resource resource = resources.iterator().next();
+
+    Assert.assertEquals("STARTED", resource.getPropertyValue(ServiceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID));
+
+    stateProvider.setHealthy(false);
+
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    resource = resources.iterator().next();
+    Assert.assertEquals("INSTALLED", resource.getPropertyValue(ServiceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID));
+  }
+
+  @Test
+  public void testGetResourcesCheckStateFromCategory() throws Exception {
+    TestStateProvider stateProvider = new TestStateProvider();
+    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ServiceProvider provider = new ServiceProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(ServiceProvider.SERVICE_SERVICE_NAME_PROPERTY_ID).equals("MAPREDUCE").toPredicate();
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest("ServiceInfo"), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    Resource resource = resources.iterator().next();
+
+    Assert.assertEquals("STARTED", resource.getPropertyValue(ServiceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID));
+
+    stateProvider.setHealthy(false);
+
+    resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
+    Assert.assertEquals(1, resources.size());
+
+    resource = resources.iterator().next();
+    Assert.assertEquals("INSTALLED", resource.getPropertyValue(ServiceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID));
+  }
+
+  @Test
+  public void testCreateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ServiceProvider provider = new ServiceProvider(clusterDefinition);
+
+    try {
+      provider.createResources(PropertyHelper.getReadRequest());
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+
+  @Test
+  public void testUpdateResources() throws Exception {
+    TestStateProvider stateProvider = new TestStateProvider();
+    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ServiceProvider provider = new ServiceProvider(clusterDefinition);
+    Predicate predicate = new PredicateBuilder().property(ServiceProvider.SERVICE_SERVICE_NAME_PROPERTY_ID).equals("MAPREDUCE").toPredicate();
+
+    HashMap<String, Object> properties = new HashMap<String, Object>();
+
+    properties.put(ServiceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID, "STARTED");
+
+    Request updateRequest = PropertyHelper.getUpdateRequest(properties, null);
+
+    provider.updateResources(updateRequest, predicate);
+
+    Assert.assertEquals(StateProvider.State.Running, stateProvider.getState());
+
+    properties.put(ServiceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID, "INSTALLED");
+
+    updateRequest = PropertyHelper.getUpdateRequest(properties, null);
+
+    provider.updateResources(updateRequest, predicate);
+
+    Assert.assertEquals(StateProvider.State.Stopped, stateProvider.getState());
+
+    properties.put(ServiceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID, "STARTED");
+
+    updateRequest = PropertyHelper.getUpdateRequest(properties, null);
+
+    provider.updateResources(updateRequest, predicate);
+
+    Assert.assertEquals(StateProvider.State.Running, stateProvider.getState());
+  }
+
+  @Test
+  public void testDeleteResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    ServiceProvider provider = new ServiceProvider(clusterDefinition);
+
+    try {
+      provider.deleteResources(null);
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+}

+ 80 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/TaskProviderTest.java

@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+import junit.framework.Assert;
+import org.apache.ambari.scom.TestClusterDefinitionProvider;
+import org.apache.ambari.scom.TestHostInfoProvider;
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * Tests for TaskProvider
+ */
+public class TaskProviderTest {
+
+  @Test
+  public void testGetResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    clusterDefinition.getTaskResources().add(new ResourceImpl(Resource.Type.Task));
+
+    TaskProvider provider = new TaskProvider(clusterDefinition);
+    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
+    Assert.assertEquals(1, resources.size());
+  }
+
+  @Test
+  public void testCreateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    TaskProvider provider = new TaskProvider(clusterDefinition);
+
+    try {
+      provider.createResources(PropertyHelper.getReadRequest());
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+
+  @Test
+  public void testUpdateResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    TaskProvider provider = new TaskProvider(clusterDefinition);
+
+    provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>(), null), null);
+  }
+
+  @Test
+  public void testDeleteResources() throws Exception {
+    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
+    TaskProvider provider = new TaskProvider(clusterDefinition);
+
+    try {
+      provider.deleteResources(null);
+      Assert.fail("Expected UnsupportedOperationException.");
+    } catch (UnsupportedOperationException e) {
+      //expected
+    }
+  }
+}

+ 73 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/TestStateProvider.java

@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.msi;
+
+/**
+ * Test state provider.
+ */
+public class TestStateProvider implements StateProvider {
+
+  private State state = State.Running;
+
+  public void setHealthy(boolean healthy) {
+    state = healthy ? State.Running : State.Stopped;
+  }
+
+  public void setState(State state) {
+    this.state = state;
+  }
+
+  public State getState() {
+    return state;
+  }
+
+  @Override
+  public State getRunningState(String hostName, String componentName) {
+    return state;
+  }
+
+  @Override
+  public Process setRunningState(String hostName, String componentName, State state) {
+    this.state = state;
+    return new TestProcess();
+  }
+
+  private class TestProcess implements Process {
+
+    @Override
+    public boolean isRunning() {
+      return false;
+    }
+
+    @Override
+    public int getExitCode() {
+      return 0;
+    }
+
+    @Override
+    public String getOutput() {
+      return "output";
+    }
+
+    @Override
+    public String getError() {
+      return "error";
+    }
+  }
+}

+ 83 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/ClusterDefinitionProviderTest.java

@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+import org.apache.ambari.server.configuration.Configuration;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.InputStream;
+import java.util.Properties;
+
+/**
+ * ClusterDefinitionProvider tests.
+ */
+public class ClusterDefinitionProviderTest {
+
+  public static ClusterDefinitionProvider getProvider(String filename, String clusterName, String versionId) {
+    Properties ambariProperties = new Properties();
+    ambariProperties.setProperty(ClusterDefinitionProvider.SCOM_CLUSTER_DEFINITION_FILENAME, filename);
+    ambariProperties.setProperty(ClusterDefinitionProvider.SCOM_CLUSTER_NAME, clusterName);
+    ambariProperties.setProperty(ClusterDefinitionProvider.SCOM_VERSION_ID, versionId);
+
+    Configuration configuration =  new TestConfiguration(ambariProperties);
+
+    ClusterDefinitionProvider streamProvider = new ClusterDefinitionProvider();
+
+    streamProvider.init(configuration);
+
+    return streamProvider;
+  }
+
+  @Test
+  public void testGetFileName() throws Exception {
+    ClusterDefinitionProvider provider = getProvider("myFile", "myCluster", "myVersion");
+    Assert.assertEquals("myFile", provider.getFileName());
+  }
+
+  @Test
+  public void testGetClusterName() throws Exception {
+    ClusterDefinitionProvider provider = getProvider("myFile", "myCluster", "myVersion");
+    Assert.assertEquals("myCluster", provider.getClusterName());
+  }
+
+  @Test
+  public void testGetVersionId() throws Exception {
+    ClusterDefinitionProvider provider = getProvider("myFile", "myCluster", "myVersion");
+    Assert.assertEquals("myVersion", provider.getVersionId());
+  }
+
+  @Test
+  public void testGetInputStream() throws Exception {
+    ClusterDefinitionProvider provider = getProvider("clusterproperties.txt", "myCluster", "myVersion");
+    InputStream inputStream = provider.getInputStream();
+    Assert.assertNotNull(inputStream);
+  }
+
+  private static class TestConfiguration extends Configuration {
+
+    private TestConfiguration(Properties properties) {
+      super(properties);
+    }
+
+    @Override
+    protected void loadSSLParams() {
+    }
+  }
+}

+ 442 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/SQLPropertyProviderTest.java

@@ -0,0 +1,442 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.internal.TemporalInfoImpl;
+import org.apache.ambari.server.controller.jdbc.ConnectionFactory;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.TemporalInfo;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * SQLPropertyProvider Tests
+ */
+public class SQLPropertyProviderTest {
+
+  private static final String PROPERTY_ID_1 = "metrics/rpc/RpcQueueTime_avg_time";
+  private static final String PROPERTY_ID_2 = "metrics/rpc/RpcSlowResponse_num_ops";
+  private static final String CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("HostRoles", "cluster_name");
+  private static final String HOST_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("HostRoles", "host_name");
+  private static final String COMPONENT_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("HostRoles", "component_name");
+
+  @Test
+  public void testPopulateResources() throws Exception {
+
+    ConnectionFactory connectionFactory = createNiceMock(ConnectionFactory.class);
+    Connection connection = createNiceMock(Connection.class);
+    PreparedStatement statement = createNiceMock(PreparedStatement.class);
+    ResultSet resultSet = createNiceMock(ResultSet.class);
+
+    // set expectations
+    expect(connectionFactory.getConnection()).andReturn(connection).once();
+    expect(connection.prepareStatement((String) anyObject())).andReturn(statement).once();
+    expect(statement.executeQuery()).andReturn(resultSet).once();
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999990L);
+    expect(resultSet.getNString("MetricValue")).andReturn("0");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999991L);
+    expect(resultSet.getNString("MetricValue")).andReturn("1");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999992L);
+    expect(resultSet.getNString("MetricValue")).andReturn("2");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999993L);
+    expect(resultSet.getNString("MetricValue")).andReturn("3");
+    expect(resultSet.next()).andReturn(false);
+
+    // replay
+    replay(connectionFactory, connection, statement, resultSet);
+
+    SQLPropertyProvider provider = new SQLPropertyProvider(
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1),
+        new TestHostInfoProvider(),
+        CLUSTER_NAME_PROPERTY_ID,
+        HOST_NAME_PROPERTY_ID,
+        COMPONENT_NAME_PROPERTY_ID,
+        connectionFactory);
+
+    // namenode
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1");
+    resource.setProperty(HOST_NAME_PROPERTY_ID, "domU-12-31-39-0E-34-E1.compute-1.internal");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "DATANODE");
+
+    // only ask for one property
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    temporalInfoMap.put(PROPERTY_ID_1, new TemporalInfoImpl(10L, 20L, 1L));
+    Request request = PropertyHelper.getReadRequest(Collections.singleton(PROPERTY_ID_1), temporalInfoMap);
+
+    Assert.assertEquals(1, provider.populateResources(Collections.singleton(resource), request, null).size());
+
+    Assert.assertTrue(resource.getPropertyValue(PROPERTY_ID_1) instanceof Number[][]);
+
+    Number[][] datapoints = (Number[][]) resource.getPropertyValue(PROPERTY_ID_1);
+
+    for (int i = 0; i < datapoints.length; ++i) {
+      Assert.assertEquals((long) i, datapoints[i][0]);
+      Assert.assertEquals(999990L + i, datapoints[i][1]);
+    }
+
+    // verify
+    verify(connectionFactory, connection, statement, resultSet);
+  }
+
+  @Test
+  public void testPopulateResources_temporalStartTimeOnly() throws Exception {
+
+    ConnectionFactory connectionFactory = createNiceMock(ConnectionFactory.class);
+    Connection connection = createNiceMock(Connection.class);
+    PreparedStatement statement = createNiceMock(PreparedStatement.class);
+    ResultSet resultSet = createNiceMock(ResultSet.class);
+
+    // set expectations
+    expect(connectionFactory.getConnection()).andReturn(connection).once();
+    expect(connection.prepareStatement((String) anyObject())).andReturn(statement).once();
+    expect(statement.executeQuery()).andReturn(resultSet).once();
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999990L);
+    expect(resultSet.getNString("MetricValue")).andReturn("0");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999991L);
+    expect(resultSet.getNString("MetricValue")).andReturn("1");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999992L);
+    expect(resultSet.getNString("MetricValue")).andReturn("2");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999993L);
+    expect(resultSet.getNString("MetricValue")).andReturn("3");
+    expect(resultSet.next()).andReturn(false);
+
+    // replay
+    replay(connectionFactory, connection, statement, resultSet);
+
+    TestHostInfoProvider hostProvider = new TestHostInfoProvider();
+
+    SQLPropertyProvider provider = new SQLPropertyProvider(
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1),
+        hostProvider,
+        CLUSTER_NAME_PROPERTY_ID,
+        HOST_NAME_PROPERTY_ID,
+        COMPONENT_NAME_PROPERTY_ID,
+        connectionFactory);
+
+    // namenode
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1");
+    resource.setProperty(HOST_NAME_PROPERTY_ID, "domU-12-31-39-0E-34-E1.compute-1.internal");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "DATANODE");
+
+    // only ask for one property
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    temporalInfoMap.put(PROPERTY_ID_1, new TemporalInfoImpl(10L, -1L, -1L));
+    Request request = PropertyHelper.getReadRequest(Collections.singleton(PROPERTY_ID_1), temporalInfoMap);
+
+    Assert.assertEquals(1, provider.populateResources(Collections.singleton(resource), request, null).size());
+
+    Assert.assertTrue(resource.getPropertyValue(PROPERTY_ID_1) instanceof Number[][]);
+
+    Number[][] datapoints = (Number[][]) resource.getPropertyValue(PROPERTY_ID_1);
+
+    for (int i = 0; i < datapoints.length; ++i) {
+      Assert.assertEquals((long) i, datapoints[i][0]);
+      Assert.assertEquals(999990L + i, datapoints[i][1]);
+    }
+
+    // verify
+    verify(connectionFactory, connection, statement, resultSet);
+  }
+
+  @Test
+  public void testPopulateResources_hostNameProperty() throws Exception {
+
+    ConnectionFactory connectionFactory = createNiceMock(ConnectionFactory.class);
+    Connection connection = createNiceMock(Connection.class);
+    PreparedStatement statement = createNiceMock(PreparedStatement.class);
+    ResultSet resultSet = createNiceMock(ResultSet.class);
+
+    // set expectations
+    expect(connectionFactory.getConnection()).andReturn(connection).once();
+    expect(connection.prepareStatement((String) anyObject())).andReturn(statement).once();
+    expect(statement.executeQuery()).andReturn(resultSet).once();
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999990L);
+    expect(resultSet.getNString("MetricValue")).andReturn("0");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999991L);
+    expect(resultSet.getNString("MetricValue")).andReturn("1");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999992L);
+    expect(resultSet.getNString("MetricValue")).andReturn("2");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999993L);
+    expect(resultSet.getNString("MetricValue")).andReturn("3");
+    expect(resultSet.next()).andReturn(false);
+
+    // replay
+    replay(connectionFactory, connection, statement, resultSet);
+
+    TestHostInfoProvider hostProvider = new TestHostInfoProvider();
+
+    SQLPropertyProvider provider = new SQLPropertyProvider(
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1),
+        hostProvider,
+        CLUSTER_NAME_PROPERTY_ID,
+        HOST_NAME_PROPERTY_ID,
+        COMPONENT_NAME_PROPERTY_ID,
+        connectionFactory);
+
+    // namenode
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1");
+    resource.setProperty(HOST_NAME_PROPERTY_ID, "domU-12-31-39-0E-34-E1.compute-1.internal");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "DATANODE");
+
+    // only ask for one property
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    temporalInfoMap.put(PROPERTY_ID_1, new TemporalInfoImpl(10L, -1L, -1L));
+    Request request = PropertyHelper.getReadRequest(Collections.singleton(PROPERTY_ID_1), temporalInfoMap);
+
+    provider.populateResources(Collections.singleton(resource), request, null);
+
+    Assert.assertEquals("domU-12-31-39-0E-34-E1.compute-1.internal", hostProvider.getHostId());
+    Assert.assertNull(hostProvider.getClusterName());
+    Assert.assertNull(hostProvider.getComponentName());
+
+    // verify
+    verify(connectionFactory, connection, statement, resultSet);
+  }
+
+  @Test
+  public void testPopulateResources_noHostNameProperty() throws Exception {
+
+    ConnectionFactory connectionFactory = createNiceMock(ConnectionFactory.class);
+    Connection connection = createNiceMock(Connection.class);
+    PreparedStatement statement = createNiceMock(PreparedStatement.class);
+    ResultSet resultSet = createNiceMock(ResultSet.class);
+
+    // set expectations
+    expect(connectionFactory.getConnection()).andReturn(connection).once();
+    expect(connection.prepareStatement((String) anyObject())).andReturn(statement).once();
+    expect(statement.executeQuery()).andReturn(resultSet).once();
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999990L);
+    expect(resultSet.getNString("MetricValue")).andReturn("0");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999991L);
+    expect(resultSet.getNString("MetricValue")).andReturn("1");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999992L);
+    expect(resultSet.getNString("MetricValue")).andReturn("2");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999993L);
+    expect(resultSet.getNString("MetricValue")).andReturn("3");
+    expect(resultSet.next()).andReturn(false);
+
+    // replay
+    replay(connectionFactory, connection, statement, resultSet);
+
+    TestHostInfoProvider hostProvider = new TestHostInfoProvider();
+
+    SQLPropertyProvider provider = new SQLPropertyProvider(
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1),
+        hostProvider,
+        CLUSTER_NAME_PROPERTY_ID,
+        null,
+        COMPONENT_NAME_PROPERTY_ID,
+        connectionFactory);
+
+    // namenode
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "DATANODE");
+
+    // only ask for one property
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    temporalInfoMap.put(PROPERTY_ID_1, new TemporalInfoImpl(10L, -1L, -1L));
+    Request request = PropertyHelper.getReadRequest(Collections.singleton(PROPERTY_ID_1), temporalInfoMap);
+
+    provider.populateResources(Collections.singleton(resource), request, null);
+
+    Assert.assertNull(hostProvider.getHostId());
+    Assert.assertEquals("c1", hostProvider.getClusterName());
+    Assert.assertEquals("DATANODE", hostProvider.getComponentName());
+
+    // verify
+    verify(connectionFactory, connection, statement, resultSet);
+  }
+
+  @Test
+  public void testPopulateResources_pointInTime() throws Exception {
+
+    ConnectionFactory connectionFactory = createNiceMock(ConnectionFactory.class);
+    Connection connection = createNiceMock(Connection.class);
+    PreparedStatement statement = createNiceMock(PreparedStatement.class);
+    ResultSet resultSet = createNiceMock(ResultSet.class);
+
+    // set expectations
+    expect(connectionFactory.getConnection()).andReturn(connection).once();
+    expect(connection.prepareStatement((String) anyObject())).andReturn(statement).once();
+    expect(statement.executeQuery()).andReturn(resultSet).once();
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getNString("MetricValue")).andReturn("0");
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999990L);
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getNString("MetricValue")).andReturn("1");
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999991L);
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getNString("MetricValue")).andReturn("2");
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999992L);
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getNString("MetricValue")).andReturn("3");
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999993L);
+    expect(resultSet.next()).andReturn(false);
+
+    // replay
+    replay(connectionFactory, connection, statement, resultSet);
+
+    SQLPropertyProvider provider = new SQLPropertyProvider(
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1),
+        new TestHostInfoProvider(),
+        CLUSTER_NAME_PROPERTY_ID,
+        HOST_NAME_PROPERTY_ID,
+        COMPONENT_NAME_PROPERTY_ID,
+        connectionFactory);
+
+    // namenode
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1");
+    resource.setProperty(HOST_NAME_PROPERTY_ID, "domU-12-31-39-0E-34-E1.compute-1.internal");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "DATANODE");
+
+    // only ask for one property
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    Request request = PropertyHelper.getReadRequest(Collections.singleton(PROPERTY_ID_2), temporalInfoMap);
+
+    Assert.assertEquals(1, provider.populateResources(Collections.singleton(resource), request, null).size());
+
+    // should be the last value of the time series...
+    Assert.assertEquals( 3L, resource.getPropertyValue(PROPERTY_ID_2));
+
+    // verify
+    verify(connectionFactory, connection, statement, resultSet);
+  }
+
+
+  @Test
+  public void testPopulateResources_multi() throws Exception {
+
+    ConnectionFactory connectionFactory = createNiceMock(ConnectionFactory.class);
+    Connection connection = createNiceMock(Connection.class);
+    PreparedStatement statement = createNiceMock(PreparedStatement.class);
+    ResultSet resultSet = createNiceMock(ResultSet.class);
+
+    // set expectations
+    expect(connectionFactory.getConnection()).andReturn(connection).once();
+    expect(connection.prepareStatement((String) anyObject())).andReturn(statement).once();
+    expect(statement.executeQuery()).andReturn(resultSet).once();
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999990L);
+    expect(resultSet.getNString("MetricValue")).andReturn("0");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999991L);
+    expect(resultSet.getNString("MetricValue")).andReturn("1");
+    expect(resultSet.next()).andReturn(false);
+
+    expect(statement.executeQuery()).andReturn(resultSet).once();
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999992L);
+    expect(resultSet.getNString("MetricValue")).andReturn("2");
+    expect(resultSet.next()).andReturn(true);
+    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999993L);
+    expect(resultSet.getNString("MetricValue")).andReturn("3");
+    expect(resultSet.next()).andReturn(false);
+
+    // replay
+    replay(connectionFactory, connection, statement, resultSet);
+
+    SQLPropertyProvider provider = new SQLPropertyProvider(
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1),
+        new TestHostInfoProvider(),
+        CLUSTER_NAME_PROPERTY_ID,
+        HOST_NAME_PROPERTY_ID,
+        COMPONENT_NAME_PROPERTY_ID,
+        connectionFactory);
+
+    // namenode
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1");
+    resource.setProperty(HOST_NAME_PROPERTY_ID, "domU-12-31-39-0E-34-E1.compute-1.internal");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "DATANODE");
+
+    // ask for two properties ... on temporal, one point in time
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    temporalInfoMap.put(PROPERTY_ID_1, new TemporalInfoImpl(10L, 20L, 1L));
+
+    Set<String> propertyIds = new LinkedHashSet<String>();
+    propertyIds.add(PROPERTY_ID_1);
+    propertyIds.add(PROPERTY_ID_2);
+
+    Request request = PropertyHelper.getReadRequest(propertyIds, temporalInfoMap);
+
+    Assert.assertEquals(1, provider.populateResources(Collections.singleton(resource), request, null).size());
+
+    // check the temporal value
+    Assert.assertTrue(resource.getPropertyValue(PROPERTY_ID_1) instanceof Number[][]);
+
+    Number[][] datapoints = (Number[][]) resource.getPropertyValue(PROPERTY_ID_1);
+
+    for (int i = 0; i < datapoints.length; ++i) {
+      Assert.assertEquals((long) i, datapoints[i][0]);
+      Assert.assertEquals(999990L + i, datapoints[i][1]);
+    }
+
+    // check the point in time value ... should be the last value of the time series...
+    Assert.assertEquals( 3L, resource.getPropertyValue(PROPERTY_ID_2));
+
+    // verify
+    verify(connectionFactory, connection, statement, resultSet);
+  }
+}

+ 51 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/SQLProviderModuleTest.java

@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+import org.apache.ambari.server.controller.jmx.JMXPropertyProvider;
+import org.apache.ambari.server.controller.spi.PropertyProvider;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.List;
+
+/**
+ * SQLProviderModule Tests
+ */
+public class SQLProviderModuleTest {
+  @Test
+  public void testCreatePropertyProviders() {
+    SQLProviderModule providerModule = new SQLProviderModule();
+
+    providerModule.createPropertyProviders(Resource.Type.Component);
+
+    List<PropertyProvider> providers = providerModule.getPropertyProviders(Resource.Type.Component);
+
+    Assert.assertTrue(providers.get(0) instanceof JMXPropertyProvider);
+    Assert.assertTrue(providers.get(1) instanceof SQLPropertyProvider);
+
+    providerModule.createPropertyProviders(Resource.Type.HostComponent);
+
+    providers = providerModule.getPropertyProviders(Resource.Type.HostComponent);
+
+    Assert.assertTrue(providers.get(0) instanceof JMXPropertyProvider);
+    Assert.assertTrue(providers.get(1) instanceof SQLPropertyProvider);
+  }
+}

+ 68 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/SinkConnectionFactoryTest.java

@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+import org.apache.ambari.server.configuration.Configuration;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Properties;
+
+/**
+ * SinkConnectionFactory Tests.
+ */
+public class SinkConnectionFactoryTest {
+
+  public static SinkConnectionFactory getFactory(String url, String driver) {
+    Properties ambariProperties = new Properties();
+    ambariProperties.setProperty(SinkConnectionFactory.SCOM_SINK_DB_URL, url);
+    ambariProperties.setProperty(SinkConnectionFactory.SCOM_SINK_DB_DRIVER, driver);
+
+    Configuration configuration =  new TestConfiguration(ambariProperties);
+
+    SinkConnectionFactory connectionFactory = new SinkConnectionFactory();
+
+    connectionFactory.init(configuration);
+
+    return connectionFactory;
+  }
+
+  @Test
+  public void testGetDatabaseUrl() throws Exception {
+    SinkConnectionFactory factory = getFactory("myURL", "myDriver");
+    Assert.assertEquals("myURL", factory.getDatabaseUrl());
+  }
+
+  @Test
+  public void testGetDatabaseDriver() throws Exception {
+    SinkConnectionFactory factory = getFactory("myURL", "myDriver");
+    Assert.assertEquals("myDriver", factory.getDatabaseDriver());
+  }
+
+  private static class TestConfiguration extends Configuration {
+
+    private TestConfiguration(Properties properties) {
+      super(properties);
+    }
+
+    @Override
+    protected void loadSSLParams() {
+    }
+  }
+}

+ 30 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/TestClusterDefinitionProvider.java

@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+/**
+ *  Test version of ClusterDefinitionProvider.
+ */
+public class TestClusterDefinitionProvider extends ClusterDefinitionProvider {
+  public TestClusterDefinitionProvider() {
+    setFileName("clusterproperties.txt");
+    setClusterName("myCluster");
+    setVersionId("HDP-1.2.9");
+  }
+}

+ 58 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/TestHostInfoProvider.java

@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom;
+
+import org.apache.ambari.server.controller.spi.SystemException;
+
+public class TestHostInfoProvider implements HostInfoProvider {
+
+  private String clusterName;
+  private String componentName;
+  private String hostId;
+
+  public String getClusterName() {
+    return clusterName;
+  }
+
+  public String getComponentName() {
+    return componentName;
+  }
+
+  public String getHostId() {
+    return hostId;
+  }
+
+  @Override
+  public String getHostName(String clusterName, String componentName) throws SystemException {
+    this.clusterName = clusterName;
+    this.componentName = componentName;
+    return "host1";
+  }
+
+  @Override
+  public String getHostName(String id) throws SystemException {
+    this.hostId = id;
+    return "host1";
+  }
+
+  @Override
+  public String getHostAddress(String id) throws SystemException {
+    return "127.0.0.1";
+  }
+}

+ 163 - 0
contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/scom/logging/JpaLoggerTest.java

@@ -0,0 +1,163 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.scom.logging;
+
+import org.eclipse.persistence.logging.SessionLog;
+import org.eclipse.persistence.logging.SessionLogEntry;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+
+import java.util.logging.Formatter;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * JpaLogger Tests
+ */
+public class JpaLoggerTest {
+  @Test
+  public void testLog() throws Exception {
+
+    Logger logger = createNiceMock(Logger.class);
+    SessionLogEntry severeEntry = createNiceMock(SessionLogEntry.class);
+    SessionLogEntry configEntry = createNiceMock(SessionLogEntry.class);
+    SessionLogEntry finestEntry = createNiceMock(SessionLogEntry.class);
+    Formatter formatter = createNiceMock(Formatter.class);
+
+    JpaLogger jpaLogger = new TestJpaLogger(logger, formatter);
+
+    // set expectations
+
+    expect(severeEntry.getLevel()).andReturn(SessionLog.SEVERE);
+    expect(formatter.format((LogRecord) anyObject())).andReturn("severe log message");
+    logger.error("severe log message");
+
+    expect(configEntry.getLevel()).andReturn(SessionLog.CONFIG);
+    expect(formatter.format((LogRecord) anyObject())).andReturn("config log message");
+    logger.info("config log message");
+
+    expect(finestEntry.getLevel()).andReturn(SessionLog.FINEST);
+    expect(formatter.format((LogRecord) anyObject())).andReturn("finest log message");
+    logger.debug("finest log message");
+
+    // replay
+    replay(logger, severeEntry, configEntry, finestEntry, formatter);
+
+    jpaLogger.log(severeEntry);
+    jpaLogger.log(configEntry);
+    jpaLogger.log(finestEntry);
+
+    // verify
+    verify(logger, severeEntry, configEntry, finestEntry, formatter);
+  }
+
+  @Test
+  public void testThrowing() throws Exception {
+    Logger logger = createNiceMock(Logger.class);
+    Formatter formatter = createNiceMock(Formatter.class);
+
+    Exception exception = new IllegalStateException("Something went wrong!");
+
+    JpaLogger jpaLogger = new TestJpaLogger(logger, formatter);
+
+    // set expectations
+    logger.error(null, exception);
+
+    // replay
+    replay(logger, formatter);
+
+    jpaLogger.throwing(exception);
+
+    // verify
+    verify(logger, formatter);
+  }
+
+  @Test
+  public void testShouldLog() throws Exception {
+    JpaLogger logger = new JpaLogger();
+    Assert.assertTrue(logger.shouldLog(SessionLog.SEVERE, ""));
+    Assert.assertTrue(logger.shouldLog(SessionLog.WARNING, ""));
+    Assert.assertFalse(logger.shouldLog(SessionLog.CONFIG, ""));
+    Assert.assertFalse(logger.shouldLog(SessionLog.FINER, ""));
+    Assert.assertFalse(logger.shouldLog(SessionLog.ALL, ""));
+
+    logger.setLogLevel(Level.FINER);
+    Assert.assertTrue(logger.shouldLog(SessionLog.SEVERE, ""));
+    Assert.assertTrue(logger.shouldLog(SessionLog.WARNING, ""));
+    Assert.assertTrue(logger.shouldLog(SessionLog.CONFIG, ""));
+    Assert.assertTrue(logger.shouldLog(SessionLog.FINER, ""));
+    Assert.assertFalse(logger.shouldLog(SessionLog.ALL, ""));
+
+    logger.setLogLevel(Level.SEVERE);
+    Assert.assertTrue(logger.shouldLog(SessionLog.SEVERE, ""));
+    Assert.assertFalse(logger.shouldLog(SessionLog.WARNING, ""));
+    Assert.assertFalse(logger.shouldLog(SessionLog.CONFIG, ""));
+    Assert.assertFalse(logger.shouldLog(SessionLog.FINER, ""));
+    Assert.assertFalse(logger.shouldLog(SessionLog.ALL, ""));
+  }
+
+  @Test
+  public void testGetSetLogLevel() throws Exception {
+    JpaLogger logger = new JpaLogger();
+    Assert.assertEquals(Level.WARNING, logger.getLogLevel());
+
+    logger.setLogLevel(Level.ALL);
+    Assert.assertEquals(Level.ALL, logger.getLogLevel());
+
+    logger.setLogLevel(Level.FINER);
+    Assert.assertEquals(Level.FINER, logger.getLogLevel());
+
+    logger.setLogLevel(Level.OFF);
+    Assert.assertEquals(Level.OFF, logger.getLogLevel());
+  }
+
+
+  private static class TestJpaLogger extends JpaLogger {
+
+    private final Logger logger;
+    private final Formatter formatter;
+
+    private TestJpaLogger(Logger logger, Formatter formatter) {
+      this.logger = logger;
+      this.formatter = formatter;
+    }
+
+    @Override
+    protected Logger getLogger() {
+      return logger;
+    }
+
+    @Override
+    protected Formatter getFormatter() {
+      return formatter;
+    }
+
+    @Override
+    protected String formatMessage(SessionLogEntry entry) {
+      return "message";
+    }
+  }
+}

+ 34 - 0
contrib/ambari-scom/ambari-scom-server/src/test/resources/ambari.properties

@@ -0,0 +1,34 @@
+# Copyright 2011 The Apache Software Foundation
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+security.server.keys_dir = /var/lib/ambari-server/keys
+resources.dir = /var/lib/ambari-server/resources
+jdk.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-6u31-linux-x64.bin
+jce_policy.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-6.zip
+metadata.path=/var/lib/ambari-server/resources/stacks
+server.version.file=/var/lib/ambari-server/resources/version
+webapp.dir=/usr/lib/ambari-server/web
+bootstrap.dir=/var/run/ambari-server/bootstrap
+bootstrap.script=/usr/lib/python2.6/site-packages/ambari_server/bootstrap.py
+bootstrap.setup_agent.script=/usr/lib/python2.6/site-packages/ambari_server/setupAgent.py
+api.authenticate=true
+server.connection.max.idle.millis=900000
+server.fqdn.service.url=http://169.254.169.254/latest/meta-data/public-hostname
+
+scom.sink.db.url=jdbc:sqlserver://10.0.2.2:2301;databaseName=HadoopMonitoring;user=sink
+scom.sink.db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver

+ 47 - 0
contrib/ambari-scom/ambari-scom-server/src/test/resources/clusterproperties.txt

@@ -0,0 +1,47 @@
+### Licensed to the Apache Software Foundation (ASF) under one or more
+### contributor license agreements.  See the NOTICE file distributed with
+### this work for additional information regarding copyright ownership.
+### The ASF licenses this file to You under the Apache License, Version 2.0
+### (the "License"); you may not use this file except in compliance with
+### the License.  You may obtain a copy of the License at
+###
+###     http://www.apache.org/licenses/LICENSE-2.0
+###
+### Unless required by applicable law or agreed to in writing, software
+### distributed under the License is distributed on an "AS IS" BASIS,
+### WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+### See the License for the specific language governing permissions and
+### limitations under the License.
+
+#Log directory
+HDP_LOG_DIR=d:\hadoop\logs
+
+#Data directory
+HDP_DATA_DIR=d:\hdp\data
+
+#Hosts (this is a comment)
+NAMENODE_HOST=NAMENODE_MASTER.acme.com
+SECONDARY_NAMENODE_HOST=SECONDARY_NAMENODE_MASTER.acme.com
+JOBTRACKER_HOST=JOBTRACKER_MASTER.acme.com
+HIVE_SERVER_HOST=HIVE_SERVER_MASTER.acme.com
+OOZIE_SERVER_HOST=OOZIE_SERVER_MASTER.acme.com
+WEBHCAT_HOST=WEBHCAT_MASTER.acme.com
+FLUME_HOSTS=FLUME_SERVICE1.acme.com,FLUME_SERVICE2.acme.com,FLUME_SERVICE3.acme.com
+HBASE_MASTER=HBASE_MASTER.acme.com
+HBASE_REGIONSERVERS=slave1.acme.com, slave2.acme.com, slave3.acme.com
+ZOOKEEPER_HOSTS=slave1.acme.com, slave2.acme.com, slave3.acme.com
+SLAVE_HOSTS=slave1.acme.com, slave2.acme.com, slave3.acme.com
+
+#Database host
+DB_FLAVOR=derby
+DB_HOSTNAME=DB_myHostName
+
+#Hive properties
+HIVE_DB_NAME=hive
+HIVE_DB_USERNAME=hive
+HIVE_DB_PASSWORD=hive
+
+#Oozie properties
+OOZIE_DB_NAME=oozie
+OOZIE_DB_USERNAME=oozie
+OOZIE_DB_PASSWORD=oozie

+ 21 - 0
contrib/ambari-scom/ambari-scom-server/src/test/resources/log4j.properties

@@ -0,0 +1,21 @@
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# log4j configuration used during build and unit tests
+
+log4j.rootLogger=DEBUG,stdout
+log4j.threshhold=ALL
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2} (%F:%M(%L)) - %m%n
+
+log4j.logger.org.apache.ambari=DEBUG

+ 35 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/BUILDING.md

@@ -0,0 +1,35 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+Building the Management Pack
+=========
+
+
+1.	Install Microsoft Visual Studio 2010 Professional or higher
+2.	Install System Center 2012 Visual Studio Authoring Extensions from
+http://www.microsoft.com/en-us/download/details.aspx?id=30169
+3.	Replace `C:\Program Files (x86)\MSBuild\Microsoft\VSAC Replace Microsoft.EnterpriseManagement.Core.dll` with a version from Operations Management 2012 SP1 or R2 Preview
+4.	Install latest Wix toolset from http://wix.codeplex.com/
+5.	Install Silverlight (Open solution in Visual Studio and it will suggest download)
+6.	If you would like to sign MP with your key then replace `Solution Items\key.snk` file with your own but keep the same name.
+7.	Update `\Installer\Assets\EULA.rtf`
+8.	Run `build.bat`
+9.	Look for built MPs:
+    * `\HadoopMp\bin\Debug\Ambari.SCOM.mpb`
+    * `\ManagementMp\bin\Debug\Ambari.SCOM.Management.mpb`
+    * `\PresentationMp\bin\Debug\Ambari.SCOM.Presentation.mpb`
+10. Built msi will be located in `\Installer\bin\Debug\en-us\`

+ 161 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp.sln

@@ -0,0 +1,161 @@
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+Project("{D4B43EB3-688B-4EEE-86BD-088F0B28ABB3}") = "HadoopMp", "HadoopMp\HadoopMp.mpproj", "{63B476B6-EFCD-468F-80D9-94E2CFF1B5DB}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Items", "Items", "{07217F3F-F648-4FF8-B785-5967FACFB38F}"
+	ProjectSection(SolutionItems) = preProject
+		Items\key.snk = Items\key.snk
+	EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libs", "Libs", "{BF3DF7C0-7A2F-4639-AC4B-F0F3200BED77}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SCOM2012", "SCOM2012", "{E2576039-8FD4-48A2-A2E8-BD8AF3DBD22C}"
+	ProjectSection(SolutionItems) = preProject
+		Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.CompositionEngine.dll = Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.CompositionEngine.dll
+		Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.CompositionEngine.Extensibility.dll = Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.CompositionEngine.Extensibility.dll
+		Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.Core.dll = Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.Core.dll
+		Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.HealthService.dll = Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.HealthService.dll
+		Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.OperationsManager.dll = Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.OperationsManager.dll
+		Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.Presentation.Controls.dll = Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.Presentation.Controls.dll
+		Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.Presentation.Core.dll = Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.Presentation.Core.dll
+		Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.UI.Authoring.dll = Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.UI.Authoring.dll
+		Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.UI.ConsoleFramework.dll = Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.UI.ConsoleFramework.dll
+		Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.UI.Extensibility.dll = Items\Libs\SCOM2012\Microsoft.EnterpriseManagement.UI.Extensibility.dll
+		Items\Libs\SCOM2012\Microsoft.Mom.Modules.DataTypes.dll = Items\Libs\SCOM2012\Microsoft.Mom.Modules.DataTypes.dll
+		Items\Libs\SCOM2012\Microsoft.MOM.UI.Common.dll = Items\Libs\SCOM2012\Microsoft.MOM.UI.Common.dll
+		Items\Libs\SCOM2012\Microsoft.Practices.Unity.dll = Items\Libs\SCOM2012\Microsoft.Practices.Unity.dll
+		Items\Libs\SCOM2012\System.Windows.Controls.DataVisualization.Toolkit.dll = Items\Libs\SCOM2012\System.Windows.Controls.DataVisualization.Toolkit.dll
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScomPages", "ScomPages\ScomPages.csproj", "{B77E5EA7-3FE4-49C9-88AC-3AB871A26F9B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WidgetsWpf", "WidgetsWpf\WidgetsWpf.csproj", "{D4C615D1-9274-41D9-B14E-BC88AE7FCDCE}"
+EndProject
+Project("{D4B43EB3-688B-4EEE-86BD-088F0B28ABB3}") = "PresentationMp", "PresentationMp\PresentationMp.mpproj", "{8AB1E36E-7FF4-4BAF-9BD0-1491492DFDA0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Modules", "Modules\Modules.csproj", "{AEAA0FB0-D274-491A-BEB5-5354584F1400}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packs", "Packs", "{413F4F6B-2864-4EA9-A2FC-FE7F7DEBE695}"
+	ProjectSection(SolutionItems) = preProject
+		Items\Packs\Microsoft.SystemCenter.Visualization.Library.mpb = Items\Packs\Microsoft.SystemCenter.Visualization.Library.mpb
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WidgetsSilverlight", "WidgetsSilverlight\WidgetsSilverlight.csproj", "{729E6DB2-31F7-4EB1-9146-A2F2263585EE}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SCOM2012_Web", "SCOM2012_Web", "{13CBF7E2-FA6A-465C-ACFE-881AECABC145}"
+	ProjectSection(SolutionItems) = preProject
+		Items\Libs\SCOM2012_Web\Microsoft.EnterpriseManagement.CompositionEngine.dll = Items\Libs\SCOM2012_Web\Microsoft.EnterpriseManagement.CompositionEngine.dll
+		Items\Libs\SCOM2012_Web\Microsoft.EnterpriseManagement.CompositionEngine.Extensibility.dll = Items\Libs\SCOM2012_Web\Microsoft.EnterpriseManagement.CompositionEngine.Extensibility.dll
+		Items\Libs\SCOM2012_Web\Microsoft.EnterpriseManagement.Presentation.Controls.dll = Items\Libs\SCOM2012_Web\Microsoft.EnterpriseManagement.Presentation.Controls.dll
+		Items\Libs\SCOM2012_Web\Microsoft.EnterpriseManagement.Presentation.Core.dll = Items\Libs\SCOM2012_Web\Microsoft.EnterpriseManagement.Presentation.Core.dll
+		Items\Libs\SCOM2012_Web\Microsoft.Practices.Unity.Silverlight.dll = Items\Libs\SCOM2012_Web\Microsoft.Practices.Unity.Silverlight.dll
+		Items\Libs\SCOM2012_Web\System.Windows.Controls.DataVisualization.Toolkit.dll = Items\Libs\SCOM2012_Web\System.Windows.Controls.DataVisualization.Toolkit.dll
+	EndProjectSection
+EndProject
+Project("{D4B43EB3-688B-4EEE-86BD-088F0B28ABB3}") = "ManagementMp", "ManagementMp\ManagementMp.mpproj", "{1BAB40E2-B43F-469A-8583-CC196A792A38}"
+EndProject
+Global
+	GlobalSection(TeamFoundationVersionControl) = preSolution
+		SccNumberOfProjects = 8
+		SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
+		SccTeamFoundationServer = http://tfs.viacode.com:8080/tfs/llc
+		SccLocalPath0 = .
+		SccProjectUniqueName1 = HadoopMp\\HadoopMp.mpproj
+		SccProjectName1 = HadoopMp
+		SccLocalPath1 = HadoopMp
+		SccProjectUniqueName2 = ManagementMp\\ManagementMp.mpproj
+		SccProjectName2 = ManagementMp
+		SccLocalPath2 = ManagementMp
+		SccProjectUniqueName3 = Modules\\Modules.csproj
+		SccProjectName3 = Modules
+		SccLocalPath3 = Modules
+		SccProjectUniqueName4 = PresentationMp\\PresentationMp.mpproj
+		SccProjectName4 = PresentationMp
+		SccLocalPath4 = PresentationMp
+		SccProjectUniqueName5 = ScomPages\\ScomPages.csproj
+		SccProjectName5 = ScomPages
+		SccLocalPath5 = ScomPages
+		SccProjectUniqueName6 = WidgetsSilverlight\\WidgetsSilverlight.csproj
+		SccProjectName6 = WidgetsSilverlight
+		SccLocalPath6 = WidgetsSilverlight
+		SccProjectUniqueName7 = WidgetsWpf\\WidgetsWpf.csproj
+		SccProjectName7 = WidgetsWpf
+		SccLocalPath7 = WidgetsWpf
+	EndGlobalSection
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|x86 = Debug|x86
+		Release|Any CPU = Release|Any CPU
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{63B476B6-EFCD-468F-80D9-94E2CFF1B5DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{63B476B6-EFCD-468F-80D9-94E2CFF1B5DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{63B476B6-EFCD-468F-80D9-94E2CFF1B5DB}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{63B476B6-EFCD-468F-80D9-94E2CFF1B5DB}.Debug|x86.Build.0 = Debug|Any CPU
+		{63B476B6-EFCD-468F-80D9-94E2CFF1B5DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{63B476B6-EFCD-468F-80D9-94E2CFF1B5DB}.Release|x86.ActiveCfg = Release|Any CPU
+		{63B476B6-EFCD-468F-80D9-94E2CFF1B5DB}.Release|x86.Build.0 = Release|Any CPU
+		{B77E5EA7-3FE4-49C9-88AC-3AB871A26F9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B77E5EA7-3FE4-49C9-88AC-3AB871A26F9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B77E5EA7-3FE4-49C9-88AC-3AB871A26F9B}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{B77E5EA7-3FE4-49C9-88AC-3AB871A26F9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B77E5EA7-3FE4-49C9-88AC-3AB871A26F9B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B77E5EA7-3FE4-49C9-88AC-3AB871A26F9B}.Release|x86.ActiveCfg = Release|Any CPU
+		{D4C615D1-9274-41D9-B14E-BC88AE7FCDCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D4C615D1-9274-41D9-B14E-BC88AE7FCDCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D4C615D1-9274-41D9-B14E-BC88AE7FCDCE}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{D4C615D1-9274-41D9-B14E-BC88AE7FCDCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D4C615D1-9274-41D9-B14E-BC88AE7FCDCE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D4C615D1-9274-41D9-B14E-BC88AE7FCDCE}.Release|x86.ActiveCfg = Release|Any CPU
+		{8AB1E36E-7FF4-4BAF-9BD0-1491492DFDA0}.Debug|Any CPU.ActiveCfg = Debug|x86
+		{8AB1E36E-7FF4-4BAF-9BD0-1491492DFDA0}.Debug|x86.ActiveCfg = Debug|x86
+		{8AB1E36E-7FF4-4BAF-9BD0-1491492DFDA0}.Debug|x86.Build.0 = Debug|x86
+		{8AB1E36E-7FF4-4BAF-9BD0-1491492DFDA0}.Release|Any CPU.ActiveCfg = Release|x86
+		{8AB1E36E-7FF4-4BAF-9BD0-1491492DFDA0}.Release|x86.ActiveCfg = Release|x86
+		{8AB1E36E-7FF4-4BAF-9BD0-1491492DFDA0}.Release|x86.Build.0 = Release|x86
+		{AEAA0FB0-D274-491A-BEB5-5354584F1400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{AEAA0FB0-D274-491A-BEB5-5354584F1400}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{AEAA0FB0-D274-491A-BEB5-5354584F1400}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{AEAA0FB0-D274-491A-BEB5-5354584F1400}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{AEAA0FB0-D274-491A-BEB5-5354584F1400}.Release|Any CPU.Build.0 = Release|Any CPU
+		{AEAA0FB0-D274-491A-BEB5-5354584F1400}.Release|x86.ActiveCfg = Release|Any CPU
+		{729E6DB2-31F7-4EB1-9146-A2F2263585EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{729E6DB2-31F7-4EB1-9146-A2F2263585EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{729E6DB2-31F7-4EB1-9146-A2F2263585EE}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{729E6DB2-31F7-4EB1-9146-A2F2263585EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{729E6DB2-31F7-4EB1-9146-A2F2263585EE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{729E6DB2-31F7-4EB1-9146-A2F2263585EE}.Release|x86.ActiveCfg = Release|Any CPU
+		{1BAB40E2-B43F-469A-8583-CC196A792A38}.Debug|Any CPU.ActiveCfg = Debug|x86
+		{1BAB40E2-B43F-469A-8583-CC196A792A38}.Debug|x86.ActiveCfg = Debug|x86
+		{1BAB40E2-B43F-469A-8583-CC196A792A38}.Debug|x86.Build.0 = Debug|x86
+		{1BAB40E2-B43F-469A-8583-CC196A792A38}.Release|Any CPU.ActiveCfg = Release|x86
+		{1BAB40E2-B43F-469A-8583-CC196A792A38}.Release|x86.ActiveCfg = Release|x86
+		{1BAB40E2-B43F-469A-8583-CC196A792A38}.Release|x86.Build.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{BF3DF7C0-7A2F-4639-AC4B-F0F3200BED77} = {07217F3F-F648-4FF8-B785-5967FACFB38F}
+		{413F4F6B-2864-4EA9-A2FC-FE7F7DEBE695} = {07217F3F-F648-4FF8-B785-5967FACFB38F}
+		{E2576039-8FD4-48A2-A2E8-BD8AF3DBD22C} = {BF3DF7C0-7A2F-4639-AC4B-F0F3200BED77}
+		{13CBF7E2-FA6A-465C-ACFE-881AECABC145} = {BF3DF7C0-7A2F-4639-AC4B-F0F3200BED77}
+	EndGlobalSection
+EndGlobal

+ 63 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/AmbariAccessorRole.mpx

@@ -0,0 +1,63 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.AmbariAccessorRole" Accessibility="Public" Base="System!System.ComputerRole" Hosted="true" Abstract="true" Singleton="false" />
+      </ClassTypes>
+
+      <RelationshipTypes>
+        <RelationshipType ID="Ambari.SCOM.ComputerHostsAmbariWatcherNode" Base="System!System.Hosting" Accessibility="Public" Abstract="false">
+          <Source ID="Computer" Type="Windows!Microsoft.Windows.Computer" />
+          <Target ID="Accessor" Type="Ambari.SCOM.AmbariAccessorRole" />
+        </RelationshipType>
+      </RelationshipTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <!--<Categories>
+    <Category ID="Ambari.SCOM.AmbariAccessorRole.16x16Image.Category" Target="Ambari.SCOM.AmbariAccessorRole.16x16Image" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.AmbariAccessorRole.80x80Image.Category" Target="Ambari.SCOM.AmbariAccessorRole.80x80Image" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+  </Categories>
+
+  <Presentation>
+    <ImageReferences>
+      <ImageReference ElementID="Ambari.SCOM.AmbariAccessorRole" ImageID="Ambari.SCOM.AmbariAccessorRole.16x16Image" />
+      <ImageReference ElementID="Ambari.SCOM.AmbariAccessorRole" ImageID="Ambari.SCOM.AmbariAccessorRole.80x80Image" />
+    </ImageReferences>
+  </Presentation>-->
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.AmbariAccessorRole">
+          <Name>Hadoop Ambari Accessor Role</Name>
+          <Description>This class defines Hadoop Ambari Accessor Computer Role.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+
+  <!--
+  <Resources>
+    <Image ID="Ambari.SCOM.AmbariAccessorRole.16x16Image" Accessibility="Public" FileName="AmbariAccessorRole-16.png" />
+    <Image ID="Ambari.SCOM.AmbariAccessorRole.80x80Image" Accessibility="Public" FileName="AmbariAccessorRole-80.png" />
+  </Resources>
+  -->
+</ManagementPackFragment>

+ 66 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/AmbariEntity.mpx

@@ -0,0 +1,66 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.AmbariEntity" Accessibility="Public" Base="System!System.LogicalEntity" Hosted="false" Abstract="true" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.AmbariManagedEntity" Accessibility="Public" Base="Ambari.SCOM.AmbariEntity" Hosted="false" Abstract="true" Singleton="false">
+          <Property ID="AmbariUri" Type="string" />
+        </ClassType>
+      </ClassTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <!--<Categories>
+    <Category ID="Ambari.SCOM.AmbariManagedEntity.16x16Image.Category" Target="Ambari.SCOM.AmbariManagedEntity.16x16Image" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.AmbariManagedEntity.80x80Image.Category" Target="Ambari.SCOM.AmbariManagedEntity.80x80Image" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+  </Categories>
+
+  <Presentation>
+    <ImageReferences>
+      <ImageReference ElementID="Ambari.SCOM.AmbariManagedEntity" ImageID="Ambari.SCOM.AmbariManagedEntity.16x16Image" />
+      <ImageReference ElementID="Ambari.SCOM.AmbariManagedEntity" ImageID="Ambari.SCOM.AmbariManagedEntity.80x80Image" />
+    </ImageReferences>
+  </Presentation>-->
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.AmbariEntity">
+          <Name>Ambari Entity</Name>
+          <Description>This class represents any Ambari Service entity.</Description>
+        </DisplayString>
+        
+        <DisplayString ElementID="Ambari.SCOM.AmbariManagedEntity">
+          <Name>Ambari Managed Entity</Name>
+          <Description>This class represents entity managed by Ambari Service.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.AmbariManagedEntity" SubElementID="AmbariUri">
+          <Name>Ambari URI</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+
+  <!--
+  <Resources>
+    <Image ID="Ambari.SCOM.AmbariManagedEntity.16x16Image" Accessibility="Public" FileName="Cluster-16.png" />
+    <Image ID="Ambari.SCOM.AmbariManagedEntity.80x80Image" Accessibility="Public" FileName="Cluster-80.png" />
+  </Resources>
+  -->
+</ManagementPackFragment>

+ 76 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/AmbariSeed.mpx

@@ -0,0 +1,76 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.AmbariSeed" Accessibility="Public" Base="Ambari.SCOM.AmbariAccessorRole" Hosted="true" Abstract="false" Singleton="false">
+          <Property ID="TemplateName" Type="string" Key="true" />
+          <Property ID="AmbariUri" Type="string" />
+        </ClassType>
+      </ClassTypes>
+
+      <RelationshipTypes>
+        <RelationshipType ID="Ambari.SCOM.AmbariSeedContainsCluster"
+                          Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Seed" Type="Ambari.SCOM.AmbariSeed" />
+          <Target ID="Cluster" Type="Ambari.SCOM.Cluster" />
+        </RelationshipType>
+      </RelationshipTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <!--<Categories>
+    <Category ID="Ambari.SCOM.AmbariSeed.16x16Image.Category" Target="Ambari.SCOM.AmbariSeed.16x16Image" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.AmbariSeed.80x80Image.Category" Target="Ambari.SCOM.AmbariSeed.80x80Image" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+  </Categories>
+
+  <Presentation>
+    <ImageReferences>
+      <ImageReference ElementID="Ambari.SCOM.AmbariSeed" ImageID="Ambari.SCOM.AmbariSeed.16x16Image" />
+      <ImageReference ElementID="Ambari.SCOM.AmbariSeed" ImageID="Ambari.SCOM.AmbariSeed.80x80Image" />
+    </ImageReferences>
+  </Presentation>-->
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.AmbariSeed">
+          <Name>Hadoop Ambari Service Seed</Name>
+          <Description>This class defines Hadoop Ambari Service seed object.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.AmbariSeed" SubElementID="TemplateName">
+          <Name>Template Name</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.AmbariSeed" SubElementID="AmbariUri">
+          <Name>Ambari URI</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.AmbariSeedContainsCluster">
+          <Name>Hadoop Ambari Service Seed Contains Cluster</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+
+  <!--
+  <Resources>
+    <Image ID="Ambari.SCOM.AmbariSeed.16x16Image" Accessibility="Public" FileName="AmbariSeed-16.png" />
+    <Image ID="Ambari.SCOM.AmbariSeed.80x80Image" Accessibility="Public" FileName="AmbariSeed-80.png" />
+  </Resources>
+  -->
+</ManagementPackFragment>

+ 55 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/AmbariWatcherNode.mpx

@@ -0,0 +1,55 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.AmbariWatcherNode" Accessibility="Public" Base="Ambari.SCOM.AmbariAccessorRole" Hosted="true" Abstract="false" Singleton="false" />
+      </ClassTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <!--<Categories>
+    <Category ID="Ambari.SCOM.AmbariWatcherNode.16x16Image.Category" Target="Ambari.SCOM.AmbariWatcherNode.16x16Image" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.AmbariWatcherNode.80x80Image.Category" Target="Ambari.SCOM.AmbariWatcherNode.80x80Image" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+  </Categories>
+
+  <Presentation>
+    <ImageReferences>
+      <ImageReference ElementID="Ambari.SCOM.AmbariWatcherNode" ImageID="Ambari.SCOM.AmbariWatcherNode.16x16Image" />
+      <ImageReference ElementID="Ambari.SCOM.AmbariWatcherNode" ImageID="Ambari.SCOM.AmbariWatcherNode.80x80Image" />
+    </ImageReferences>
+  </Presentation>-->
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.AmbariWatcherNode">
+          <Name>Hadoop Watcher Node</Name>
+          <Description>This class identifies computer, participating in Hadoop monitoring.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+
+  <!--
+  <Resources>
+    <Image ID="Ambari.SCOM.AmbariWatcherNode.16x16Image" Accessibility="Public" FileName="AmbariWatcherNode-16.png" />
+    <Image ID="Ambari.SCOM.AmbariWatcherNode.80x80Image" Accessibility="Public" FileName="AmbariWatcherNode-80.png" />
+  </Resources>
+  -->
+</ManagementPackFragment>

+ 94 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/Cluster.mpx

@@ -0,0 +1,94 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.ClusterSeed" Accessibility="Public" Base="Ambari.SCOM.AmbariManagedEntity" Hosted="false" Abstract="false" Singleton="false">
+          <Property ID="TemplateName" Type="string" Key="true" />
+          <Property ID="ClusterName" Type="string" Key="true" />
+        </ClassType>
+
+        <ClassType ID="Ambari.SCOM.Cluster.Private" Accessibility="Public" Base="Ambari.SCOM.AmbariEntity" Hosted="false" Abstract="false" Singleton="false">
+          <Property ID="TemplateName" Type="string" Key="true" />
+          <Property ID="ClusterName" Type="string" Key="true" />
+        </ClassType>
+        
+        <ClassType ID="Ambari.SCOM.Cluster" Accessibility="Public" Base="Ambari.SCOM.AmbariEntity" Hosted="true" Abstract="false" Singleton="false" />
+      </ClassTypes>
+
+      <RelationshipTypes>
+        <RelationshipType ID="Ambari.SCOM.PrivateClusterHostsCluster"
+                          Base="System!System.Hosting" Accessibility="Public">
+          <Source ID="PrivateCluster" Type="Ambari.SCOM.Cluster.Private" />
+          <Target ID="Cluster" Type="Ambari.SCOM.Cluster" />
+        </RelationshipType>
+      </RelationshipTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <Presentation>
+    <ImageReferences>
+      <ImageReference ElementID="Ambari.SCOM.Cluster" ImageID="Ambari.SCOM.Resources.Images.Cluster16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.Cluster" ImageID="Ambari.SCOM.Resources.Images.ClusterDiagramIcon" />
+    </ImageReferences>
+  </Presentation>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.ClusterSeed">
+          <Name>Hadoop Cluster Seed</Name>
+          <Description>This class indicates discovered Hadoop Cluster.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterSeed" SubElementID="TemplateName">
+          <Name>Template Name</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterSeed" SubElementID="ClusterName">
+          <Name>Cluster Name</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.Cluster.Private">
+          <Name>Hadoop Cluster (Private Entity)</Name>
+          <Description>This class contains private properties of Hadoop Cluster.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Cluster.Private" SubElementID="TemplateName">
+          <Name>Template Name</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Cluster.Private" SubElementID="ClusterName">
+          <Name>Cluster Name</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.Cluster">
+          <Name>Hadoop Cluster</Name>
+          <Description>This class represents Hadoop Cluster.</Description>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.PrivateClusterHostsCluster">
+          <Name>Hadoop Cluster (Private Entity) Hosts Hadoop Cluster</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+
+  <!--
+  <Resources>
+    <Image ID="Ambari.SCOM.Cluster.16x16Image" Accessibility="Public" FileName="Cluster-16.png" />
+    <Image ID="Ambari.SCOM.Cluster.80x80Image" Accessibility="Public" FileName="Cluster-80.png" />
+  </Resources>
+  -->
+</ManagementPackFragment>

+ 65 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/ClusterHardwareProjection.mpx

@@ -0,0 +1,65 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.ClusterHardwareProjection" Accessibility="Public"
+                   Base="Ambari.SCOM.ClusterProjection" Hosted="true" Abstract="false" Singleton="false" />
+      </ClassTypes>
+
+      <RelationshipTypes>
+        <RelationshipType ID="Ambari.SCOM.ClusterHostsClusterHardwareProjection"
+                          Base="System!System.Hosting" Accessibility="Public">
+          <Source ID="Cluster" Type="Ambari.SCOM.Cluster" />
+          <Target ID="Projection" Type="Ambari.SCOM.ClusterHardwareProjection" />
+        </RelationshipType>
+
+        <RelationshipType ID="Ambari.SCOM.ClusterHardwareProjectionContainsHost"
+                          Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Projection" Type="Ambari.SCOM.ClusterHardwareProjection" />
+          <Target ID="Host" Type="Ambari.SCOM.Host" />
+        </RelationshipType>
+      </RelationshipTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <Presentation>
+    <ImageReferences>
+      <ImageReference ElementID="Ambari.SCOM.ClusterHardwareProjection" ImageID="Ambari.SCOM.Resources.Images.Hosts16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterHardwareProjection" ImageID="Ambari.SCOM.Resources.Images.HostsDiagramIcon" />
+    </ImageReferences>
+  </Presentation>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.ClusterHardwareProjection">
+          <Name>Cluster Hardware Projection</Name>
+          <Description>This class represents Hadoop Cluster Hardware monitoring projection, based on cluster nodes.</Description>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.ClusterHostsClusterHardwareProjection">
+          <Name>Cluster Hosts Cluster Hardware Projection</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterHardwareProjectionContainsHost">
+          <Name>Cluster Hardware Projection Contains Host</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 37 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/ClusterProjection.mpx

@@ -0,0 +1,37 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.ClusterProjection" Accessibility="Public"
+                   Base="System!System.LogicalEntity" Hosted="false" Abstract="true" Singleton="false" />
+      </ClassTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.ClusterProjection">
+          <Name>Hadoop Cluster Projection</Name>
+          <Description>This is the base class for monitoring projections of Hadoop Cluster.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 189 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/ClusterService.mpx

@@ -0,0 +1,189 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.ClusterService.Private" Accessibility="Public" Base="Ambari.SCOM.AmbariManagedEntity" Hosted="false" Abstract="false" Singleton="false">
+          <Property ID="TemplateName" Type="string" Key="true" />
+          <Property ID="ClusterName" Type="string" Key="true" />
+          <Property ID="ServiceName" Type="string" Key="true" />
+        </ClassType>
+
+        <ClassType ID="Ambari.SCOM.ClusterService" Accessibility="Public" Base="Ambari.SCOM.AmbariEntity" Hosted="true" Abstract="true" Singleton="false">
+          <Property ID="ClusterName" Type="string" Comment="Required to show parent cluster name on State Widget" />
+        </ClassType>
+
+        <ClassType ID="Ambari.SCOM.ClusterService.Hdfs" Accessibility="Public" Base="Ambari.SCOM.ClusterService" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.ClusterService.MapReduce" Accessibility="Public" Base="Ambari.SCOM.ClusterService" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.ClusterService.Hive" Accessibility="Public" Base="Ambari.SCOM.ClusterService" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.ClusterService.Templeton" Accessibility="Public" Base="Ambari.SCOM.ClusterService" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.ClusterService.Oozie" Accessibility="Public" Base="Ambari.SCOM.ClusterService" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.ClusterService.Pig" Accessibility="Public" Base="Ambari.SCOM.ClusterService" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.ClusterService.Sqoop" Accessibility="Public" Base="Ambari.SCOM.ClusterService" Hosted="true" Abstract="false" Singleton="false" />
+      </ClassTypes>
+
+      <RelationshipTypes>
+        <RelationshipType ID="Ambari.SCOM.PrivateClusterServiceHostsClusterService"
+                          Base="System!System.Hosting" Accessibility="Public">
+          <Source ID="PrivateService" Type="Ambari.SCOM.ClusterService.Private" />
+          <Target ID="Service" Type="Ambari.SCOM.ClusterService" />
+        </RelationshipType>
+
+        <RelationshipType ID="Ambari.SCOM.ClusterServiceContainsHostComponent" Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Service" Type="Ambari.SCOM.ClusterService" />
+          <Target ID="Component" Type="Ambari.SCOM.HostComponent" />
+        </RelationshipType>
+
+        <RelationshipType ID="Ambari.SCOM.HdfsServiceContainsNameNodeComponent" Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Service" Type="Ambari.SCOM.ClusterService.Hdfs" />
+          <Target ID="Component" Type="Ambari.SCOM.HostComponent.NameNode" />
+        </RelationshipType>
+        <RelationshipType ID="Ambari.SCOM.HdfsServiceContainsSecondaryNameNodeComponent" Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Service" Type="Ambari.SCOM.ClusterService.Hdfs" />
+          <Target ID="Component" Type="Ambari.SCOM.HostComponent.SecondaryNameNode" />
+        </RelationshipType>
+        <RelationshipType ID="Ambari.SCOM.MapReduceServiceContainsJobTrackerComponent" Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Service" Type="Ambari.SCOM.ClusterService.MapReduce" />
+          <Target ID="Component" Type="Ambari.SCOM.HostComponent.JobTracker" />
+        </RelationshipType>
+        <RelationshipType ID="Ambari.SCOM.HiveServiceContainsHiveServerComponent" Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Service" Type="Ambari.SCOM.ClusterService.Hive" />
+          <Target ID="Component" Type="Ambari.SCOM.HostComponent.HiveServer" />
+        </RelationshipType>
+        <RelationshipType ID="Ambari.SCOM.HiveServiceContainsHiveMetastoreComponent" Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Service" Type="Ambari.SCOM.ClusterService.Hive" />
+          <Target ID="Component" Type="Ambari.SCOM.HostComponent.HiveMetastore" />
+        </RelationshipType>
+        <RelationshipType ID="Ambari.SCOM.TempletonServiceContainsTempletonServerComponent" Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Service" Type="Ambari.SCOM.ClusterService.Templeton" />
+          <Target ID="Component" Type="Ambari.SCOM.HostComponent.TempletonServer" />
+        </RelationshipType>
+        <RelationshipType ID="Ambari.SCOM.OozieServiceContainsOozieServerComponent" Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Service" Type="Ambari.SCOM.ClusterService.Oozie" />
+          <Target ID="Component" Type="Ambari.SCOM.HostComponent.OozieServer" />
+        </RelationshipType>
+      </RelationshipTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <Presentation>
+    <ImageReferences>
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Hdfs" ImageID="Ambari.SCOM.Resources.Images.HDFS16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Hdfs" ImageID="Ambari.SCOM.Resources.Images.HDFSDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.MapReduce" ImageID="Ambari.SCOM.Resources.Images.MapReduce16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.MapReduce" ImageID="Ambari.SCOM.Resources.Images.MapReduceDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Hive" ImageID="Ambari.SCOM.Resources.Images.HiveService16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Hive" ImageID="Ambari.SCOM.Resources.Images.HiveServiceDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Templeton" ImageID="Ambari.SCOM.Resources.Images.TempletonService16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Templeton" ImageID="Ambari.SCOM.Resources.Images.TempletonServiceDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Oozie" ImageID="Ambari.SCOM.Resources.Images.OozieService16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Oozie" ImageID="Ambari.SCOM.Resources.Images.OozieServiceDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Pig" ImageID="Ambari.SCOM.Resources.Images.PigService16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Pig" ImageID="Ambari.SCOM.Resources.Images.PigServiceDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Sqoop" ImageID="Ambari.SCOM.Resources.Images.ScoopService16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterService.Sqoop" ImageID="Ambari.SCOM.Resources.Images.ScoopServiceDiagramIcon" />
+    </ImageReferences>
+  </Presentation>
+
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.Private">
+          <Name>Hadoop Cluster Service (Private Entity)</Name>
+          <Description>This class contains private properties of Hadoop Cluster Service.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.Private" SubElementID="TemplateName">
+          <Name>Template Name</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.Private" SubElementID="ClusterName">
+          <Name>Cluster Name</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.Private" SubElementID="ServiceName">
+          <Name>Service Name</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.ClusterService">
+          <Name>Hadoop Cluster Service</Name>
+          <Description>Base class for all Hadoop Cluster Services.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService" SubElementID="ClusterName">
+          <Name>Cluster Name</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.PrivateClusterServiceHostsClusterService">
+          <Name>Hadoop Cluster Service (Private) Hosts Hadoop Cluster Service</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterServiceContainsHostComponent">
+          <Name>Hadoop Cluster Service Contains Hadoop Host Component</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.Hdfs">
+          <Name>Hadoop HDFS Cluster Service</Name>
+          <Description>This class represents Hadoop HDFS Service.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.MapReduce">
+          <Name>Hadoop MapReduce Cluster Service</Name>
+          <Description>This class represents Hadoop MapReduce Service.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.Hive">
+          <Name>Hadoop Hive Cluster Services</Name>
+          <Description>This class represents Hadoop Hive Service.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.Templeton">
+          <Name>Hadoop Templeton Cluster Services</Name>
+          <Description>This class represents Hadoop Templeton Service.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.Oozie">
+          <Name>Hadoop Oozie Cluster Services</Name>
+          <Description>This class represents Hadoop Oozie Service.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.Pig">
+          <Name>Hadoop Pig Cluster Services</Name>
+          <Description>This class represents Hadoop Pig Service.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterService.Sqoop">
+          <Name>Hadoop Sqoop Cluster Service</Name>
+          <Description>This class represents Hadoop Sqoop Service.</Description>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.HdfsServiceContainsNameNodeComponent">
+          <Name>Hadoop HDFS Cluster Service Contains NameNode Host Component</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HdfsServiceContainsSecondaryNameNodeComponent">
+          <Name>Hadoop HDFS Cluster Service Contains Secondary NameNode Host Component</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.MapReduceServiceContainsJobTrackerComponent">
+          <Name>Hadoop MapReduce Cluster Service Contains JobTracker Host Component</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HiveServiceContainsHiveServerComponent">
+          <Name>Hadoop Hive Cluster Service Contains Hive Server Host Component</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HiveServiceContainsHiveMetastoreComponent">
+          <Name>Hadoop Hive Cluster Service Contains Hive Metastore Host Component</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.TempletonServiceContainsTempletonServerComponent">
+          <Name>Hadoop Templeton Cluster Service Contains Templeton Server Host Component</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.OozieServiceContainsOozieServerComponent">
+          <Name>Hadoop Oozie Cluster Service Contains Oozie Server Host Component</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 66 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/ClusterSoftwareProjection.mpx

@@ -0,0 +1,66 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.ClusterSoftwareProjection" Accessibility="Public"
+                   Base="Ambari.SCOM.ClusterProjection" Hosted="true" Abstract="false" Singleton="false" />
+      </ClassTypes>
+
+      <RelationshipTypes>
+        <RelationshipType ID="Ambari.SCOM.ClusterHostsClusterSoftwareProjection"
+                          Base="System!System.Hosting" Accessibility="Public">
+          <Source ID="Cluster" Type="Ambari.SCOM.Cluster" />
+          <Target ID="Projection" Type="Ambari.SCOM.ClusterSoftwareProjection" />
+        </RelationshipType>
+
+        <RelationshipType ID="Ambari.SCOM.ClusterSoftwareProjectionContainsClusterService"
+                            Base="System!System.Containment" Abstract="false" Accessibility="Public">
+          <Source ID="Projection" Type="Ambari.SCOM.ClusterSoftwareProjection" />
+          <Target ID="Service" Type="Ambari.SCOM.ClusterService" />
+        </RelationshipType>
+      </RelationshipTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <Presentation>
+    <ImageReferences>
+      <ImageReference ElementID="Ambari.SCOM.ClusterSoftwareProjection" ImageID="Ambari.SCOM.Resources.Images.Services16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.ClusterSoftwareProjection" ImageID="Ambari.SCOM.Resources.Images.ServicesDiagramIcon" />
+    </ImageReferences>
+  </Presentation>
+
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.ClusterSoftwareProjection">
+          <Name>Hadoop Cluster Software Projection</Name>
+          <Description>This class represents Hadoop Cluster Software monitoring projection, based on cluster services.</Description>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.ClusterHostsClusterSoftwareProjection">
+          <Name>Hadoop Cluster Hosts Cluster Software Projection</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClusterSoftwareProjectionContainsClusterService">
+          <Name>Hadoop Cluster Software Projection Contains Cluster Service</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 46 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/ClustersGroup.mpx

@@ -0,0 +1,46 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.ClustersGroup" Accessibility="Public" Base="System!System.Group" Hosted="false" Abstract="false" Singleton="true" />
+      </ClassTypes>
+
+      <RelationshipTypes>
+        <RelationshipType ID="Ambari.SCOM.ClustersGroupContainsCluster" Accessibility="Public" Base="System!System.Containment" Abstract="false">
+          <Source ID="Source" Type="Ambari.SCOM.ClustersGroup" />
+          <Target ID="Target" Type="Ambari.SCOM.Cluster" />
+        </RelationshipType>
+      </RelationshipTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.ClustersGroup">
+          <Name>Hadoop Clusters</Name>
+          <Description>A group containing all monitored Hadoop Clusters.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.ClustersGroupContainsCluster">
+          <Name>Hadoop Clusters Group Contains Hadoop Cluster</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 87 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/Host.mpx

@@ -0,0 +1,87 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.Host.Private" Accessibility="Public" Base="Ambari.SCOM.AmbariManagedEntity" Hosted="false" Abstract="false" Singleton="false">
+          <Property ID="TemplateName" Type="string" Key="true" />
+          <Property ID="ClusterName" Type="string" Key="true" />
+          <Property ID="HostName" Type="string" Key="true" />
+        </ClassType>
+        
+        <ClassType ID="Ambari.SCOM.Host" Accessibility="Public" Base="Ambari.SCOM.AmbariEntity" Hosted="true" Abstract="false" Singleton="false">
+          <Property ID="IpAddress" Type="string" Key="true" />
+        </ClassType>
+      </ClassTypes>
+
+      <RelationshipTypes>
+        <RelationshipType ID="Ambari.SCOM.PrivateHostHostsHost"
+                          Base="System!System.Hosting" Accessibility="Public">
+          <Source ID="PrivateHost" Type="Ambari.SCOM.Host.Private" />
+          <Target ID="Host" Type="Ambari.SCOM.Host" />
+        </RelationshipType>
+      </RelationshipTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <Presentation>
+    <ImageReferences>
+      <ImageReference ElementID="Ambari.SCOM.Host" ImageID="Ambari.SCOM.Resources.Images.Host16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.Host" ImageID="Ambari.SCOM.Resources.Images.HostDiagramIcon" />
+    </ImageReferences>
+  </Presentation>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Host.Private">
+          <Name>Hadoop Host (Private Entity)</Name>
+          <Description>This class contains private properties of Hadoop Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Host.Private" SubElementID="TemplateName">
+          <Name>Template Name</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Host.Private" SubElementID="ClusterName">
+          <Name>Cluster Name</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Host.Private" SubElementID="HostName">
+          <Name>Host Name</Name>
+        </DisplayString>
+        
+        <DisplayString ElementID="Ambari.SCOM.Host">
+          <Name>Hadoop Host</Name>
+          <Description>This class represents Hadoop Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Host" SubElementID="IpAddress">
+          <Name>IP Address</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.PrivateHostHostsHost">
+          <Name>Hadoop Host (Private Entity) Hosts Hadoop Host</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+
+  <!--
+  <Resources>
+    <Image ID="Ambari.SCOM.Host.16x16Image" Accessibility="Public" FileName="Host-16.png" />
+    <Image ID="Ambari.SCOM.Host.80x80Image" Accessibility="Public" FileName="Host-80.png" />
+  </Resources>
+  -->
+</ManagementPackFragment>

+ 159 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Classes/HostComponent.mpx

@@ -0,0 +1,159 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <EntityTypes>
+      <ClassTypes>
+        <ClassType ID="Ambari.SCOM.HostComponent" Accessibility="Public" Base="Ambari.SCOM.AmbariManagedEntity" Hosted="true" Abstract="true" Singleton="false">
+          <Property ID="ClusterName" Type="string" Comment="Required to show parent cluster name on State Widget" />
+          <Property ID="ComponentName" Type="string" Key="true" />
+        </ClassType>
+
+        <ClassType ID="Ambari.SCOM.ActiveHostComponent" Accessibility="Public" Base="Ambari.SCOM.HostComponent" Hosted="true" Abstract="true" Singleton="false"
+                   Comment="Represents daemon/service that is actually running on the host" />
+        
+        <ClassType ID="Ambari.SCOM.BasicPerformanceHostComponent" Accessibility="Public" Base="Ambari.SCOM.ActiveHostComponent" Hosted="true" Abstract="true" Singleton="false"
+                   Comment="Basic set of performance collection rules applies" />
+        
+        <ClassType ID="Ambari.SCOM.HeadNodeComponent" Accessibility="Public" Base="Ambari.SCOM.BasicPerformanceHostComponent" Hosted="true" Abstract="true" Singleton="false"
+                   Comment="Extended set of performance collection rules applies" />
+
+        <ClassType ID="Ambari.SCOM.HostComponent.NameNode" Accessibility="Public" Base="Ambari.SCOM.HeadNodeComponent" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.HostComponent.SecondaryNameNode" Accessibility="Public" Base="Ambari.SCOM.ActiveHostComponent" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.HostComponent.JobTracker" Accessibility="Public" Base="Ambari.SCOM.HeadNodeComponent" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.HostComponent.TaskTracker" Accessibility="Public" Base="Ambari.SCOM.BasicPerformanceHostComponent" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.HostComponent.HiveServer" Accessibility="Public" Base="Ambari.SCOM.ActiveHostComponent" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.HostComponent.HiveMetastore" Accessibility="Public" Base="Ambari.SCOM.ActiveHostComponent" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.HostComponent.HiveClient" Accessibility="Public" Base="Ambari.SCOM.HostComponent" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.HostComponent.TempletonServer" Accessibility="Public" Base="Ambari.SCOM.ActiveHostComponent" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.HostComponent.OozieServer" Accessibility="Public" Base="Ambari.SCOM.ActiveHostComponent" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.HostComponent.Pig" Accessibility="Public" Base="Ambari.SCOM.HostComponent" Hosted="true" Abstract="false" Singleton="false" />
+        <ClassType ID="Ambari.SCOM.HostComponent.Sqoop" Accessibility="Public" Base="Ambari.SCOM.HostComponent" Hosted="true" Abstract="false" Singleton="false" />
+      </ClassTypes>
+
+      <RelationshipTypes>
+        <RelationshipType ID="Ambari.SCOM.HostHostsHostComponent" Base="System!System.Hosting" Abstract="false" Accessibility="Public">
+          <Source ID="Host" Type="Ambari.SCOM.Host" />
+          <Target ID="Component" Type="Ambari.SCOM.HostComponent" />
+        </RelationshipType>
+      </RelationshipTypes>
+    </EntityTypes>
+  </TypeDefinitions>
+
+  <Presentation>
+    <ImageReferences>
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.NameNode" ImageID="Ambari.SCOM.Resources.Images.NameNode16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.NameNode" ImageID="Ambari.SCOM.Resources.Images.NameNodeDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.SecondaryNameNode" ImageID="Ambari.SCOM.Resources.Images.SecNameNode16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.SecondaryNameNode" ImageID="Ambari.SCOM.Resources.Images.SecNameNodeDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.JobTracker" ImageID="Ambari.SCOM.Resources.Images.JobTracker16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.JobTracker" ImageID="Ambari.SCOM.Resources.Images.JobTrackerDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.TaskTracker" ImageID="Ambari.SCOM.Resources.Images.TaskTracker16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.TaskTracker" ImageID="Ambari.SCOM.Resources.Images.TaskTrackerDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.HiveServer" ImageID="Ambari.SCOM.Resources.Images.HiveServer16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.HiveServer" ImageID="Ambari.SCOM.Resources.Images.HiveServerDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.HiveMetastore" ImageID="Ambari.SCOM.Resources.Images.HiveMetastore16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.HiveMetastore" ImageID="Ambari.SCOM.Resources.Images.HiveMetastoreDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.HiveClient" ImageID="Ambari.SCOM.Resources.Images.HiveClient16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.HiveClient" ImageID="Ambari.SCOM.Resources.Images.HiveClientDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.TempletonServer" ImageID="Ambari.SCOM.Resources.Images.TempletonServer16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.TempletonServer" ImageID="Ambari.SCOM.Resources.Images.TempletonServerDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.OozieServer" ImageID="Ambari.SCOM.Resources.Images.OozieServer16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.OozieServer" ImageID="Ambari.SCOM.Resources.Images.OozieServerDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.Pig" ImageID="Ambari.SCOM.Resources.Images.Pig16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.Pig" ImageID="Ambari.SCOM.Resources.Images.PigDiagramIcon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.Sqoop" ImageID="Ambari.SCOM.Resources.Images.Scoop16Icon" />
+      <ImageReference ElementID="Ambari.SCOM.HostComponent.Sqoop" ImageID="Ambari.SCOM.Resources.Images.ScoopDiagramIcon" />
+    </ImageReferences>
+  </Presentation>
+
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent">
+          <Name>Hadoop Host Component</Name>
+          <Description>This is a base class for all Hadoop Host Component.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent" SubElementID="ClusterName">
+          <Name>Cluster Name</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent" SubElementID="ComponentName">
+          <Name>Component Name</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.ActiveHostComponent">
+          <Name>Hadoop Active Host Component</Name>
+          <Description>This is a base class for all components that are represented by daemon/service running on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.BasicPerformanceHostComponent">
+          <Name>Hadoop Basic Performance Host Component</Name>
+          <Description>This is a base class for all components that provides basic performance data.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HeadNodeComponent">
+          <Name>Hadoop Head Node Component</Name>
+          <Description>This is a base class for Hadoop Host Components hosted on Head Node.</Description>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.NameNode">
+          <Name>Hadoop NameNode Service</Name>
+          <Description>This class represents Hadoop NameNode Service running on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.SecondaryNameNode">
+          <Name>Hadoop Secondary NameNode Service</Name>
+          <Description>This class represents Hadoop Secondary NameNode Service running on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.JobTracker">
+          <Name>Hadoop JobTracker Service</Name>
+          <Description>This class represents Hadoop JobTracker Service running on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.TaskTracker">
+          <Name>Hadoop TaskTracker Service</Name>
+          <Description>This class represents Hadoop TaskTracker Service running on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.TempletonServer">
+          <Name>Hadoop Templeton Service</Name>
+          <Description>This class represents Hadoop Templeton Server Service running on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.HiveServer">
+          <Name>Hadoop Hive Server Service</Name>
+          <Description>This class represents Hadoop Hive Server Service running on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.HiveMetastore">
+          <Name>Hadoop Hive Metastore Service</Name>
+          <Description>This class represents Hadoop Hive Metastore Service running on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.HiveClient">
+          <Name>Hadoop Hive Client Component</Name>
+          <Description>This class represents Hadoop Hive Client Component on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.OozieServer">
+          <Name>Hadoop Oozie Server Service</Name>
+          <Description>This class represents Hadoop Oozie Server Service running on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.Pig">
+          <Name>Hadoop Pig Component</Name>
+          <Description>This class represents Hadoop Pig Component on the Host.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.HostComponent.Sqoop">
+          <Name>Hadoop Sqoop Component</Name>
+          <Description>This class represents Hadoop Sqoop Component on the Host.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 62 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Discoveries/ClustersGroupPopulator.mpx

@@ -0,0 +1,62 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <Monitoring>
+    <Discoveries>
+      <Discovery ID="Ambari.SCOM.Discovery.ClustersGroup"
+                 Target="Ambari.SCOM.ClustersGroup" Enabled="true">
+        <Category>Discovery</Category>
+        <DiscoveryTypes>
+          <DiscoveryClass TypeID="Ambari.SCOM.ClustersGroup" />
+          <DiscoveryRelationship TypeID="Ambari.SCOM.ClustersGroupContainsCluster" />
+        </DiscoveryTypes>
+        <DataSource ID="DiscoveryDataSource" TypeID="SC!Microsoft.SystemCenter.GroupPopulator">
+          <RuleId>$MPElement$</RuleId>
+          <GroupInstanceId>$Target/Id$</GroupInstanceId>
+          <MembershipRules>
+            <MembershipRule>
+              <MonitoringClass>$MPElement[Name="Ambari.SCOM.Cluster"]$</MonitoringClass>
+              <RelationshipClass>$MPElement[Name="Ambari.SCOM.ClustersGroupContainsCluster"]$</RelationshipClass>
+            </MembershipRule>
+          </MembershipRules>
+        </DataSource>
+      </Discovery>
+    </Discoveries>
+  </Monitoring>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Discovery.ClustersGroup">
+          <Name>Hadoop Clusters Group Discovery</Name>
+          <Description>This workflow populates the Hadoop Clusters group with Hadoop Clusters.</Description>
+        </DisplayString>
+      </DisplayStrings>
+
+      <KnowledgeArticles>
+        <KnowledgeArticle ElementID="Ambari.SCOM.Discovery.ClustersGroup">
+          <MamlContent>
+            <section xmlns="http://schemas.microsoft.com/maml/2004/10">
+              <title>Summary</title>
+              <para>This workflow populates the Hadoop Clusters group with Hadoop Clusters.</para>
+            </section>
+          </MamlContent>
+        </KnowledgeArticle>
+      </KnowledgeArticles>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 73 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Discoveries/HostComponentsDiscovery.mpx

@@ -0,0 +1,73 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <Monitoring>
+    <Discoveries>
+      <Discovery ID="Ambari.SCOM.Discovery.HostComponents"
+                 Target="Ambari.SCOM.Host"
+                 Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">
+        <Category>Discovery</Category>
+        <DiscoveryTypes>
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent">
+            <Property TypeID="Ambari.SCOM.AmbariManagedEntity" PropertyID="AmbariUri" />
+            <Property TypeID="Ambari.SCOM.HostComponent" PropertyID="ComponentName" />
+          </DiscoveryClass>
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.NameNode" />
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.SecondaryNameNode" />
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.JobTracker" />
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.TaskTracker" />
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.HiveServer" />
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.HiveMetastore" />
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.HiveClient" />
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.TempletonServer" />
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.OozieServer" />
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.Pig" />
+          <DiscoveryClass TypeID="Ambari.SCOM.HostComponent.Sqoop" />
+          <DiscoveryRelationship TypeID="Ambari.SCOM.HostHostsHostComponent" />
+          <DiscoveryRelationship TypeID="Ambari.SCOM.ClusterServiceContainsHostComponent" />
+          <DiscoveryRelationship TypeID="Ambari.SCOM.HdfsServiceContainsNameNodeComponent" />
+          <DiscoveryRelationship TypeID="Ambari.SCOM.MapReduceServiceContainsJobTrackerComponent" />
+          <DiscoveryRelationship TypeID="Ambari.SCOM.HiveServiceContainsHiveServerComponent" />
+          <DiscoveryRelationship TypeID="Ambari.SCOM.HiveServiceContainsHiveMetastoreComponent" />
+          <DiscoveryRelationship TypeID="Ambari.SCOM.TempletonServiceContainsTempletonServerComponent" />
+          <DiscoveryRelationship TypeID="Ambari.SCOM.OozieServiceContainsOozieServerComponent" />
+        </DiscoveryTypes>
+        <DataSource ID="DS" TypeID="Ambari.SCOM.Module.HostComponentsDiscoveryDataSource">
+          <IntervalSeconds>14400</IntervalSeconds>
+          <SyncTime />
+          <TimeoutSeconds>300</TimeoutSeconds>
+          <TemplateName>$Target/Host/Property[Type="Ambari.SCOM.Host.Private"]/TemplateName$</TemplateName>
+          <ClusterName>$Target/Host/Property[Type="Ambari.SCOM.Host.Private"]/ClusterName$</ClusterName>
+          <HostName>$Target/Host/Property[Type="Ambari.SCOM.Host.Private"]/HostName$</HostName>
+          <HostIpAddress>$Target/Property[Type="Ambari.SCOM.Host"]/IpAddress$</HostIpAddress>
+          <HostAmbariUri>$Target/Host/Property[Type="Ambari.SCOM.AmbariManagedEntity"]/AmbariUri$</HostAmbariUri>
+        </DataSource>
+      </Discovery>
+    </Discoveries>
+  </Monitoring>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Discovery.HostComponents">
+          <Name>Hadoop Host Components Discovery</Name>
+          <Description>This workflow discovers all types of Hadoop Host Components running on specific host.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 773 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/HadoopMp.mpproj

@@ -0,0 +1,773 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <ProjectGuid>{63b476b6-efcd-468f-80d9-94e2cff1b5db}</ProjectGuid>
+    <RootNamespace>Ambari.SCOM</RootNamespace>
+    <Name>Ambari SCOM Monitoring</Name>
+    <ManagementPackName>Ambari.SCOM.Monitoring</ManagementPackName>
+    <Version>0.9.0.0</Version>
+    <MpFrameworkVersion>v7.0</MpFrameworkVersion>
+    <MpFrameworkProfile>OM</MpFrameworkProfile>
+    <ProductVersion>0.9.0.0</ProductVersion>
+    <SccProjectName>SAK</SccProjectName>
+    <SccProvider>SAK</SccProvider>
+    <SccAuxPath>SAK</SccAuxPath>
+    <SccLocalPath>SAK</SccLocalPath>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Debug\</OutputPath>
+    <GenerateSealed>True</GenerateSealed>
+    <Company>MyCompany</Company>
+    <Copyright>Copyright (c) MyCompany. All rights reserved.</Copyright>
+    <DelaySigning>False</DelaySigning>
+    <AssemblyOriginatorKeyFile>..\Items\key.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <DebugSymbols>false</DebugSymbols>
+    <OutputPath>bin\Release\</OutputPath>
+    <DelaySigning>False</DelaySigning>
+    <Company>MyCompany</Company>
+    <Copyright>Copyright (c) MyCompany. All rights reserved.</Copyright>
+    <DelaySign>false</DelaySign>
+    <AssemblyOriginatorKeyFile>..\Items\key.snk</AssemblyOriginatorKeyFile>
+    <GenerateSealed>True</GenerateSealed>
+  </PropertyGroup>
+  <ItemGroup>
+    <ManagementPackReference Include="Microsoft.SystemCenter.DataWarehouse.Library">
+      <HintPath>C:\Program Files (x86)\System Center 2012 Visual Studio Authoring Extensions\References\OM2012\Microsoft.SystemCenter.DataWarehouse.Library.mp</HintPath>
+      <Alias>SCDW</Alias>
+      <MinVersion>7.0.8427.0</MinVersion>
+      <PackageToBundle>False</PackageToBundle>
+    </ManagementPackReference>
+    <ManagementPackReference Include="Microsoft.SystemCenter.Library">
+      <Alias>SC</Alias>
+      <PackageToBundle>False</PackageToBundle>
+    </ManagementPackReference>
+    <ManagementPackReference Include="Microsoft.SystemCenter.OperationsManager.Library">
+      <HintPath>C:\Program Files (x86)\System Center 2012 Visual Studio Authoring Extensions\References\OM2012\Microsoft.SystemCenter.OperationsManager.Library.mp</HintPath>
+      <Alias>OM</Alias>
+      <MinVersion>7.0.8560.0</MinVersion>
+      <PackageToBundle>False</PackageToBundle>
+    </ManagementPackReference>
+    <ManagementPackReference Include="Microsoft.Windows.Library">
+      <Alias>Windows</Alias>
+      <PackageToBundle>False</PackageToBundle>
+    </ManagementPackReference>
+    <ManagementPackReference Include="System.Health.Library">
+      <Alias>Health</Alias>
+      <PackageToBundle>False</PackageToBundle>
+    </ManagementPackReference>
+    <ManagementPackReference Include="System.Library">
+      <Alias>System</Alias>
+      <PackageToBundle>False</PackageToBundle>
+    </ManagementPackReference>
+    <ManagementPackReference Include="Microsoft.SystemCenter.Visualization.Library">
+      <Alias>Visualization</Alias>
+      <PackageToBundle>False</PackageToBundle>
+    </ManagementPackReference>
+    <ManagementPackReference Include="System.Performance.Library">
+      <HintPath>C:\Program Files (x86)\System Center 2012 Visual Studio Authoring Extensions\References\OM2012\System.Performance.Library.mp</HintPath>
+      <Alias>Perf</Alias>
+      <MinVersion>7.0.8427.0</MinVersion>
+      <PackageToBundle>False</PackageToBundle>
+    </ManagementPackReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Classes\AmbariAccessorRole.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\AmbariEntity.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\AmbariSeed.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\AmbariWatcherNode.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\Cluster.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\ClusterProjection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\ClusterService.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\ClustersGroup.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\ClusterSoftwareProjection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\ClusterHardwareProjection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\Host.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Classes\HostComponent.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Discoveries\ClustersGroupPopulator.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Discoveries\HostComponentsDiscovery.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Images\Icons.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ManagementPack.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\ConditionDetections\PropertyBagMultiplePerformanceDataMapper.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\ConditionDetections\PropertyBagPerformanceDataMapper.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Discovery\AmbariSeedDiscoveryDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Discovery\ClustersDiscoveryDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Discovery\ClusterServicesDiscoveryDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Discovery\HostsDiscoveryDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Discovery\PowerShellDiscoveryDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Discovery\HostComponentsDiscoveryDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Monitoring\BaseScriptedPropertyBagDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Monitoring\HdfsServiceMetricsDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Monitoring\HdfsServiceMetricsPerformanceDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Monitoring\HostComponentHealthStateDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Monitoring\HostComponentMetricsDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Monitoring\ClusterServiceMetricsDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Monitoring\HostComponentMetricsPerformanceDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Monitoring\MapReduceServiceMetricsDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\DataSources\Monitoring\MapReduceServiceMetricsPerformanceDataSource.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Modules\ProbeActions\ImpersonatedPowerShellPropertyBagProbe.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HdfsService\CorruptedBlocksUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HdfsService\DeadDataNodesUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HdfsService\CapacityRemainingUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HdfsService\UnderReplicatedBlocksUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HostComponentsHeathState\HiveMetastoreHealthStateUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HostComponentsHeathState\HiveServerHealthStateUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HostComponentsHeathState\JobTrackerHealthStateUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HostComponentsHeathState\NameNodeHealthStateUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HostComponentsHeathState\OozieServerHealthStateUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HostComponentsHeathState\SecondaryNameNodeHealthStateUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HostComponentsHeathState\TaskTrackerHealthStateUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\HostComponentsHeathState\TempletonServerHealthStateUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\JobTracker\MemoryHeapUsageUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\MapReduceService\DeadTaskTrackersUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\MapReduceService\FailedJobsUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\MapReduceService\InvalidTaskTrackersUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\NameNode\MemoryHeapUsageUnitMonitor.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\HiveMetastoreComponentToHiveServiceRollup.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\HiveServerComponentToHiveServiceRollup.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\HostComponentToHostRollups.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\HostToHardwareProjectionRollups.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\ClusterServiceToSoftwareProjectionRollups.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\JobTrackerComponentToMapReduceServiceRolllup.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\NameNodeComponentToHdfsServiceRollup.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\OozieServerComponentToOozieServiceRollup.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\SecondaryNameNodeComponentToHdfsServiceRollup.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\SoftwareProjectionToClusterRollups.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Monitors\Rollups\TempletonServerComponentToTempletonServiceRollup.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MonitorTypes\InvalidTaskTrackersMonitorType.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MonitorTypes\HdfsServiceThreeStateThresholdMonitorType.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MonitorTypes\HdfsServiceTwoStateThresholdMonitorType.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MonitorTypes\HostComponentThreeStateThresholdMonitorType.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MonitorTypes\MapReduceServiceThreeStateThresholdMonitorType.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MonitorTypes\HostComponentHealthStateMonitorType.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Presentation\ActiveAlerts.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Presentation\ClustersDiagram.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="References.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\BlocksReadCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\BlocksWrittenCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\BytesReadCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\BytesWrittenCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\CapacityNonDfsUsedGbCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\CapacityRemainingGbCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\CapacityTotalGbCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\CapacityUsedGbCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\CorruptedBlocksCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\DeadNodesCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\DecommissionedNodesCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\FilesAppendedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\FilesCreatedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\FilesDeletedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\LiveNodesCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\MissingBlocksCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\PendingDeletionBlocksCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\PendingReplicationBlocksCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\TotalBlocksCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\TotalFilesCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HdfsService\UnderReplicatedBlocksCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\GcCountCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\LogErrorCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\LogFatalCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\MemoryNonHeapCommittedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\MemoryNonHeapUsedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\ReceivedBytesCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\RpcAuthorizationFailuresCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\RpcProcessingAvgTimeCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\RpcProcessingNumOpsCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\RpcQueueAvgTimeCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\RpcQueueNumOpsCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\HeadNode\SentBytesCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\Shared\GcTimeCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\Shared\MemoryHeapCommittedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\Shared\MemoryHeapUsedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\Shared\ThreadsBlockedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\Shared\ThreadsNewCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\Shared\ThreadsRunnableCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\Shared\ThreadsTerminatedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\Shared\ThreadsTimedWaitingCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\Shared\ThreadsWaitingCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Presentation\ClusterServicesPerformance.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Presentation\Folders.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Presentation\HostComponentsPerformance.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\TaskTracker\MapSlotsCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\TaskTracker\MapsRunningCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\TaskTracker\ReduceSlotsCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\TaskTracker\ReducesRunningCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\TaskTracker\ShuffleExceptionCaughtCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\TaskTracker\ShuffleFailedOutputsCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\TaskTracker\ShuffleHandlerBusyPercentCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\TaskTracker\ShuffleOutputBytesCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\HostComponents\TaskTracker\ShuffleSuccessOutputsCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\DeadTaskTrackersCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\FailedJobsPercentCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\JobsCompletedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\JobsFailedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\JobsKilledCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\JobsPreparingCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\JobsRunningCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\JobsSubmittedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\LiveTaskTrackersCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\MapsCompletedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\MapsFailedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\MapsKilledCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\MapsLaunchedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\MapsRunningCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\MapsWaitingCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\NumberOfTaskTrackersCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\OccupiedMapSlotsCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\OccupiedReduceSlotsCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\ReducesCompletedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\ReducesFailedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\ReducesKilledCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\ReducesLaunchedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\ReducesRunningCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\ReducesWaitingCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\ReservedMapSlotsCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\ReservedReduceSlotsCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\TaskTrackersBlacklistedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\TaskTrackersDecommissionedCollection.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Performance\MapReduceService\TaskTrackersGraylisted.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Widgets\LiveVsDeadNodes.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Rules\Widgets\SpaceUtilization.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="RunAsProfiles.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Templates\DiscoveryTemplate.mpx">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Discoveries" />
+    <Folder Include="Modules" />
+    <Folder Include="Modules\DataSources" />
+    <Folder Include="Classes" />
+    <Folder Include="Modules\DataSources\Discovery" />
+    <Folder Include="Modules\DataSources\Discovery\Scripts" />
+    <Folder Include="Images" />
+    <Folder Include="Modules\ConditionDetections" />
+    <Folder Include="Modules\DataSources\Monitoring" />
+    <Folder Include="Modules\DataSources\Monitoring\Scripts" />
+    <Folder Include="Modules\ProbeActions" />
+    <Folder Include="Monitors" />
+    <Folder Include="Monitors\HdfsService" />
+    <Folder Include="Monitors\NameNode" />
+    <Folder Include="Monitors\MapReduceService" />
+    <Folder Include="Monitors\JobTracker" />
+    <Folder Include="Monitors\HostComponentsHeathState" />
+    <Folder Include="Monitors\Rollups" />
+    <Folder Include="MonitorTypes" />
+    <Folder Include="Rules" />
+    <Folder Include="Rules\Widgets" />
+    <Folder Include="Rules\Performance" />
+    <Folder Include="Presentation" />
+    <Folder Include="Rules\Performance\HostComponents" />
+    <Folder Include="Rules\Performance\HostComponents\HeadNode" />
+    <Folder Include="Rules\Performance\HostComponents\TaskTracker" />
+    <Folder Include="Rules\Performance\HostComponents\Shared" />
+    <Folder Include="Rules\Performance\HdfsService" />
+    <Folder Include="Rules\Performance\MapReduceService" />
+    <Folder Include="Templates" />
+    <Folder Include="Shared Scripts" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Modules\DataSources\Discovery\Scripts\ClustersDiscovery.ps1" />
+    <EmbeddedResource Include="Modules\DataSources\Discovery\Scripts\HostComponentsDiscovery.ps1" />
+    <EmbeddedResource Include="Modules\DataSources\Discovery\Scripts\HostsDiscovery.ps1" />
+    <EmbeddedResource Include="Modules\DataSources\Discovery\Scripts\ClusterServicesDiscovery.ps1" />
+    <EmbeddedResource Include="Modules\DataSources\Monitoring\Scripts\HdfsServiceMetrics.ps1" />
+    <EmbeddedResource Include="Modules\DataSources\Monitoring\Scripts\HostComponentHealthState.ps1" />
+    <EmbeddedResource Include="Modules\DataSources\Monitoring\Scripts\HostComponentMetrics.ps1" />
+    <EmbeddedResource Include="Modules\DataSources\Monitoring\Scripts\MapReduceServiceMetrics.ps1" />
+    <EmbeddedResource Include="Shared Scripts\DiscoveryHelpers.ps1" />
+    <EmbeddedResource Include="Shared Scripts\HealthServicesManagement.ps1" />
+    <EmbeddedResource Include="Shared Scripts\JsonParser.ps1" />
+    <EmbeddedResource Include="Shared Scripts\Logging.ps1" />
+    <EmbeddedResource Include="Shared Scripts\MonitoringHelpers.ps1" />
+    <EmbeddedResource Include="Shared Scripts\RestApi.ps1" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Images\DataNode.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\DataNode_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\hdfs.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\hdfs_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\HiveClient.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\HiveClient_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\HiveMetastore.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\HiveMetastore_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\HiveServer.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\HiveServer_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\hiveservice.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\hiveservice_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\Cluster.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\Cluster_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\Host.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\hosts.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\hosts_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\Host_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\JobTracker.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\JobTracker_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\mapreduce.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\mapreduce_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\NameNode.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\NameNode_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\OozieServer.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\OozieServer_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\OozieService.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\OozieService_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\Pig.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\PigService.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\PigService_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\Pig_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\Scoop.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\ScoopService.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\ScoopService_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\Scoop_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\SecNameNode.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\SecNameNode_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\Services.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\Services_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\TaskTracker.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\TaskTracker_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\TempletonService.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\TempletonService_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\TrmpletonServer.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Images\TrmpletonServer_.png">
+      <SubType>Content</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Modules\Modules.csproj">
+      <Name>Modules</Name>
+      <Project>{aeaa0fb0-d274-491a-beb5-5354584f1400}</Project>
+      <Private>True</Private>
+      <PackageToBundle>True</PackageToBundle>
+    </ProjectReference>
+    <ProjectReference Include="..\ScomPages\ScomPages.csproj">
+      <Name>ScomPages</Name>
+      <Project>{b77e5ea7-3fe4-49c9-88ac-3ab871a26f9b}</Project>
+      <Private>True</Private>
+      <PackageToBundle>True</PackageToBundle>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VSAC\Microsoft.SystemCenter.OperationsManager.targets" />
+</Project>

+ 28 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/HadoopMp.mpproj.user

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <DeploymentNextVersion>1.0.0.56</DeploymentNextVersion>
+    <DeploymentAutoIncrementVersion>False</DeploymentAutoIncrementVersion>
+    <DeploymentStartAction>None</DeploymentStartAction>
+    <DeploymentWebConsoleUrl />
+    <DeploymentCommand />
+    <DeploymentCommandArguments />
+    <DeploymentDependencyMode>ProjectOnly</DeploymentDependencyMode>
+  </PropertyGroup>
+</Project>

+ 116 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Images/Icons.mpx

@@ -0,0 +1,116 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <Categories>
+    <Category ID="Ambari.SCOM.Resources.Images.DataNode16IconCategory" Target="Ambari.SCOM.Resources.Images.DataNode16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.DataNodeDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.DataNodeDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HDFS16IconCategory" Target="Ambari.SCOM.Resources.Images.HDFS16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HDFSDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.HDFSDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HiveClient16IconCategory" Target="Ambari.SCOM.Resources.Images.HiveClient16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HiveClientDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.HiveClientDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HiveMetastore16IconCategory" Target="Ambari.SCOM.Resources.Images.HiveMetastore16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HiveMetastoreDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.HiveMetastoreDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HiveServer16IconCategory" Target="Ambari.SCOM.Resources.Images.HiveServer16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HiveServerDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.HiveServerDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HiveService16IconCategory" Target="Ambari.SCOM.Resources.Images.HiveService16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HiveServiceDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.HiveServiceDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.Cluster16IconCategory" Target="Ambari.SCOM.Resources.Images.Cluster16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.ClusterDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.ClusterDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.Host16IconCategory" Target="Ambari.SCOM.Resources.Images.Host16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HostDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.HostDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.Hosts16IconCategory" Target="Ambari.SCOM.Resources.Images.Hosts16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.HostsDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.HostsDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.JobTracker16IconCategory" Target="Ambari.SCOM.Resources.Images.JobTracker16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.JobTrackerDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.JobTrackerDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.MapReduce16IconCategory" Target="Ambari.SCOM.Resources.Images.MapReduce16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.MapReduceDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.MapReduceDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.NameNode16IconCategory" Target="Ambari.SCOM.Resources.Images.NameNode16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.NameNodeDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.NameNodeDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.OozieServer16IconCategory" Target="Ambari.SCOM.Resources.Images.OozieServer16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.OozieServerDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.OozieServerDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.OozieService16IconCategory" Target="Ambari.SCOM.Resources.Images.OozieService16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.OozieServiceDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.OozieServiceDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.Pig16IconCategory" Target="Ambari.SCOM.Resources.Images.Pig16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.PigDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.PigDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.PigService16IconCategory" Target="Ambari.SCOM.Resources.Images.PigService16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.PigServiceDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.PigServiceDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.Scoop16IconCategory" Target="Ambari.SCOM.Resources.Images.Scoop16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.ScoopDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.ScoopDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.ScoopService16IconCategory" Target="Ambari.SCOM.Resources.Images.ScoopService16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.ScoopServiceDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.ScoopServiceDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.SecNameNode16IconCategory" Target="Ambari.SCOM.Resources.Images.SecNameNode16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.SecNameNodeDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.SecNameNodeDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.Services16IconCategory" Target="Ambari.SCOM.Resources.Images.Services16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.ServicesDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.ServicesDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.TaskTracker16IconCategory" Target="Ambari.SCOM.Resources.Images.TaskTracker16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.TaskTrackerDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.TaskTrackerDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.TempletonService16IconCategory" Target="Ambari.SCOM.Resources.Images.TempletonService16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.TempletonServiceDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.TempletonServiceDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+    <Category ID="Ambari.SCOM.Resources.Images.TempletonServer16IconCategory" Target="Ambari.SCOM.Resources.Images.TempletonServer16Icon" Value="System!System.Internal.ManagementPack.Images.u16x16Icon" />
+    <Category ID="Ambari.SCOM.Resources.Images.TempletonServerDiagramIconCategory" Target="Ambari.SCOM.Resources.Images.TempletonServerDiagramIcon" Value="System!System.Internal.ManagementPack.Images.DiagramIcon" />
+  </Categories>
+
+  <Resources>
+    <Image ID="Ambari.SCOM.Resources.Images.DataNode16Icon" FileName="DataNode_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.DataNodeDiagramIcon" FileName="DataNode.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HDFS16Icon" FileName="hdfs_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HDFSDiagramIcon" FileName="hdfs.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HiveClient16Icon" FileName="HiveClient_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HiveClientDiagramIcon" FileName="HiveClient.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HiveMetastore16Icon" FileName="HiveMetastore_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HiveMetastoreDiagramIcon" FileName="HiveMetastore.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HiveServer16Icon" FileName="HiveServer_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HiveServerDiagramIcon" FileName="HiveServer.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HiveService16Icon" FileName="hiveservice_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HiveServiceDiagramIcon" FileName="hiveservice.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.Cluster16Icon" FileName="Cluster_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.ClusterDiagramIcon" FileName="Cluster.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.Host16Icon" FileName="Host_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HostDiagramIcon" FileName="Host.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.Hosts16Icon" FileName="hosts_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.HostsDiagramIcon" FileName="hosts.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.JobTracker16Icon" FileName="JobTracker_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.JobTrackerDiagramIcon" FileName="JobTracker.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.MapReduce16Icon" FileName="mapreduce_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.MapReduceDiagramIcon" FileName="mapreduce.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.NameNode16Icon" FileName="NameNode_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.NameNodeDiagramIcon" FileName="NameNode.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.OozieServer16Icon" FileName="OozieServer_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.OozieServerDiagramIcon" FileName="OozieServer.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.OozieService16Icon" FileName="OozieService_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.OozieServiceDiagramIcon" FileName="OozieService.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.Pig16Icon" FileName="Pig_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.PigDiagramIcon" FileName="Pig.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.PigService16Icon" FileName="PigService_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.PigServiceDiagramIcon" FileName="PigService.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.Scoop16Icon" FileName="Scoop_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.ScoopDiagramIcon" FileName="Scoop.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.ScoopService16Icon" FileName="ScoopService_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.ScoopServiceDiagramIcon" FileName="ScoopService.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.SecNameNode16Icon" FileName="SecNameNode_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.SecNameNodeDiagramIcon" FileName="SecNameNode.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.Services16Icon" FileName="Services_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.ServicesDiagramIcon" FileName="Services.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.TaskTracker16Icon" FileName="TaskTracker_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.TaskTrackerDiagramIcon" FileName="TaskTracker.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.TempletonService16Icon" FileName="TempletonService_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.TempletonServiceDiagramIcon" FileName="TempletonService.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.TempletonServer16Icon" FileName="TrmpletonServer_.png" Accessibility="Public" />
+    <Image ID="Ambari.SCOM.Resources.Images.TempletonServerDiagramIcon" FileName="TrmpletonServer.png" Accessibility="Public" />
+  </Resources>
+  
+</ManagementPackFragment>

+ 29 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/ManagementPack.mpx

@@ -0,0 +1,29 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Monitoring">
+          <Name>Ambari SCOM Monitoring</Name>
+          <Description>This management pack discovers and monitors Hadoop clusters.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 102 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/ConditionDetections/PropertyBagMultiplePerformanceDataMapper.mpx

@@ -0,0 +1,102 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <SchemaTypes>
+      <SchemaType ID="Ambari.SCOM.Schema.PropertyBagMultiplePerformanceDataMapper" Accessibility="Internal">
+        <xsd:complexType name="MappingsType">
+          <xsd:sequence>
+            <xsd:element name="Mapping" minOccurs="0" maxOccurs="unbounded">
+              <xsd:complexType>
+                <xsd:sequence>
+                  <xsd:element name="PropertyName" type="xsd:string" />
+                  <xsd:element name="ObjectName" type="xsd:string" />
+                  <xsd:element name="CounterName" type="xsd:string" />
+                  <xsd:element name="InstanceName" type="xsd:string" />
+                </xsd:sequence>
+              </xsd:complexType>
+            </xsd:element>
+          </xsd:sequence>
+        </xsd:complexType>
+      </SchemaType>
+    </SchemaTypes>
+    
+    <ModuleTypes>
+      <ConditionDetectionModuleType ID="Ambari.SCOM.Module.PropertyBagMultiplePerformanceDataMapper"
+                                    Accessibility="Internal" Batching="false" Stateful="false" PassThrough="false">
+        <Configuration>
+          <IncludeSchemaTypes>
+            <SchemaType>Ambari.SCOM.Schema.PropertyBagMultiplePerformanceDataMapper</SchemaType>
+          </IncludeSchemaTypes>
+          <xsd:element name="Mappings" type="MappingsType" />
+        </Configuration>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <ConditionDetection ID="Internal" TypeID="Ambari.SCOM.Module.PropertyBagMultiplePerformanceDataMapperInternal">
+                <Mappings>$Config/Mappings$</Mappings>
+                <RuleId>$MPElement$</RuleId>
+                <ManagedEntityId>$Target/Id$</ManagedEntityId>
+              </ConditionDetection>
+            </MemberModules>
+            <Composition>
+              <Node ID="Internal" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>SC!Microsoft.SystemCenter.Performance.LinkedData</OutputType>
+        <InputTypes>
+          <InputType>System!System.PropertyBagData</InputType>
+        </InputTypes>
+      </ConditionDetectionModuleType>
+
+      <ConditionDetectionModuleType ID="Ambari.SCOM.Module.PropertyBagMultiplePerformanceDataMapperInternal"
+                                    Accessibility="Internal" Batching="false" Stateful="false" PassThrough="false">
+        <Configuration>
+          <IncludeSchemaTypes>
+            <SchemaType>Ambari.SCOM.Schema.PropertyBagMultiplePerformanceDataMapper</SchemaType>
+          </IncludeSchemaTypes>
+          <xsd:element name="Mappings" type="MappingsType" />
+          <xsd:element name="RuleId" type="xsd:string" />
+          <xsd:element name="ManagedEntityId" type="xsd:string" />
+        </Configuration>
+        <ModuleImplementation Isolation="Any">
+          <Managed>
+            <Assembly>Ambari.SCOM.Assembly.Modules</Assembly>
+            <Type>Ambari.SCOM.Modules.PropertyBagMultiplePerformanceDataMapper</Type>
+          </Managed>
+        </ModuleImplementation>
+        <OutputType>SC!Microsoft.SystemCenter.Performance.LinkedData</OutputType>
+        <InputTypes>
+          <!-- For some reason on Agent machine data item coming from PowershellPropertyBagProbe is not typed. -->
+          <InputType>System!System.BaseData</InputType>
+        </InputTypes>
+      </ConditionDetectionModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.PropertyBagMultiplePerformanceDataMapper">
+          <Name>Hadoop Property Bag Performance Data Mapper</Name>
+          <Description>Converts property bag to Linked Performance Data.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 88 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/ConditionDetections/PropertyBagPerformanceDataMapper.mpx

@@ -0,0 +1,88 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <ConditionDetectionModuleType ID="Ambari.SCOM.Module.PropertyBagPerformanceDataMapper"
+                                    Accessibility="Internal" PassThrough="false" Stateful="false">
+        <Configuration>
+          <xsd:element name="PropertyName" type="xsd:string" />
+
+          <xsd:element name="ObjectName" type="xsd:string" />
+          <xsd:element name="CounterName" type="xsd:string" />
+          <xsd:element name="InstanceName" type="xsd:string" />
+        </Configuration>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <ConditionDetection ID="ExistenceCheck" TypeID="System!System.ExpressionFilter">
+                <Expression>
+                  <And>
+                    <Expression>
+                      <Exists>
+                        <ValueExpression>
+                          <XPathQuery Type="String">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                        </ValueExpression>
+                      </Exists>
+                    </Expression>
+                    <Expression>
+                      <SimpleExpression>
+                        <ValueExpression>
+                          <XPathQuery Type="String">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                        </ValueExpression>
+                        <Operator>NotEqual</Operator>
+                        <ValueExpression>
+                          <Value Type="String" />
+                        </ValueExpression>
+                      </SimpleExpression>
+                    </Expression>
+                  </And>
+                </Expression>
+              </ConditionDetection>
+              <ConditionDetection ID="Mapper" TypeID="Perf!System.Performance.DataGenericMapper">
+                <ObjectName>$Config/ObjectName$</ObjectName>
+                <CounterName>$Config/CounterName$</CounterName>
+                <InstanceName>$Config/InstanceName$</InstanceName>
+                <Value>$Data/Property[@Name='$Config/PropertyName$']$</Value>
+              </ConditionDetection>
+            </MemberModules>
+            <Composition>
+              <Node ID="Mapper">
+                <Node ID="ExistenceCheck" />
+              </Node>
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>Perf!System.Performance.Data</OutputType>
+        <InputTypes>
+          <InputType>System!System.PropertyBagData</InputType>
+        </InputTypes>
+      </ConditionDetectionModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.PropertyBagPerformanceDataMapper">
+          <Name>Hadoop Property Bag Performance Data Mapper</Name>
+          <Description>This module converts Property Bag value into performance data point.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 87 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/AmbariSeedDiscoveryDataSource.mpx

@@ -0,0 +1,87 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.AmbariSeedDiscoveryDataSource" Accessibility="Public">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element name="SyncTime" type="xsd:string" />
+          <xsd:element name="TemplateName" type="xsd:string" />
+          <xsd:element name="SeedClassId" type="xsd:string" />
+          <xsd:element name="ComputerName" type="xsd:string" />
+          <xsd:element name="AmbariUri" type="xsd:string" />
+        </Configuration>
+        <ModuleImplementation Isolation="Any">
+          <Composite>
+            <MemberModules>
+              <DataSource ID="Scheduler" TypeID="System!System.Discovery.Scheduler">
+                <Scheduler>
+                  <SimpleReccuringSchedule>
+                    <Interval Unit="Seconds">14400</Interval>
+                    <SyncTime>$Config/SyncTime$</SyncTime>
+                  </SimpleReccuringSchedule>
+                  <ExcludeDates />
+                </Scheduler>
+              </DataSource>
+              <ConditionDetection ID="Mapper" TypeID="System!System.Discovery.ClassSnapshotDataMapper">
+                <ClassId>$Config/SeedClassId$</ClassId>
+                <InstanceSettings>
+                  <Settings>
+                    <Setting>
+                      <Name>$MPElement[Name="System!System.Entity"]/DisplayName$</Name>
+                      <Value>Hadoop Ambari Service Seed ($Config/TemplateName$)</Value>
+                    </Setting>
+                    <Setting>
+                      <Name>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Name>
+                      <Value>$Config/ComputerName$</Value>
+                    </Setting>
+                    <Setting>
+                      <Name>$MPElement[Name="Ambari.SCOM.AmbariSeed"]/TemplateName$</Name>
+                      <Value>$Config/TemplateName$</Value>
+                    </Setting>
+                    <Setting>
+                      <Name>$MPElement[Name="Ambari.SCOM.AmbariSeed"]/AmbariUri$</Name>
+                      <Value>$Config/AmbariUri$</Value>
+                    </Setting>
+                  </Settings>
+                </InstanceSettings>
+              </ConditionDetection>
+            </MemberModules>
+            <Composition>
+              <Node ID="Mapper">
+                <Node ID="Scheduler" />
+              </Node>
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.Discovery.Data</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.AmbariSeedDiscoveryDataSource">
+          <Name>Hadoop Ambari Service Seed Discovery Data Provider</Name>
+          <Description>This module discovers Hadoop Ambari Service Seed.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 102 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/ClusterServicesDiscoveryDataSource.mpx

@@ -0,0 +1,102 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.ClusterServicesDiscoveryDataSource" Accessibility="Public"
+                            RunAs="Ambari.SCOM.Profile.Workflow">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:integer" />
+          <xsd:element name="TemplateName" type="xsd:string" />
+          <xsd:element name="ClusterName" type="xsd:string" />
+          <xsd:element name="ClusterAmbariUri" type="xsd:string" />
+          <xsd:element name="WatcherNodesList" type="xsd:string" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <ModuleImplementation Isolation="Any">
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.PowerShellDiscoveryDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+                <WorkflowName>ClusterServicesDiscovery</WorkflowName>
+                <Script>$IncludeFileContent/Modules/DataSources/Discovery/Scripts/ClusterServicesDiscovery.ps1$</Script>
+                <Parameters>
+                  <Parameter>
+                    <Name>TemplateName</Name>
+                    <Value>$Config/TemplateName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>ClusterName</Name>
+                    <Value>$Config/ClusterName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>ClusterAmbariUri</Name>
+                    <Value>$Config/ClusterAmbariUri$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>WatcherNodesList</Name>
+                    <Value>$Config/WatcherNodesList$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Username</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/UserName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Password</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/Password$</Value>
+                  </Parameter>
+                </Parameters>
+              </DataSource>
+            </MemberModules>
+            <Composition>
+              <Node ID="DS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.Discovery.Data</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.ClusterServicesDiscoveryDataSource">
+          <Name>Hadoop Cluster Services Discovery Data Provider</Name>
+          <Description>This module discovers Hadoop Cluster Services of specific Hadoop Cluster.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.ClusterServicesDiscoveryDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.ClusterServicesDiscoveryDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.ClusterServicesDiscoveryDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 117 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/ClustersDiscoveryDataSource.mpx

@@ -0,0 +1,117 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.ClustersDiscoveryDataSource" Accessibility="Public"
+                            RunAs="Ambari.SCOM.Profile.Workflow">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:integer" />
+          <xsd:element name="TemplateName" type="xsd:string" />
+          <xsd:element name="SeedComputerName" type="xsd:string" />
+          <xsd:element name="ClusterSeedClassId" type="xsd:string" />
+          <xsd:element name="AmbariUri" type="xsd:string" />
+          <xsd:element name="ClustersQueryUriSegment" type="xsd:string" />
+          <xsd:element name="WatcherNodesList" type="xsd:string" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="ClustersQueryUriSegment" Selector="$Config/ClustersQueryUriSegment$" ParameterType="string" />
+        </OverrideableParameters>
+        <ModuleImplementation Isolation="Any">
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.PowerShellDiscoveryDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+                <WorkflowName>ClustersDiscovery</WorkflowName>
+                <Script>$IncludeFileContent/Modules/DataSources/Discovery/Scripts/ClustersDiscovery.ps1$</Script>
+                <Parameters>
+                  <Parameter>
+                    <Name>TemplateName</Name>
+                    <Value>$Config/TemplateName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>SeedComputerName</Name>
+                    <Value>$Config/SeedComputerName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>ClusterSeedClassId</Name>
+                    <Value>$Config/ClusterSeedClassId$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>AmbariUri</Name>
+                    <Value>$Config/AmbariUri$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>ClustersQueryUriSegment</Name>
+                    <Value>$Config/ClustersQueryUriSegment$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>WatcherNodesList</Name>
+                    <Value>$Config/WatcherNodesList$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Username</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/UserName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Password</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/Password$</Value>
+                  </Parameter>
+                </Parameters>
+              </DataSource>
+            </MemberModules>
+            <Composition>
+              <Node ID="DS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.Discovery.Data</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.ClustersDiscoveryDataSource">
+          <Name>Hadoop Clusters Discovery Data Provider</Name>
+          <Description>This module discovers Hadoop Clusters managed by specified Hadoop Ambari Service.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.ClustersDiscoveryDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.ClustersDiscoveryDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.ClustersDiscoveryDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.ClustersDiscoveryDataSource" SubElementID="ClustersQueryUriSegment">
+          <Name>Clusters Query URI Segment</Name>
+          <Description>URI segment to query list of clusters managed by Ambari instance.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 107 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/HostComponentsDiscoveryDataSource.mpx

@@ -0,0 +1,107 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.HostComponentsDiscoveryDataSource" Accessibility="Internal"
+                            RunAs="Ambari.SCOM.Profile.Workflow">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:integer" />
+          <xsd:element name="TemplateName" type="xsd:string" />
+          <xsd:element name="ClusterName" type="xsd:string" />
+          <xsd:element name="HostName" type="xsd:string" />
+          <xsd:element name="HostIpAddress" type="xsd:string" />
+          <xsd:element name="HostAmbariUri" type="xsd:string" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <ModuleImplementation Isolation="Any">
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.PowerShellDiscoveryDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+                <WorkflowName>HostComponentsDiscovery</WorkflowName>
+                <Script>$IncludeFileContent/Modules/DataSources/Discovery/Scripts/HostComponentsDiscovery.ps1$</Script>
+                <Parameters>
+                  <Parameter>
+                    <Name>TemplateName</Name>
+                    <Value>$Config/TemplateName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>ClusterName</Name>
+                    <Value>$Config/ClusterName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>HostName</Name>
+                    <Value>$Config/HostName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>HostIpAddress</Name>
+                    <Value>$Config/HostIpAddress$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>HostAmbariUri</Name>
+                    <Value>$Config/HostAmbariUri$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Username</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/UserName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Password</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/Password$</Value>
+                  </Parameter>
+                </Parameters>
+              </DataSource>
+            </MemberModules>
+            <Composition>
+              <Node ID="DS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.Discovery.Data</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentsDiscoveryDataSource">
+          <Name>Hadoop Host Components Discovery Data Provider</Name>
+          <Description>This module discovers Hadoop Host Components.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentsDiscoveryDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentsDiscoveryDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentsDiscoveryDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 102 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/HostsDiscoveryDataSource.mpx

@@ -0,0 +1,102 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.HostsDiscoveryDataSource" Accessibility="Public"
+                            RunAs="Ambari.SCOM.Profile.Workflow">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:integer" />
+          <xsd:element name="TemplateName" type="xsd:string" />
+          <xsd:element name="ClusterName" type="xsd:string" />
+          <xsd:element name="ClusterAmbariUri" type="xsd:string" />
+          <xsd:element name="WatcherNodesList" type="xsd:string" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <ModuleImplementation Isolation="Any">
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.PowerShellDiscoveryDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+                <WorkflowName>HostsDiscovery</WorkflowName>
+                <Script>$IncludeFileContent/Modules/DataSources/Discovery/Scripts/HostsDiscovery.ps1$</Script>
+                <Parameters>
+                  <Parameter>
+                    <Name>TemplateName</Name>
+                    <Value>$Config/TemplateName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>ClusterName</Name>
+                    <Value>$Config/ClusterName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>ClusterAmbariUri</Name>
+                    <Value>$Config/ClusterAmbariUri$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>WatcherNodesList</Name>
+                    <Value>$Config/WatcherNodesList$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Username</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/UserName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Password</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/Password$</Value>
+                  </Parameter>
+                </Parameters>
+              </DataSource>
+            </MemberModules>
+            <Composition>
+              <Node ID="DS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.Discovery.Data</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostsDiscoveryDataSource">
+          <Name>Hadoop Hosts Discovery Data Provider</Name>
+          <Description>This module discovers Hadoop Hosts of specific Hadoop Cluster.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostsDiscoveryDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostsDiscoveryDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostsDiscoveryDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 85 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/PowerShellDiscoveryDataSource.mpx

@@ -0,0 +1,85 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.PowerShellDiscoveryDataSource" Accessibility="Internal">
+        <Configuration>
+          <IncludeSchemaTypes>
+            <SchemaType>Windows!Microsoft.Windows.PowerShellSchema</SchemaType>
+          </IncludeSchemaTypes>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:integer" />
+          
+          <xsd:element name="WorkflowName" type="xsd:string" />
+          <xsd:element name="Script" type="xsd:string" />
+          <xsd:element name="Parameters" type="NamedParametersType" />
+        </Configuration>
+        <ModuleImplementation Isolation="Any">
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <ScriptName>$Config/WorkflowName$.ps1</ScriptName>
+                <ScriptBody>
+                  $Config/Script$
+                  $IncludeFileContent/Shared Scripts/Logging.ps1$
+                  $IncludeFileContent/Shared Scripts/JsonParser.ps1$
+                  $IncludeFileContent/Shared Scripts/RestApi.ps1$
+                  $IncludeFileContent/Shared Scripts/HealthServicesManagement.ps1$
+                  $IncludeFileContent/Shared Scripts/DiscoveryHelpers.ps1$
+
+                  $ScriptApi = New-Object -ComObject "MOM.ScriptAPI"
+                  
+                  try {
+                    if (!$Username) {
+                      CreateEmptyDiscoveryData
+                      return
+                    }
+                    Main
+                  } catch {
+                    LogMessage '$Config/WorkflowName$' 1 $_
+                    CreateEmptyDiscoveryData
+                  }
+                </ScriptBody>
+                <Parameters>$Config/Parameters$</Parameters>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+              </DataSource>
+            </MemberModules>
+            <Composition>
+              <Node ID="DS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.Discovery.Data</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.PowerShellDiscoveryDataSource">
+          <Name>Hadoop PowerShell Script Discovery Data Provider</Name>
+          <Description>This module executes PowerShell scripts to discover different Hadoop entities.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 80 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/Scripts/ClusterServicesDiscovery.ps1

@@ -0,0 +1,80 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+Param ($TemplateName, $ClusterName, $ClusterAmbariUri, $WatcherNodesList = "", $Username, $Password)
+
+function DiscoverServices($discoveryData, $healthServices) {
+    $parent = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.ClusterSoftwareProjection"]$")
+    $parent.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/TemplateName$", $TemplateName)
+    $parent.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/ClusterName$", $ClusterName)
+
+    $clusterServices = InvokeRestAPI (JoinUri "$ClusterAmbariUri" "services") $Username $Password
+
+    foreach ($clusterService in $clusterServices.items) {
+        $serviceClassId = GetServiceClassId $clusterService.ServiceInfo.service_name
+        if ($serviceClassId -eq $null) { continue }
+
+        $serviceName = FormatClusterServiceName $clusterService.ServiceInfo.service_name
+
+        $servicePrivateEntity = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.ClusterService.Private"]$")
+        $servicePrivateEntity.AddProperty("$MPElement[Name='Ambari.SCOM.AmbariManagedEntity']/AmbariUri$", $clusterService.href)
+        $servicePrivateEntity.AddProperty("$MPElement[Name="Ambari.SCOM.ClusterService.Private"]/TemplateName$", $TemplateName)
+        $servicePrivateEntity.AddProperty("$MPElement[Name="Ambari.SCOM.ClusterService.Private"]/ClusterName$", $ClusterName)
+        $servicePrivateEntity.AddProperty("$MPElement[Name='Ambari.SCOM.ClusterService.Private']/ServiceName$", $clusterService.ServiceInfo.service_name)
+        $servicePrivateEntity.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", (GetPrivateEntityDisplayName $serviceName))
+        $discoveryData.AddInstance($servicePrivateEntity)
+
+        AddManagementRelationship $discoveryData $healthServices (MergeStrings $ClusterName $clusterService.name) $servicePrivateEntity
+
+        $serviceEntity = $discoveryData.CreateClassInstance($serviceClassId)
+        $serviceEntity.AddProperty("$MPElement[Name="Ambari.SCOM.ClusterService.Private"]/TemplateName$", $TemplateName)
+        $serviceEntity.AddProperty("$MPElement[Name="Ambari.SCOM.ClusterService.Private"]/ClusterName$", $ClusterName)
+        $serviceEntity.AddProperty("$MPElement[Name='Ambari.SCOM.ClusterService.Private']/ServiceName$", $clusterService.ServiceInfo.service_name)
+        $serviceEntity.AddProperty("$MPElement[Name="Ambari.SCOM.ClusterService"]/ClusterName$", $ClusterName)
+        $serviceEntity.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $serviceName)
+        $discoveryData.AddInstance($serviceEntity)
+
+        $parentRelationship = $discoveryData.CreateRelationshipInstance("$MPElement[Name="Ambari.SCOM.ClusterSoftwareProjectionContainsClusterService"]$")
+        $parentRelationship.Source = $parent
+        $parentRelationship.Target = $serviceEntity
+        $discoveryData.AddInstance($parentRelationship)
+    }
+}
+
+function GetServiceClassId($monitoringUri) {
+    switch ($monitoringUri -replace ".*/", "") {
+        'hdfs' { '$MPElement[Name="Ambari.SCOM.ClusterService.Hdfs"]$' }
+        'mapreduce' { '$MPElement[Name="Ambari.SCOM.ClusterService.MapReduce"]$' }
+        'hive' { '$MPElement[Name="Ambari.SCOM.ClusterService.Hive"]$' }
+        { 'templeton', 'webhcat' -contains $_ } { '$MPElement[Name="Ambari.SCOM.ClusterService.Templeton"]$' }
+        'oozie' { '$MPElement[Name="Ambari.SCOM.ClusterService.Oozie"]$' }
+        'pig' { '$MPElement[Name="Ambari.SCOM.ClusterService.Pig"]$' }
+        'sqoop' { '$MPElement[Name="Ambari.SCOM.ClusterService.Sqoop"]$' }
+        default: { $null }
+    }
+}
+
+function Main() {
+    $discoveryData = $ScriptApi.CreateDiscoveryData(0, "$MPElement$", "$Target/Id$")
+
+    $healthServices = CreateHealthServicesFromWatcherNodesList $discoveryData $WatcherNodesList
+    if ($healthServices.Count -eq 0) { return $discoveryData }
+
+    DiscoverServices $discoveryData $healthServices
+
+    $discoveryData
+}

+ 92 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/Scripts/ClustersDiscovery.ps1

@@ -0,0 +1,92 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+Param ($TemplateName, $SeedComputerName, $ClusterSeedClassId, $AmbariUri, $ClustersQueryUriSegment, $WatcherNodesList = "", $Username, $Password)
+
+function CreateClusterEntity($discoveryData, $cluster, $healthServices) {
+    $clusterName = $cluster.Clusters.cluster_name
+
+    $clusterSeedEntity = $discoveryData.CreateClassInstance("$ClusterSeedClassId")
+    $clusterSeedEntity.AddProperty("$MPElement[Name='Ambari.SCOM.AmbariManagedEntity']/AmbariUri$", $cluster.href)
+    $clusterSeedEntity.AddProperty("$MPElement[Name="Ambari.SCOM.ClusterSeed"]/TemplateName$", $TemplateName)
+    $clusterSeedEntity.AddProperty("$MPElement[Name="Ambari.SCOM.ClusterSeed"]/ClusterName$", $clusterName)
+    $clusterSeedEntity.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Hadoop Cluster Seed ($clusterName)")
+    $discoveryData.AddInstance($clusterSeedEntity)
+
+    AddManagementRelationship $discoveryData $healthServices $cluster.name $clusterSeedEntity
+
+    $clusterPrivateEntity = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.Cluster.Private"]$")
+    $clusterPrivateEntity.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/TemplateName$", $TemplateName)
+    $clusterPrivateEntity.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/ClusterName$", $clusterName)
+    $clusterPrivateEntity.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", (GetPrivateEntityDisplayName $clusterName))
+    $discoveryData.AddInstance($clusterPrivateEntity)
+
+    $clusterEntity = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.Cluster"]$")
+    $clusterEntity.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/TemplateName$", $TemplateName)
+    $clusterEntity.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/ClusterName$", $clusterName)
+    $clusterEntity.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $clusterName)
+    $discoveryData.AddInstance($clusterEntity)
+
+    $nodesGroup = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.ClusterHardwareProjection"]$")
+    $nodesGroup.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/TemplateName$", $TemplateName)
+    $nodesGroup.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/ClusterName$", $clusterName)
+    $nodesGroup.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Hosts")
+    $discoveryData.AddInstance($nodesGroup)
+
+    $servicesGroup = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.ClusterSoftwareProjection"]$")
+    $servicesGroup.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/TemplateName$", $TemplateName)
+    $servicesGroup.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/ClusterName$", $clusterName)
+    $servicesGroup.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Services")
+    $discoveryData.AddInstance($servicesGroup)
+
+    $clusterEntity
+}
+
+function DiscoverClusters($discoveryData, $healthServices) {
+    $parent = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.AmbariSeed"]$")
+    $parent.AddProperty("$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$", $SeedComputerName)
+    $parent.AddProperty("$MPElement[Name="Ambari.SCOM.AmbariSeed"]/TemplateName$", $TemplateName)
+
+    $clustersResult = InvokeRestAPI (JoinUri "$AmbariUri" "$ClustersQueryUriSegment") $Username $Password
+    foreach ($cluster in $clustersResult.items) {
+        $clusterEntity = CreateClusterEntity $discoveryData $cluster $healthServices
+
+        $parentRelationship = $discoveryData.CreateRelationshipInstance("$MPElement[Name="Ambari.SCOM.AmbariSeedContainsCluster"]$")
+        $parentRelationship.Source = $parent
+        $parentRelationship.Target = $clusterEntity
+        $discoveryData.AddInstance($parentRelationship)
+    }
+}
+
+function Main() {
+    $discoveryData = $ScriptApi.CreateDiscoveryData(0, "$MPElement$", "$Target/Id$")
+
+    $healthServices = @()
+    foreach ($watcherNodeName in $WatcherNodesList.Split(';', [StringSplitOptions]::RemoveEmptyEntries)) {
+        $healthServices += CreateHealthService $discoveryData $watcherNodeName
+
+        $watcherNodeEntity = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.AmbariWatcherNode"]$")
+        $watcherNodeEntity.AddProperty("$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$", $watcherNodeName)
+        $watcherNodeEntity.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Hadoop Watcher Node")
+        $discoveryData.AddInstance($watcherNodeEntity)
+    }
+    if ($healthServices.Count -eq 0) { return $discoveryData }
+
+    DiscoverClusters $discoveryData $healthServices
+
+    $discoveryData
+}

+ 134 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/Scripts/HostComponentsDiscovery.ps1

@@ -0,0 +1,134 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+Param ($TemplateName, $ClusterName, $HostName, $HostIpAddress, $HostAmbariUri, $Username, $PAssword)
+
+function Main() {
+    $discoveryData = $ScriptApi.CreateDiscoveryData(0, '$MPElement$', '$Target/Id$')
+
+    $componentsResult = InvokeRestAPI (JoinUri "$HostAmbariUri" 'host_components') $Username $Password
+
+    $baseMonitoringUri = $HostAmbariUri -replace '(?i)/hosts/.*', ''
+    $parentServices = @{}
+
+    foreach ($component in $componentsResult.items) {
+        $componentClassId = GetComponentClassId $component.HostRoles.component_name
+        if ($componentClassId -eq $null) { continue }
+
+        $componentName = $component.HostRoles.component_name
+
+        $componentEntity = $discoveryData.CreateClassInstance($componentClassId)
+        $componentEntity.AddProperty('$MPElement[Name="Ambari.SCOM.Host.Private"]/TemplateName$', $TemplateName)
+        $componentEntity.AddProperty('$MPElement[Name="Ambari.SCOM.Host.Private"]/ClusterName$', $ClusterName)
+        $componentEntity.AddProperty('$MPElement[Name="Ambari.SCOM.Host.Private"]/HostName$', $HostName)
+        $componentEntity.AddProperty('$MPElement[Name="Ambari.SCOM.Host"]/IpAddress$', $HostIpAddress)
+        $componentEntity.AddProperty('$MPElement[Name="Ambari.SCOM.AmbariManagedEntity"]/AmbariUri$', $component.href)
+        $componentEntity.AddProperty('$MPElement[Name="Ambari.SCOM.HostComponent"]/ClusterName$', $ClusterName)
+        $componentEntity.AddProperty('$MPElement[Name="Ambari.SCOM.HostComponent"]/ComponentName$', $componentName)
+        $componentEntity.AddProperty('$MPElement[Name="System!System.Entity"]/DisplayName$', (FormatHostComponentName $componentName))
+        $discoveryData.AddInstance($componentEntity)
+
+        $parentServiceName = GetParentServiceName $componentName
+
+        if (!$parentServiceName) { continue }
+
+        if (!$parentServices.ContainsKey($parentServiceName)) {
+            $parentServices[$parentServiceName] = CreateParentService $discoveryData $parentServiceName
+        }
+
+        $parentServiceRelationship = $discoveryData.CreateRelationshipInstance((GetParentServiceRelationshipId $componentName))
+        $parentServiceRelationship.Source = $parentServices[$parentServiceName]
+        $parentServiceRelationship.Target = $componentEntity
+        $discoveryData.AddInstance($parentServiceRelationship)
+    }
+
+    $discoveryData
+}
+
+function GetComponentClassId($componentName) {
+    switch ($componentName) {
+        'namenode' { '$MPElement[Name="Ambari.SCOM.HostComponent.NameNode"]$' }
+        'secondary_namenode' { '$MPElement[Name="Ambari.SCOM.HostComponent.SecondaryNameNode"]$' }
+        'jobtracker' { '$MPElement[Name="Ambari.SCOM.HostComponent.JobTracker"]$' }
+        'tasktracker' { '$MPElement[Name="Ambari.SCOM.HostComponent.TaskTracker"]$' }
+        'hive_server' { '$MPElement[Name="Ambari.SCOM.HostComponent.HiveServer"]$' }
+        'hive_metastore' { '$MPElement[Name="Ambari.SCOM.HostComponent.HiveMetastore"]$' }
+        'hive_client' { '$MPElement[Name="Ambari.SCOM.HostComponent.HiveClient"]$' }
+        { 'templeton', 'webhcat_server' -contains $_ } { '$MPElement[Name="Ambari.SCOM.HostComponent.TempletonServer"]$' }
+        'oozie_server' { '$MPElement[Name="Ambari.SCOM.HostComponent.OozieServer"]$' }
+        'pig' { '$MPElement[Name="Ambari.SCOM.HostComponent.Pig"]$' }
+        'sqoop' { '$MPElement[Name="Ambari.SCOM.HostComponent.Sqoop"]$' }
+        default { $null }
+    }
+}
+
+function GetParentServiceName($componentName) {
+    switch ($componentName) {
+        { 'namenode', 'secondary_namenode', 'datanode' -contains $_ } { 'HDFS' }
+        { 'jobtracker', 'tasktracker' -contains $_ } { 'MAPREDUCE' }
+        { 'hive_server', 'hive_metastore', 'hive_client' -contains $_ } { 'HIVE' }
+        'templeton' { 'TEMPLETON' }
+        'webhcat_server' { 'WEBHCAT' }
+        'oozie_server' { 'OOZIE' }
+        'pig' { 'PIG' }
+        'sqoop' { 'SQOOP' }
+        default { $null }
+    }
+}
+
+function CreateParentService($discoveryData, $serviceName) {
+    $serviceClassId = switch ($serviceName) {
+        'hdfs' { '$MPElement[Name="Ambari.SCOM.ClusterService.Hdfs"]$' }
+        'mapreduce' { '$MPElement[Name="Ambari.SCOM.ClusterService.MapReduce"]$' }
+        'hive' { '$MPElement[Name="Ambari.SCOM.ClusterService.Hive"]$' }
+        { 'templeton', 'webhcat' -contains $_ } { '$MPElement[Name="Ambari.SCOM.ClusterService.Templeton"]$' }
+        'oozie' { '$MPElement[Name="Ambari.SCOM.ClusterService.Oozie"]$' }
+        'pig' { '$MPElement[Name="Ambari.SCOM.ClusterService.Pig"]$' }
+        'sqoop' { '$MPElement[Name="Ambari.SCOM.ClusterService.Sqoop"]$' }
+    }
+
+    $serviceDisplayName = FormatClusterServiceName $serviceName
+
+    $privateEntity = $discoveryData.CreateClassInstance('$MPElement[Name="Ambari.SCOM.ClusterService.Private"]$')
+    $privateEntity.AddProperty('$MPElement[Name="Ambari.SCOM.ClusterService.Private"]/TemplateName$', $TemplateName)
+    $privateEntity.AddProperty('$MPElement[Name="Ambari.SCOM.ClusterService.Private"]/ClusterName$', $ClusterName)
+    $privateEntity.AddProperty('$MPElement[Name="Ambari.SCOM.ClusterService.Private"]/ServiceName$', $serviceName)
+    $privateEntity.AddProperty('$MPElement[Name="System!System.Entity"]/DisplayName$', (GetPrivateEntityDisplayName $serviceDisplayName))
+    $discoveryData.AddInstance($privateEntity)
+
+    $entity = $discoveryData.CreateClassInstance("$serviceClassId")
+    $entity.AddProperty('$MPElement[Name="Ambari.SCOM.ClusterService.Private"]/TemplateName$', $TemplateName)
+    $entity.AddProperty('$MPElement[Name="Ambari.SCOM.ClusterService.Private"]/ClusterName$', $ClusterName)
+    $entity.AddProperty('$MPElement[Name="Ambari.SCOM.ClusterService.Private"]/ServiceName$', $serviceName)
+    $entity.AddProperty('$MPElement[Name="System!System.Entity"]/DisplayName$', $serviceDisplayName)
+    $discoveryData.AddInstance($entity)
+
+    $entity
+}
+
+function GetParentServiceRelationshipId($componentName) {
+    switch ($componentName) {
+        'namenode' { '$MPElement[Name="Ambari.SCOM.HdfsServiceContainsNameNodeComponent"]$' }
+        'secondary_namenode' { '$MPElement[Name="Ambari.SCOM.HdfsServiceContainsSecondaryNameNodeComponent"]$' }
+        'jobtracker' { '$MPElement[Name="Ambari.SCOM.MapReduceServiceContainsJobTrackerComponent"]$' }
+        'hive_server' { '$MPElement[Name="Ambari.SCOM.HiveServiceContainsHiveServerComponent"]$' }
+        'hive_metastore' { '$MPElement[Name="Ambari.SCOM.HiveServiceContainsHiveMetastoreComponent"]$' }
+        {'templeton', 'webhcat_server' -contains $_ } { '$MPElement[Name="Ambari.SCOM.TempletonServiceContainsTempletonServerComponent"]$' }
+        'oozie_server' { '$MPElement[Name="Ambari.SCOM.OozieServiceContainsOozieServerComponent"]$' }
+        default { '$MPElement[Name="Ambari.SCOM.ClusterServiceContainsHostComponent"]$' }
+    }
+}

+ 64 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Discovery/Scripts/HostsDiscovery.ps1

@@ -0,0 +1,64 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+Param ($TemplateName, $ClusterName, $ClusterAmbariUri, $WatcherNodesList = "", $Username, $Password)
+
+function DiscoverHosts($discoveryData, $healthServices) {
+    $parent = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.ClusterHardwareProjection"]$")
+    $parent.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/TemplateName$", $TemplateName)
+    $parent.AddProperty("$MPElement[Name="Ambari.SCOM.Cluster.Private"]/ClusterName$", $ClusterName)
+
+    $nodesResult = InvokeRestAPI (JoinUri "$ClusterAmbariUri" "hosts") $Username $Password
+    foreach ($node in $nodesResult.items) {
+        # TODO: Get IP addresses with single request?
+        $nodeResult = InvokeRestAPI $node.href $Username $Password
+
+        $nodePrivateEntity = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.Host.Private"]$")
+        $nodePrivateEntity.AddProperty("$MPElement[Name='Ambari.SCOM.AmbariManagedEntity']/AmbariUri$", $node.href)
+        $nodePrivateEntity.AddProperty("$MPElement[Name="Ambari.SCOM.Host.Private"]/TemplateName$", $TemplateName)
+        $nodePrivateEntity.AddProperty("$MPElement[Name="Ambari.SCOM.Host.Private"]/ClusterName$", $ClusterName)
+        $nodePrivateEntity.AddProperty("$MPElement[Name='Ambari.SCOM.Host.Private']/HostName$", $node.Hosts.host_name)
+        $nodePrivateEntity.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", (GetPrivateEntityDisplayName $node.Hosts.host_name))
+        $discoveryData.AddInstance($nodePrivateEntity)
+
+        AddManagementRelationship $discoveryData $healthServices (MergeStrings $ClusterName $node.Hosts.host_name) $nodePrivateEntity
+
+        $nodeEntity = $discoveryData.CreateClassInstance("$MPElement[Name="Ambari.SCOM.Host"]$")
+        $nodeEntity.AddProperty("$MPElement[Name="Ambari.SCOM.Host.Private"]/TemplateName$", $TemplateName)
+        $nodeEntity.AddProperty("$MPElement[Name="Ambari.SCOM.Host.Private"]/ClusterName$", $ClusterName)
+        $nodeEntity.AddProperty("$MPElement[Name='Ambari.SCOM.Host.Private']/HostName$", $node.Hosts.host_name)
+        $nodeEntity.AddProperty("$MPElement[Name='Ambari.SCOM.Host']/IpAddress$", $nodeResult.Hosts.ip)
+        $nodeEntity.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $node.Hosts.host_name)
+        $discoveryData.AddInstance($nodeEntity)
+
+        $parentRelationship = $discoveryData.CreateRelationshipInstance("$MPElement[Name="Ambari.SCOM.ClusterHardwareProjectionContainsHost"]$")
+        $parentRelationship.Source = $parent
+        $parentRelationship.Target = $nodeEntity
+        $discoveryData.AddInstance($parentRelationship)
+    }
+}
+
+function Main() {
+    $discoveryData = $ScriptApi.CreateDiscoveryData(0, "$MPElement$", "$Target/Id$")
+
+    $healthServices = CreateHealthServicesFromWatcherNodesList $discoveryData $WatcherNodesList
+    if ($healthServices.Count -eq 0) { return $discoveryData }
+
+    DiscoverHosts $discoveryData $healthServices
+
+    $discoveryData
+}

+ 94 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/BaseScriptedPropertyBagDataSource.mpx

@@ -0,0 +1,94 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.BaseScriptedPropertyBagDataSource" Accessibility="Internal">
+        <Configuration>
+          <IncludeSchemaTypes>
+            <SchemaType>Windows!Microsoft.Windows.PowerShellSchema</SchemaType>
+            <SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
+          </IncludeSchemaTypes>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element name="SyncTime" type="xsd:string" minOccurs="0" />
+          <xsd:element name="TimeoutSeconds" type="xsd:int" />
+
+          <xsd:element name="StartupExpression" type="ExpressionType" minOccurs="0" />
+          
+          <xsd:element name="WorkflowName" type="xsd:string" />
+          <xsd:element name="Script" type="NonNullString" />
+          <xsd:element name="Parameters" type="NamedParametersType" />
+        </Configuration>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <DataSource ID="Scheduler" TypeID="System!System.SimpleScheduler">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+              </DataSource>
+              <ProbeAction ID="PS" TypeID="Ambari.SCOM.Module.ImpersonatedPowerShellPropertyBagProbe" >
+                <ScriptName>$Config/WorkflowName$.ps1</ScriptName>
+                <ScriptBody>
+                  $Config/Script$
+
+                  $IncludeFileContent/Shared Scripts/Logging.ps1$
+                  $IncludeFileContent/Shared Scripts/JsonParser.ps1$
+                  $IncludeFileContent/Shared Scripts/RestApi.ps1$
+                  $IncludeFileContent/Shared Scripts/MonitoringHelpers.ps1$
+
+                  if (!$Username) { return }
+                  
+                  $ScriptApi = New-Object -ComObject "MOM.ScriptAPI"
+                  try {
+                    Main
+                  } catch {
+                    LogMessage '$Config/WorkflowName$' 1 $_
+                  }
+                </ScriptBody>
+                <Parameters>$Config/Parameters$</Parameters>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+              </ProbeAction>
+              <ConditionDetection ID="StartupCheck" TypeID="System!System.ExpressionFilter">
+                <Expression>$Config/StartupExpression$</Expression>
+              </ConditionDetection>
+            </MemberModules>
+            <Composition>
+              <Node ID="PS">
+                <Node ID="StartupCheck">
+                  <Node ID="Scheduler" />
+                </Node>
+              </Node>
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.PropertyBagData</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.BaseScriptedPropertyBagDataSource">
+          <Name>Hadoop Base Scripted Property Bag Data Provider</Name>
+          <Description>This module allows to execute Powershell scripts to collect data into Property Bag objects.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 102 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/ClusterServiceMetricsDataSource.mpx

@@ -0,0 +1,102 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.ClusterServiceMetricsDataSource" Accessibility="Internal">
+        <Configuration>
+          <IncludeSchemaTypes>
+            <SchemaType>Windows!Microsoft.Windows.PowerShellSchema</SchemaType>
+          </IncludeSchemaTypes>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:int" />
+
+          <xsd:element name="CollectionScript" type="NonNullString" />
+          <xsd:element name="ServiceName" type="xsd:string" />
+        </Configuration>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.BaseScriptedPropertyBagDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+
+                <StartupExpression>
+                  <And>
+                    <Expression>
+                      <Exists>
+                        <ValueExpression>
+                          <Value Type="String">$Target/Host/Property[Type="Ambari.SCOM.AmbariManagedEntity"]/AmbariUri$</Value>
+                        </ValueExpression>
+                      </Exists>
+                    </Expression>
+                    <Expression>
+                      <SimpleExpression>
+                        <ValueExpression>
+                          <Value Type="String">$Target/Host/Property[Type="Ambari.SCOM.AmbariManagedEntity"]/AmbariUri$</Value>
+                        </ValueExpression>
+                        <Operator>NotEqual</Operator>
+                        <ValueExpression>
+                          <Value Type="String" />
+                        </ValueExpression>
+                      </SimpleExpression>
+                    </Expression>
+                  </And>
+                </StartupExpression>
+
+                <WorkflowName>$Config/ServiceName$ServiceMetricsCollection</WorkflowName>
+                <Script>$Config/CollectionScript$</Script>
+                <Parameters>
+                  <Parameter>
+                    <Name>MonitoringAmbariUri</Name>
+                    <Value>$Target/Host/Property[Type="Ambari.SCOM.AmbariManagedEntity"]/AmbariUri$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Username</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/UserName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Password</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/Password$</Value>
+                  </Parameter>
+                </Parameters>
+              </DataSource>
+            </MemberModules>
+            <Composition>
+              <Node ID="DS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.PropertyBagData</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.ClusterServiceMetricsDataSource">
+          <Name>Hadoop Base Cluster Service Metrics Property Bag Data Provider</Name>
+          <Description>This module collects all metrics available for target Cluster Service into property bag using provided collection script.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 72 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/HdfsServiceMetricsDataSource.mpx

@@ -0,0 +1,72 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.HdfsServiceMetricsDataSource" Accessibility="Internal">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:int" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.ClusterServiceMetricsDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+                <CollectionScript>$IncludeFileContent/Modules/DataSources/Monitoring/Scripts/HdfsServiceMetrics.ps1$</CollectionScript>
+                <ServiceName>Hdfs</ServiceName>
+              </DataSource>
+            </MemberModules>
+            <Composition>
+              <Node ID="DS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.PropertyBagData</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.HdfsServiceMetricsDataSource">
+          <Name>Hadoop HDFS Cluster Service Metrics Property Bag Data Provider</Name>
+          <Description>This module collects all metrics available for target HDFS Cluster Service into property bag.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HdfsServiceMetricsDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HdfsServiceMetricsDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HdfsServiceMetricsDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 81 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/HdfsServiceMetricsPerformanceDataSource.mpx

@@ -0,0 +1,81 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.HdfsServiceMetricsPerformanceDataSource" Accessibility="Internal">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:int" />
+
+          <xsd:element name="PropertyName" type="xsd:string" />
+          <xsd:element name="CounterName" type="xsd:string" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.HdfsServiceMetricsDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+              </DataSource>
+              <ConditionDetection ID="Mapper" TypeID="Ambari.SCOM.Module.PropertyBagPerformanceDataMapper">
+                <PropertyName>$Config/PropertyName$</PropertyName>
+                <ObjectName>Hadoop : Cluster Service</ObjectName>
+                <CounterName>$Config/CounterName$</CounterName>
+                <InstanceName>$Target/Host/Property[Type="Ambari.SCOM.ClusterService.Private"]/ClusterName$ : $Target/Host/Property[Type="Ambari.SCOM.ClusterService.Private"]/ServiceName$</InstanceName>
+              </ConditionDetection>
+            </MemberModules>
+            <Composition>
+              <Node ID="Mapper">
+                <Node ID="DS" />
+              </Node>
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>Perf!System.Performance.Data</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.HdfsServiceMetricsPerformanceDataSource">
+          <Name>Hadoop HDFS Cluster Service Metrics Performance Data Provider</Name>
+          <Description>This module collects specified metric for HDFS Cluster Service as performance data point.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HdfsServiceMetricsPerformanceDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HdfsServiceMetricsPerformanceDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HdfsServiceMetricsPerformanceDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 87 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/HostComponentHealthStateDataSource.mpx

@@ -0,0 +1,87 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.HostComponentHealthStateDataSource" Accessibility="Internal">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:int" />
+          <xsd:element name="MonitoringAmbariUri" type="xsd:string" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.BaseScriptedPropertyBagDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+                <WorkflowName>HostComponentHealthState</WorkflowName>
+                <Script>$IncludeFileContent/Modules/DataSources/Monitoring/Scripts/HostComponentHealthState.ps1$</Script>
+                <Parameters>
+                  <Parameter>
+                    <Name>MonitoringAmbariUri</Name>
+                    <Value>$Config/MonitoringAmbariUri$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Username</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/UserName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Password</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/Password$</Value>
+                  </Parameter>
+                </Parameters>
+              </DataSource>
+            </MemberModules>
+            <Composition>
+              <Node ID="DS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.PropertyBagData</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentHealthStateDataSource">
+          <Name>Hadoop Host Component Health State Data Provider</Name>
+          <Description>This module providers health state for target Host Component.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentHealthStateDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentHealthStateDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentHealthStateDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 86 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/HostComponentMetricsDataSource.mpx

@@ -0,0 +1,86 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.HostComponentMetricsDataSource" Accessibility="Internal">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:int" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.BaseScriptedPropertyBagDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+                <WorkflowName>HostComponentMetricsCollection</WorkflowName>
+                <Script>$IncludeFileContent/Modules/DataSources/Monitoring/Scripts/HostComponentMetrics.ps1$</Script>
+                <Parameters>
+                  <Parameter>
+                    <Name>MonitoringAmbariUri</Name>
+                    <Value>$Target/Property[Type="Ambari.SCOM.AmbariManagedEntity"]/AmbariUri$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Username</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/UserName$</Value>
+                  </Parameter>
+                  <Parameter>
+                    <Name>Password</Name>
+                    <Value>$RunAs[Name="Ambari.SCOM.Profile.Ambari"]/Password$</Value>
+                  </Parameter>
+                </Parameters>
+              </DataSource>
+            </MemberModules>
+            <Composition>
+              <Node ID="DS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.PropertyBagData</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentMetricsDataSource">
+          <Name>Hadoop Host Component Metrics Data Provider</Name>
+          <Description>This module collects all metrics available for target Host Component into property bag.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentMetricsDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentMetricsDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentMetricsDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 81 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/HostComponentMetricsPerformanceDataSource.mpx

@@ -0,0 +1,81 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.HostComponentMetricsPerformanceDataSource" Accessibility="Internal">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:int" />
+
+          <xsd:element name="PropertyName" type="xsd:string" />
+          <xsd:element name="CounterName" type="xsd:string" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.HostComponentMetricsDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+              </DataSource>
+              <ConditionDetection ID="Mapper" TypeID="Ambari.SCOM.Module.PropertyBagPerformanceDataMapper">
+                <PropertyName>$Config/PropertyName$</PropertyName>
+                <ObjectName>Hadoop : Host Component</ObjectName>
+                <CounterName>$Config/CounterName$</CounterName>
+                <InstanceName>$Target/Host/Host/Property[Type="Ambari.SCOM.Host.Private"]/ClusterName$ : $Target/Host/Property[Type="Ambari.SCOM.Host"]/IpAddress$ : $Target/Property[Type="Ambari.SCOM.HostComponent"]/ComponentName$</InstanceName>
+              </ConditionDetection>
+            </MemberModules>
+            <Composition>
+              <Node ID="Mapper">
+                <Node ID="DS" />
+              </Node>
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>Perf!System.Performance.Data</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentMetricsPerformanceDataSource">
+          <Name>Hadoop Host Component Metrics Performance Data Provider</Name>
+          <Description>This module collects specified metric for target Host Component entity as performance data point.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentMetricsPerformanceDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentMetricsPerformanceDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.HostComponentMetricsPerformanceDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 72 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/MapReduceServiceMetricsDataSource.mpx

@@ -0,0 +1,72 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.MapReduceServiceMetricsDataSource" Accessibility="Internal">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:int" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.ClusterServiceMetricsDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+                <CollectionScript>$IncludeFileContent/Modules/DataSources/Monitoring/Scripts/MapReduceServiceMetrics.ps1$</CollectionScript>
+                <ServiceName>MapReduce</ServiceName>
+              </DataSource>
+            </MemberModules>
+            <Composition>
+              <Node ID="DS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.PropertyBagData</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.MapReduceServiceMetricsDataSource">
+          <Name>Hadoop MapReduce Cluster Service Metrics Property Bag Provider</Name>
+          <Description>This module collects all metrics available for target MapReduce Cluster Service into property bag.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.MapReduceServiceMetricsDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.MapReduceServiceMetricsDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.MapReduceServiceMetricsDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 81 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/MapReduceServiceMetricsPerformanceDataSource.mpx

@@ -0,0 +1,81 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <DataSourceModuleType ID="Ambari.SCOM.Module.MapReduceServiceMetricsPerformanceDataSource" Accessibility="Internal">
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:int" />
+
+          <xsd:element name="PropertyName" type="xsd:string" />
+          <xsd:element name="CounterName" type="xsd:string" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <DataSource ID="DS" TypeID="Ambari.SCOM.Module.MapReduceServiceMetricsDataSource">
+                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+                <SyncTime>$Config/SyncTime$</SyncTime>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+              </DataSource>
+              <ConditionDetection ID="Mapper" TypeID="Ambari.SCOM.Module.PropertyBagPerformanceDataMapper">
+                <PropertyName>$Config/PropertyName$</PropertyName>
+                <ObjectName>Hadoop : Cluster Service</ObjectName>
+                <CounterName>$Config/CounterName$</CounterName>
+                <InstanceName>$Target/Host/Property[Type="Ambari.SCOM.ClusterService.Private"]/ClusterName$ : $Target/Host/Property[Type="Ambari.SCOM.ClusterService.Private"]/ServiceName$</InstanceName>
+              </ConditionDetection>
+            </MemberModules>
+            <Composition>
+              <Node ID="Mapper">
+                <Node ID="DS" />
+              </Node>
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>Perf!System.Performance.Data</OutputType>
+      </DataSourceModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.MapReduceServiceMetricsPerformanceDataSource">
+          <Name>Hadoop MapReduce Cluster Service Metrics Performance Data Provider</Name>
+          <Description>This module collects specified metric for MapReduce Cluster Service as performance data point.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.MapReduceServiceMetricsPerformanceDataSource" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.MapReduceServiceMetricsPerformanceDataSource" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.Module.MapReduceServiceMetricsPerformanceDataSource" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 95 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/Scripts/HdfsServiceMetrics.ps1

@@ -0,0 +1,95 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+Param ($MonitoringAmbariUri, $Username, $Password)
+
+function Main {
+    $response = InvokeRestAPI (JoinUri "$MonitoringAmbariUri" 'components/NAMENODE?fields=metrics/dfs') $Username $Password
+
+    $propertyBag = $ScriptApi.CreatePropertyBag()
+
+    if ($response.metrics -ne $null) {
+        if (($namenodeGroup = TryGetChildValue $response.metrics @('dfs', 'namenode')) -ne $null) {
+            if ($namenodeGroup['LiveNodes']) {
+                try {
+                    $liveNodes = (ParseJsonString $namenodeGroup['LiveNodes']).Count
+                    $propertyBag.AddValue('livenodes', $liveNodes)
+                } catch {}
+
+                try {
+                    $deadNodes = (ParseJsonString $namenodeGroup['DeadNodes']).Count
+                    $propertyBag.AddValue('deadnodes', $deadNodes)
+                } catch {}
+            
+                if ($liveNodes -ne $null -and $deadNodes -ne $null -and (($totalNodes = $liveNodes + $deadNodes) -gt 0)) {
+                    $propertyBag.AddValue('deadnodes_percent', [Math]::Round($deadNodes / $totalNodes * 100, 2))
+                }
+
+                try {
+                    $decomNodes = (ParseJsonString $namenodeGroup['DecomNodes']).Count
+                    $propertyBag.AddValue('decomnodes', $decomNodes)
+                } catch {}
+            }
+
+            $null = AddToBagIfExists $propertyBag 'filescreated' $namenodeGroup 'FilesCreated'
+            $null = AddToBagIfExists $propertyBag 'filesappended' $namenodeGroup 'FilesAppended'
+            $null = AddToBagIfExists $propertyBag 'filesdeleted' $namenodeGroup 'FilesDeleted'
+        }
+
+        if (($fsNamesystemGroup = TryGetChildValue $response.metrics @('dfs', 'FSNamesystem')) -ne $null) {
+            $null = AddToBagIfExists $propertyBag 'filestotal' $fsNamesystemGroup 'FilesTotal'
+            $totalBlocks = AddToBagIfExists $propertyBag 'blockstotal' $fsNamesystemGroup 'BlocksTotal'
+            $capacityTotal = AddToBagIfExists $propertyBag 'capacitytotalgb' $fsNamesystemGroup 'CapacityTotalGB'
+            $capacityUsed = AddToBagIfExists $propertyBag 'capacityusedgb' $fsNamesystemGroup 'CapacityUsedGB'
+            $capacityRemaining = AddToBagIfExists $propertyBag 'capacityremaininggb' $fsNamesystemGroup 'CapacityRemainingGB'
+            if ($capacityTotal -ne $null -and $capacityUsed -ne $null -and $capacityRemaining -ne $null -and $capacityTotal -gt 0) {
+                $propertyBag.AddValue('capacitynondfsusedgb', $capacityTotal - $capacityUsed - $capacityRemaining)
+                $propertyBag.AddValue('capacityremaining_percent', [Math]::Round($capacityRemaining / $capacityTotal * 100, 2))
+            }
+            $null = AddToBagIfExists $propertyBag 'corruptblocks' $fsNamesystemGroup 'CorruptBlocks'
+            $null = AddToBagIfExists $propertyBag 'pendingdeletionblocks' $fsNamesystemGroup 'PendingDeletionBlocks'
+            $null = AddToBagIfExists $propertyBag 'pendingreplicationblocks' $fsNamesystemGroup 'PendingReplicationBlocks'
+            $underReplicatedBlocks = AddToBagIfExists $propertyBag 'underreplicatedblocks' $fsNamesystemGroup 'UnderReplicatedBlocks'
+            if ($underReplicatedBlocks -ne $null -and $totalBlocks -ne $null -and $totalBlocks -gt 0) {
+                $propertyBag.AddValue('underreplicatedblocks_percent', [Math]::Round($underReplicatedBlocks / $totalBlocks * 100, 2))
+            }
+            $null = AddToBagIfExists $propertyBag 'missingblocks' $fsNamesystemGroup 'MissingBlocks'
+        }
+    }
+
+    $startTimeStamp = ToUnixEpochTimeStamp([DateTime]::UtcNow.AddMinutes(-10))
+    $response = InvokeRestAPI (JoinUri "$MonitoringAmbariUri" "components/DATANODE?fields=metrics/dfs/datanode[$startTimeStamp]") $Username $Password
+
+    if (($datanodeGroup = TryGetChildValue $response @('metrics', 'dfs', 'datanode')) -ne $null) {
+        foreach ($metric in $datanodeGroup.Keys) {
+            $null = AddToBagIfExists $propertyBag ("aggregated.datanode.$metric".ToLower()) (GetLatestValue $datanodeGroup[$metric])
+        }
+    }
+
+    $propertyBag
+}
+
+function GetLatestValue($measures) {
+    $maxDate = 0
+    $maxValue = $null
+    foreach ($measure in $measures) {
+        if ($measure[1] -le $maxDate) { continue }
+        $maxDate = $measure[1]
+        $maxValue = $measure[0]
+    }
+    $maxValue
+}

+ 29 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/Scripts/HostComponentHealthState.ps1

@@ -0,0 +1,29 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+Param ($MonitoringAmbariUri, $Username, $Password)
+
+function Main {
+    $response = InvokeRestAPI "$($MonitoringAmbariUri)?fields=HostRoles/state" $Username $Password
+
+    $propertyBag = $ScriptApi.CreatePropertyBag()
+
+    if (($state = TryGetChildValue $response @('HostRoles', 'state')) -eq $null) { return $propertyBag }
+    $propertyBag.AddValue('State', $state)
+
+    $propertyBag
+}

+ 53 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/Scripts/HostComponentMetrics.ps1

@@ -0,0 +1,53 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+Param ($MonitoringAmbariUri, $Username, $Password)
+
+function Main {
+    $response = InvokeRestAPI "$MonitoringAmbariUri" $Username $Password
+
+    $propertyBag = $ScriptApi.CreatePropertyBag()
+
+    if ($response.metrics -eq $null) { return $propertyBag }
+
+    Add-MetricChildrenItems $propertyBag '' $response.metrics
+
+    if ('namenode', 'jobtracker' -contains $response.HostRoles.component_name) {
+        if ($response.metrics['jvm'] -ne $null) {
+            $memoryUsed = $response.metrics['jvm']['memHeapUsedM']
+            $memoryCommitted = $response.metrics['jvm']['memHeapCommittedM']
+            if ($memoryUsed -ne $null -and $memoryCommitted -ne $null -and $memoryCommitted -gt 0) {
+                $propertyBag.AddValue("calculated.memheapusedpercent", [Math]::Round($memoryUsed / $memoryCommitted * 100, 2))
+            }
+        }
+    }
+
+    $propertyBag
+}
+
+function Add-MetricChildrenItems($propertyBag, $parentName, $children) {
+    $parentPrefix = $(if (!$parentName) { '' } else { "$parentName." })
+    foreach ($childName in $children.Keys) {
+        if ($children[$childName] -eq $null) { continue }
+
+        if ($children[$childName] -is [Hashtable]) {
+            Add-MetricChildrenItems $propertyBag "$parentPrefix$childName" $children[$childName]
+        } else {
+            $propertyBag.AddValue("$parentPrefix$childName".ToLower(), $children[$childName])
+        }
+    }
+}

+ 62 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/DataSources/Monitoring/Scripts/MapReduceServiceMetrics.ps1

@@ -0,0 +1,62 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+Param ($MonitoringAmbariUri, $Username, $Password)
+
+function Main {
+    $response = InvokeRestAPI (JoinUri "$MonitoringAmbariUri" 'components/JOBTRACKER?fields=metrics/mapred/jobtracker') $Username $Password
+
+    $propertyBag = $ScriptApi.CreatePropertyBag()
+
+    if (($jobtrackerGroup = TryGetChildValue $response @('metrics', 'mapred', 'jobtracker')) -eq $null) { return $propertyBag }
+
+    if ($jobtrackerGroup['SummaryJson'] -ne $null) {
+        try {
+            $nodesSummary = ParseJsonString $jobtrackerGroup['SummaryJson']
+
+            $totalNodes = $nodesSummary['nodes']
+            $aliveCount = $nodesSummary['alive']
+
+            if ($aliveCount -ne $null -and $totalNodes -ne $null) {
+                $propertyBag.AddValue('livetasktrackers', $aliveCount)
+                $propertyBag.AddValue('deadtasktrackers', $totalNodes - $aliveCount)
+
+                if ($totalNodes -gt 0) {
+                    $propertyBag.AddValue('deadtasktrackers_percent', [Math]::Round(100 - $aliveCount / $totalNodes * 100, 2))
+                }
+            }
+        } catch {}
+    }
+
+    foreach ($metricName in $jobtrackerGroup.Keys) {
+        if (!(ShouldCollectMetric $metricName) -or $jobtrackerGroup[$metricName] -eq $null) { continue }
+        $propertyBag.AddValue("$metricName".ToLower(), $jobtrackerGroup[$metricName])
+    }
+
+    $jobsSubmitted = $jobtrackerGroup['jobs_submitted']
+    if ($jobtrackerGroup['jobs_failed'] -ne $null -and $jobsSubmitted -ne $null -and $jobsSubmitted -gt 0) {
+        $propertyBag.AddValue('failedjobs_percent', [Math]::Round($jobtrackerGroup['jobs_failed'] / $jobsSubmitted * 100, 2))
+    } elseif ($jobtrackerGroup['jobs_failed'] -eq 0) {
+        $propertyBag.AddValue('failedjobs_percent', 0)
+	}
+
+    $propertyBag
+}
+
+function ShouldCollectMetric($metricName) {
+    return 'BlacklistedNodesInfoJson', 'GraylistedNodesInfoJson', 'QueueInfoJson', 'SummaryJson', 'AliveNodesInfoJson' -notcontains $metricName
+}

+ 68 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/Modules/ProbeActions/ImpersonatedPowerShellPropertyBagProbe.mpx

@@ -0,0 +1,68 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <ModuleTypes>
+      <ProbeActionModuleType ID="Ambari.SCOM.Module.ImpersonatedPowerShellPropertyBagProbe"
+                             RunAs="Ambari.SCOM.Profile.Workflow"
+                             Accessibility="Internal">
+        <Configuration>
+          <IncludeSchemaTypes>
+            <SchemaType>Windows!Microsoft.Windows.PowerShellSchema</SchemaType>
+          </IncludeSchemaTypes>
+          <xsd:element name="ScriptName" type="NonNullString" />
+          <xsd:element name="ScriptBody" type="NonNullString" />
+          <xsd:element name="SnapIns" type="SnapInsType" minOccurs="0" maxOccurs="1" />
+          <xsd:element name="Parameters" type="NamedParametersType" minOccurs="0" maxOccurs="1" />
+          <xsd:element name="TimeoutSeconds" type="xsd:integer" />
+          <xsd:element name="StrictErrorHandling" type="xsd:boolean" minOccurs="0" maxOccurs="1" />
+        </Configuration>
+        <ModuleImplementation>
+          <Composite>
+            <MemberModules>
+              <ProbeAction ID="PS" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagProbe">
+                <ScriptName>$Config/ScriptName$</ScriptName>
+                <ScriptBody>$Config/ScriptBody$</ScriptBody>
+                <SnapIns>$Config/SnapIns$</SnapIns>
+                <Parameters>$Config/Parameters$</Parameters>
+                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+                <StrictErrorHandling>$Config/StrictErrorHandling$</StrictErrorHandling>
+              </ProbeAction>
+            </MemberModules>
+            <Composition>
+              <Node ID="PS" />
+            </Composition>
+          </Composite>
+        </ModuleImplementation>
+        <OutputType>System!System.PropertyBagData</OutputType>
+        <InputType>System!System.BaseData</InputType>
+      </ProbeActionModuleType>
+    </ModuleTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.Module.ImpersonatedPowerShellPropertyBagProbe">
+          <Name>Hadoop Impersonated Powershell Property Bag Data Provider</Name>
+          <Description>This module executes Powershell script to collect data into Property Bag. Script is executed under specified RunAs account.</Description>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 332 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/MonitorTypes/HdfsServiceThreeStateThresholdMonitorType.mpx

@@ -0,0 +1,332 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <MonitorTypes>
+      <UnitMonitorType ID="Ambari.SCOM.UnitMonitorType.HdfsServiceThreeStateThreshold" Accessibility="Internal">
+        <MonitorTypeStates>
+          <MonitorTypeState ID="Healthy" NoDetection="false" />
+          <MonitorTypeState ID="Warning" NoDetection="false" />
+          <MonitorTypeState ID="Critical" NoDetection="false" />
+        </MonitorTypeStates>
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1"  name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:integer" />
+          
+          <xsd:element name="PropertyName" type="xsd:string" />
+
+          <xsd:element name="TheGreaterTheBetter" type="xsd:boolean" />
+          <xsd:element name="WarningThreshold" type="xsd:double" />
+          <xsd:element name="CriticalThreshold" type="xsd:double" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+
+          <OverrideableParameter ID="WarningThreshold" Selector="$Config/WarningThreshold$" ParameterType="double" />
+          <OverrideableParameter ID="CriticalThreshold" Selector="$Config/CriticalThreshold$" ParameterType="double" />
+        </OverrideableParameters>
+        <MonitorImplementation>
+          <MemberModules>
+            <DataSource ID="DS" TypeID="Ambari.SCOM.Module.HdfsServiceMetricsDataSource">
+              <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+              <SyncTime>$Config/SyncTime$</SyncTime>
+              <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+            </DataSource>
+
+            <ConditionDetection ID="HealthyCondition" TypeID="System!System.ExpressionFilter">
+              <Expression>
+                <Or>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">false</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Less</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/WarningThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Less</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">true</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Greater</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/WarningThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Greater</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                </Or>
+              </Expression>
+            </ConditionDetection>
+
+            <ConditionDetection ID="WarningCondition" TypeID="System!System.ExpressionFilter">
+              <Expression>
+                <Or>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">false</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>GreaterEqual</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/WarningThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Less</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">true</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>LessEqual</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/WarningThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Greater</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                </Or>
+              </Expression>
+            </ConditionDetection>
+
+            <ConditionDetection ID="CriticalCondition" TypeID="System!System.ExpressionFilter">
+              <Expression>
+                <Or>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">false</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>GreaterEqual</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">true</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>LessEqual</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                </Or>
+              </Expression>
+            </ConditionDetection>
+          </MemberModules>
+          <RegularDetections>
+            <RegularDetection MonitorTypeStateID="Healthy">
+              <Node ID="HealthyCondition">
+                <Node ID="DS" />
+              </Node>
+            </RegularDetection>
+            <RegularDetection MonitorTypeStateID="Warning">
+              <Node ID="WarningCondition">
+                <Node ID="DS" />
+              </Node>
+            </RegularDetection>
+            <RegularDetection MonitorTypeStateID="Critical">
+              <Node ID="CriticalCondition">
+                <Node ID="DS" />
+              </Node>
+            </RegularDetection>
+          </RegularDetections>
+        </MonitorImplementation>
+      </UnitMonitorType>
+    </MonitorTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceThreeStateThreshold">
+          <Name>Hadoop HDFS Cluster Service Three-State Threshold Unit Monitor Type</Name>
+          <Description>This three-state unit monitor type compares specified HDFS Cluster Service metric against defined thresholds.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceThreeStateThreshold" SubElementID="Healthy">
+          <Name>Healthy</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceThreeStateThreshold" SubElementID="Warning">
+          <Name>Warning</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceThreeStateThreshold" SubElementID="Critical">
+          <Name>Critical</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceThreeStateThreshold" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceThreeStateThreshold" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceThreeStateThreshold" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceThreeStateThreshold" SubElementID="WarningThreshold">
+          <Name>Warning Threshold</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceThreeStateThreshold" SubElementID="CriticalThreshold">
+          <Name>Critical Threshold</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 214 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/MonitorTypes/HdfsServiceTwoStateThresholdMonitorType.mpx

@@ -0,0 +1,214 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <MonitorTypes>
+      <UnitMonitorType ID="Ambari.SCOM.UnitMonitorType.HdfsServiceTwoStateThreshold" Accessibility="Internal">
+        <MonitorTypeStates>
+          <MonitorTypeState ID="Healthy" NoDetection="false" />
+          <MonitorTypeState ID="Critical" NoDetection="false" />
+        </MonitorTypeStates>
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:integer" />
+
+          <xsd:element name="PropertyName" type="xsd:string" />
+
+          <xsd:element name="TheGreaterTheBetter" type="xsd:boolean" />
+          <xsd:element name="Threshold" type="xsd:double" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="Threshold" Selector="$Config/Threshold$" ParameterType="double" />
+        </OverrideableParameters>
+        <MonitorImplementation>
+          <MemberModules>
+            <DataSource ID="DS" TypeID="Ambari.SCOM.Module.HdfsServiceMetricsDataSource">
+              <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+              <SyncTime>$Config/SyncTime$</SyncTime>
+              <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+            </DataSource>
+
+            <ConditionDetection ID="HealthyCondition" TypeID="System!System.ExpressionFilter">
+              <Expression>
+                <Or>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">false</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Less</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/Threshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">true</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Greater</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/Threshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                </Or>
+              </Expression>
+            </ConditionDetection>
+
+            <ConditionDetection ID="CriticalCondition" TypeID="System!System.ExpressionFilter">
+              <Expression>
+                <Or>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">false</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>GreaterEqual</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/Threshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">true</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>LessEqual</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/Threshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                </Or>
+              </Expression>
+            </ConditionDetection>
+          </MemberModules>
+          <RegularDetections>
+            <RegularDetection MonitorTypeStateID="Healthy">
+              <Node ID="HealthyCondition">
+                <Node ID="DS" />
+              </Node>
+            </RegularDetection>
+            <RegularDetection MonitorTypeStateID="Critical">
+              <Node ID="CriticalCondition">
+                <Node ID="DS" />
+              </Node>
+            </RegularDetection>
+          </RegularDetections>
+        </MonitorImplementation>
+      </UnitMonitorType>
+    </MonitorTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceTwoStateThreshold">
+          <Name>Hadoop HDFS Cluster Service Two-State Threshold Unit Monitor Type</Name>
+          <Description>This two-state unit monitor type compares specified HDFS Cluster Service metric against defined threshold.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceTwoStateThreshold" SubElementID="Healthy">
+          <Name>Healthy</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceTwoStateThreshold" SubElementID="Critical">
+          <Name>Unhealthy</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceTwoStateThreshold" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceTwoStateThreshold" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceTwoStateThreshold" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HdfsServiceTwoStateThreshold" SubElementID="Threshold">
+          <Name>Threshold</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 132 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/MonitorTypes/HostComponentHealthStateMonitorType.mpx

@@ -0,0 +1,132 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <MonitorTypes>
+      <UnitMonitorType ID="Ambari.SCOM.UnitMonitorType.HostComponentHealthState" Accessibility="Internal">
+        <MonitorTypeStates>
+          <MonitorTypeState ID="Healthy" NoDetection="false" />
+          <MonitorTypeState ID="Critical" NoDetection="false" />
+        </MonitorTypeStates>
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:integer" />
+          
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+        </OverrideableParameters>
+        <MonitorImplementation>
+          <MemberModules>
+            <DataSource ID="DS" TypeID="Ambari.SCOM.Module.HostComponentHealthStateDataSource">
+              <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+              <SyncTime>$Config/SyncTime$</SyncTime>
+              <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+              <MonitoringAmbariUri>$Target/Property[Type="Ambari.SCOM.AmbariManagedEntity"]/AmbariUri$</MonitoringAmbariUri>
+            </DataSource>
+
+            <ConditionDetection ID="HealthyCondition" TypeID="System!System.ExpressionFilter">
+              <Expression>
+                <Or>
+                  <Expression>
+                    <Not>
+                      <Expression>
+                        <Exists>
+                          <ValueExpression>
+                            <XPathQuery Type="String">Property[@Name='State']</XPathQuery>
+                          </ValueExpression>
+                        </Exists>
+                      </Expression>
+                    </Not>
+                  </Expression>
+                  <Expression>
+                    <SimpleExpression>
+                      <ValueExpression>
+                        <XPathQuery Type="String">Property[@Name='State']</XPathQuery>
+                      </ValueExpression>
+                      <Operator>Equal</Operator>
+                      <ValueExpression>
+                        <Value Type="String">started</Value>
+                      </ValueExpression>
+                    </SimpleExpression>
+                  </Expression>
+                </Or>
+              </Expression>
+            </ConditionDetection>
+
+            <ConditionDetection ID="CriticalCondition" TypeID="System!System.ExpressionFilter">
+              <Expression>
+                <SimpleExpression>
+                  <ValueExpression>
+                    <XPathQuery Type="String">Property[@Name='State']</XPathQuery>
+                  </ValueExpression>
+                  <Operator>NotEqual</Operator>
+                  <ValueExpression>
+                    <Value Type="String">started</Value>
+                  </ValueExpression>
+                </SimpleExpression>
+              </Expression>
+            </ConditionDetection>
+          </MemberModules>
+          <RegularDetections>
+            <RegularDetection MonitorTypeStateID="Healthy">
+              <Node ID="HealthyCondition">
+                <Node ID="DS" />
+              </Node>
+            </RegularDetection>
+            <RegularDetection MonitorTypeStateID="Critical">
+              <Node ID="CriticalCondition">
+                <Node ID="DS" />
+              </Node>
+            </RegularDetection>
+          </RegularDetections>
+        </MonitorImplementation>
+      </UnitMonitorType>
+    </MonitorTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentHealthState">
+          <Name>Hadoop Host Component Health State Unit Monitor Type</Name>
+          <Description>This two-state unit monitor type checks the health state of Host Component.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentHealthState" SubElementID="Healthy">
+          <Name>Healthy</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentHealthState" SubElementID="Critical">
+          <Name>Critical</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentHealthState" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentHealthState" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentHealthState" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

+ 332 - 0
contrib/ambari-scom/management-pack/Hadoop_MP/HadoopMp/MonitorTypes/HostComponentThreeStateThresholdMonitorType.mpx

@@ -0,0 +1,332 @@
+<!--## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.-->
+
+<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TypeDefinitions>
+    <MonitorTypes>
+      <UnitMonitorType ID="Ambari.SCOM.UnitMonitorType.HostComponentThreeStateThreshold" Accessibility="Internal">
+        <MonitorTypeStates>
+          <MonitorTypeState ID="Healthy" NoDetection="false" />
+          <MonitorTypeState ID="Warning" NoDetection="false" />
+          <MonitorTypeState ID="Critical" NoDetection="false" />
+        </MonitorTypeStates>
+        <Configuration>
+          <xsd:element name="IntervalSeconds" type="xsd:integer" />
+          <xsd:element minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string" />
+          <xsd:element name="TimeoutSeconds" type="xsd:integer" />
+
+          <xsd:element name="PropertyName" type="xsd:string" />
+
+          <xsd:element name="TheGreaterTheBetter" type="xsd:boolean" />
+          <xsd:element name="WarningThreshold" type="xsd:double" />
+          <xsd:element name="CriticalThreshold" type="xsd:double" />
+        </Configuration>
+        <OverrideableParameters>
+          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
+          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
+          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
+
+          <OverrideableParameter ID="WarningThreshold" Selector="$Config/WarningThreshold$" ParameterType="double" />
+          <OverrideableParameter ID="CriticalThreshold" Selector="$Config/CriticalThreshold$" ParameterType="double" />
+        </OverrideableParameters>
+        <MonitorImplementation>
+          <MemberModules>
+            <DataSource ID="DS" TypeID="Ambari.SCOM.Module.HostComponentMetricsDataSource">
+              <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
+              <SyncTime>$Config/SyncTime$</SyncTime>
+              <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
+            </DataSource>
+
+            <ConditionDetection ID="HealthyCondition" TypeID="System!System.ExpressionFilter">
+              <Expression>
+                <Or>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">false</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Less</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/WarningThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Less</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">true</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Greater</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/WarningThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Greater</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                </Or>
+              </Expression>
+            </ConditionDetection>
+
+            <ConditionDetection ID="WarningCondition" TypeID="System!System.ExpressionFilter">
+              <Expression>
+                <Or>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">false</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>GreaterEqual</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/WarningThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Less</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">true</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>LessEqual</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/WarningThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>Greater</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                </Or>
+              </Expression>
+            </ConditionDetection>
+
+            <ConditionDetection ID="CriticalCondition" TypeID="System!System.ExpressionFilter">
+              <Expression>
+                <Or>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">false</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>GreaterEqual</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                  <Expression>
+                    <And>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <Value Type="Boolean">$Config/TheGreaterTheBetter$</Value>
+                          </ValueExpression>
+                          <Operator>Equal</Operator>
+                          <ValueExpression>
+                            <Value Type="Boolean">true</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                      <Expression>
+                        <SimpleExpression>
+                          <ValueExpression>
+                            <XPathQuery Type="Double">Property[@Name='$Config/PropertyName$']</XPathQuery>
+                          </ValueExpression>
+                          <Operator>LessEqual</Operator>
+                          <ValueExpression>
+                            <Value Type="Double">$Config/CriticalThreshold$</Value>
+                          </ValueExpression>
+                        </SimpleExpression>
+                      </Expression>
+                    </And>
+                  </Expression>
+                </Or>
+              </Expression>
+            </ConditionDetection>
+          </MemberModules>
+          <RegularDetections>
+            <RegularDetection MonitorTypeStateID="Healthy">
+              <Node ID="HealthyCondition">
+                <Node ID="DS" />
+              </Node>
+            </RegularDetection>
+            <RegularDetection MonitorTypeStateID="Warning">
+              <Node ID="WarningCondition">
+                <Node ID="DS" />
+              </Node>
+            </RegularDetection>
+            <RegularDetection MonitorTypeStateID="Critical">
+              <Node ID="CriticalCondition">
+                <Node ID="DS" />
+              </Node>
+            </RegularDetection>
+          </RegularDetections>
+        </MonitorImplementation>
+      </UnitMonitorType>
+    </MonitorTypes>
+  </TypeDefinitions>
+
+  <LanguagePacks>
+    <LanguagePack ID="ENU" IsDefault="true">
+      <DisplayStrings>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentThreeStateThreshold">
+          <Name>Hadoop Host Component Three-State Threshold Unit Monitor Type</Name>
+          <Description>This three-state unit monitor type compares specified Host Component metric against defined threshold.</Description>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentThreeStateThreshold" SubElementID="Healthy">
+          <Name>Healthy</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentThreeStateThreshold" SubElementID="Warning">
+          <Name>Warning</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentThreeStateThreshold" SubElementID="Critical">
+          <Name>Critical</Name>
+        </DisplayString>
+
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentThreeStateThreshold" SubElementID="IntervalSeconds">
+          <Name>Interval (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentThreeStateThreshold" SubElementID="SyncTime">
+          <Name>Sync Time</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentThreeStateThreshold" SubElementID="TimeoutSeconds">
+          <Name>Timeout (sec)</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentThreeStateThreshold" SubElementID="WarningThreshold">
+          <Name>Warning Threshold</Name>
+        </DisplayString>
+        <DisplayString ElementID="Ambari.SCOM.UnitMonitorType.HostComponentThreeStateThreshold" SubElementID="CriticalThreshold">
+          <Name>Critical Threshold</Name>
+        </DisplayString>
+      </DisplayStrings>
+    </LanguagePack>
+  </LanguagePacks>
+</ManagementPackFragment>

Vissa filer visades inte eftersom för många filer har ändrats