hostLevelDependencies = array(); //HDFS $this->addDependency("hdp-hadoop::namenode", SERVICE_STATE_RUNNING, "hdp-hadoop::namenode::service_check", array()); //MapReduce $this->addDependency("hdp-hadoop::jobtracker", SERVICE_STATE_RUNNING, "hdp-hadoop::jobtracker::service_check", array()); //ZooKeeper $this->addDependency("hdp-zookeeper", SERVICE_STATE_RUNNING, "hdp-zookeeper::zookeeper::service_check", array()); //HBase $this->addDependency("hdp-hbase::master", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-zookeeper::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-hbase::master", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-hbase::master", SERVICE_STATE_RUNNING, "hdp-zookeeper::client", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-hbase::master", SERVICE_STATE_RUNNING, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-hbase::master", SERVICE_STATE_UNINSTALLED, "hdp-zookeeper::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); $this->addDependency("hdp-hbase::master", SERVICE_STATE_UNINSTALLED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); $this->addDependency("hdp-hbase::regionserver", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-zookeeper::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-hbase::regionserver", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-hbase::regionserver", SERVICE_STATE_RUNNING, "hdp-zookeeper::client", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-hbase::regionserver", SERVICE_STATE_RUNNING, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-hbase::regionserver", SERVICE_STATE_UNINSTALLED, "hdp-zookeeper::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); $this->addDependency("hdp-hbase::regionserver", SERVICE_STATE_UNINSTALLED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); //Oozie $this->addDependency("hdp-oozie::server", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-oozie::server", SERVICE_STATE_RUNNING, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-oozie::server", SERVICE_STATE_UNINSTALLED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); //Hive depends on Hcat $this->addDependency("hdp-hive::server", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hcat", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-hive::server", SERVICE_STATE_RUNNING, "hdp-hcat", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-hive::server", SERVICE_STATE_UNINSTALLED, "hdp-hcat", array("service_state" => SERVICE_STATE_UNINSTALLED)); $this->addDependency("hdp-hive::client", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hcat", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-hive::client", SERVICE_STATE_UNINSTALLED, "hdp-hcat", array("service_state" => SERVICE_STATE_UNINSTALLED)); //Hive Service Check $this->addDependency("hdp-hive::hive::service_check", SERVICE_STATE_NOT_APPLICABLE, "hdp-hcat::hcat::service_check", array()); //Pig $this->addDependency("hdp-pig", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-pig", SERVICE_STATE_UNINSTALLED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); //Sqoop $this->addDependency("hdp-sqoop", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-sqoop", SERVICE_STATE_UNINSTALLED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); //Templeton $this->addDependency("hdp-templeton::server", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-zookeeper::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-pig", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hcat", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_RUNNING, "hdp-zookeeper::client", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_RUNNING, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_RUNNING, "hdp-pig", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_RUNNING, "hdp-hcat", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_UNINSTALLED, "hdp-zookeeper::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_UNINSTALLED, "hdp-hadoop::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_UNINSTALLED, "hdp-pig", array("service_state" => SERVICE_STATE_UNINSTALLED)); $this->addDependency("hdp-templeton::server", SERVICE_STATE_UNINSTALLED, "hdp-hcat", array("service_state" => SERVICE_STATE_UNINSTALLED)); //Ganglia $this->addDependency("hdp-ganglia::monitor", SERVICE_STATE_RUNNING, "hdp-ganglia::hdp-gmond::service_check", array()); $this->addDependency("hdp-ganglia::server", SERVICE_STATE_RUNNING, "hdp-ganglia::hdp-gmetad::service_check", array()); $this->addDependency("hdp-ganglia::server", SERVICE_STATE_RUNNING, "hdp-monitor-webserver", array()); //Nagios $this->addDependency("hdp-nagios::server", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-oozie::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-nagios::server", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hcat", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-nagios::server", SERVICE_STATE_INSTALLED_AND_CONFIGURED, "hdp-hive::client", array("service_state" => SERVICE_STATE_INSTALLED_AND_CONFIGURED)); $this->addDependency("hdp-nagios::server", SERVICE_STATE_RUNNING, "hdp-oozie::client", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-nagios::server", SERVICE_STATE_RUNNING, "hdp-hcat", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-nagios::server", SERVICE_STATE_RUNNING, "hdp-hive::client", array("service_state" => SERVICE_STATE_NO_OP)); $this->addDependency("hdp-nagios::server", SERVICE_STATE_UNINSTALLED, "hdp-oozie::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); $this->addDependency("hdp-nagios::server", SERVICE_STATE_UNINSTALLED, "hdp-hcat", array("service_state" => SERVICE_STATE_UNINSTALLED)); $this->addDependency("hdp-nagios::server", SERVICE_STATE_UNINSTALLED, "hdp-hive::client", array("service_state" => SERVICE_STATE_UNINSTALLED)); $this->addDependency("hdp-nagios::server", SERVICE_STATE_RUNNING, "hdp-nagios::nagios::service_check", array()); $this->addDependency("hdp-nagios::server", SERVICE_STATE_RUNNING, "hdp-monitor-webserver", array()); //Dashboard $this->addDependency("hdp-dashboard", SERVICE_STATE_RUNNING, "hdp-dashboard::dashboard::service_check", array()); } private function addDependency($role, $serviceState, $dep, $states) { if (!isset($this->hostLevelDependencies[$role])) { $this->hostLevelDependencies[$role] = array(); } if (!isset($this->hostLevelDependencies[$role][$serviceState])) { $this->hostLevelDependencies[$role][$serviceState] = array(); } if (!isset($this->hostLevelDependencies[$role][$serviceState][$dep])) { $this->hostLevelDependencies[$role][$serviceState][$dep] = $states; } else { $prevStates = $this->hostLevelDependencies[$role][$serviceState][$dep]; foreach ($states as $k => $v) { $prevStates[$k] = $v; } $this->hostLevelDependencies[$role][$serviceState][$dep] = $prevStates; } } public function getHostLevelDependencies($role, $serviceState) { $dependencies = array("hdp" => array() ); if (!isset($this->hostLevelDependencies[$role][$serviceState])) { return $dependencies; } $deps = $this->hostLevelDependencies[$role][$serviceState]; if (empty($deps)) { return $dependencies; } $reqs = array_keys($deps); while (!(empty($reqs))) { $d = array_pop($reqs); $moreReqs; if(isset($this->hostLevelDependencies[$d])) { $depSvcState = SERVICE_STATE_NOT_APPLICABLE; if (isset($this->hostLevelDependencies[$d][SERVICE_STATE_KEY])) { $depSvcState = $this->hostLevelDependencies[$d][SERVICE_STATE_KEY]; } $moreReqs = NULL; if (isset($this->hostLevelDependencies[$d][$depSvcState])) { $moreReqs = $this->hostLevelDependencies[$d][$depSvcState]; } if (!empty($moreReqs)) { foreach($moreReqs as $r => $v) { $deps[$r] = $v; if (!in_array($r, $reqs)) { array_push($reqs, $r); } } } } $dependencies[$d] = $deps[$d]; } return $dependencies; } } ?>