You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vg...@apache.org on 2012/05/09 02:27:28 UTC

svn commit: r1335856 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/js/deployProgress.js hmc/php/frontend/deploy.php

Author: vgogate
Date: Wed May  9 00:27:27 2012
New Revision: 1335856

URL: http://svn.apache.org/viewvc?rev=1335856&view=rev
Log:
AMBARI-190: On a Single Node install, Nagios alert do not take affect until hmc is restarted by Histesh Shah

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js
    incubator/ambari/branches/ambari-186/hmc/php/frontend/deploy.php

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1335856&r1=1335855&r2=1335856&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Wed May  9 00:27:27 2012
@@ -2,6 +2,9 @@ Ambari Change log
 
 Release 0.x.x - unreleased
 
+  AMBARI-190. On a Single Node install, Nagios alert do not take affect until 
+  hmc is restarted (Hitesh Shah via vgogate)
+
   AMBARI-189. Make getAllHostsInfo api support optional params ( Hitesh Shah via
   vgogate)
 

Modified: incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js?rev=1335856&r1=1335855&r2=1335856&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js Wed May  9 00:27:27 2012
@@ -70,21 +70,33 @@ function renderDeployProgress (deployPro
    */
   globalYui.one('#installationWizardProgressBarDivId').setStyle('display', 'none');
 
+  var hmcRestartMsg = '';
+  if (deployProgressInfo.nagiosGangliaCoHosted != null
+      && deployProgressInfo.nagiosGangliaCoHosted) {
+    hmcRestartMsg = '<strong>Note:</strong> We detected that you need to restart HMC as'
+        + ' Nagios/Ganglia are co-hosted on this server. <br/>Please restart'
+        + ' HMC using \"service hmc restart\" and then head ';
+  } else {
+    hmcRestartMsg = 'May we be so bold as to suggest heading ';
+  }
+
+  hmcRestartMsg += 'on over to the ' +
+      '<a href="javascript:void(null)" id=clustersListLinkId>' +
+        'Cluster information' +
+      '</a>' +
+      ' page?';
+
   var deployProgressStatusMessage = {
 
-    success: 
-      '<p>' +
-        'All done with the deploy! May we be so bold as to suggest heading on over to the ' + 
-        '<a href="javascript:void(null)" id=clustersListLinkId>' + 
-          'Cluster information' +
-        '</a>' +
-        ' page?' +
+    success:
+      '<p style=\"text-align:center\">' +
+        'All done with the deploy! <br/>' + hmcRestartMsg +
       '</p>',
     failure:
       '<p>' +
-        'We made a boo-boo! Take a look at the ' + 
+        'We made a boo-boo! Take a look at the ' +
           '<a href="javascript:void(null)" id=showDeployTxnLogsLinkId>Deploy Logs</a>' +
-        '?' +  
+        '?' +
       '</p>'
   };
 

Modified: incubator/ambari/branches/ambari-186/hmc/php/frontend/deploy.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/frontend/deploy.php?rev=1335856&r1=1335855&r2=1335856&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/frontend/deploy.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/frontend/deploy.php Wed May  9 00:27:27 2012
@@ -29,11 +29,44 @@ if (!isset($result["txnId"])) {
 
 $txnId = $result["txnId"];
 
+$thisHostName = trim(strtolower(exec('hostname -f')));
+
+$nagiosGangliaCoHosted = FALSE;
+$dbAccessor = new HMCDBAccessor($dbPath);
+
+// check if single node install
+$hostsInfo = $dbAccessor->getAllHostsInfo($clusterName);
+if (isset($hostsInfo["hosts"])
+    && is_array($hostsInfo["hosts"]) && count($hostsInfo["hosts"] == 1)) {
+  $nagiosGangliaCoHosted = TRUE;
+}
+
+// if not single node
+// check if nagios hosted on same server
+if (!$nagiosGangliaCoHosted) {
+  // check if component mapped to this host
+  $hostMap = $dbAccessor->getHostsForComponent($clusterName, "NAGIOS_SERVER");
+  if (isset($hostMap["hosts"][$thisHostName])) {
+    $nagiosGangliaCoHosted = TRUE;
+  }
+}
+
+// if still nothing then check if ganglia server installed on same server
+if (!$nagiosGangliaCoHosted) {
+  // check if component mapped to this host
+  $hostMap = $dbAccessor->getHostsForComponent($clusterName,
+      "GANGLIA_MONITOR_SERVER");
+  if (isset($hostMap["hosts"][$thisHostName])) {
+    $nagiosGangliaCoHosted = TRUE;
+  }
+}
+
 /* Create the output data... */
 $jsonOutput = array(
     'startTime' => $startTime,
     'clusterName' => $clusterName,
-    'txnId' => $txnId );
+    'txnId' => $txnId,
+    'nagiosGangliaCoHosted' => $nagiosGangliaCoHosted);
 
 /* ...and spit it out. */
 header("Content-type: application/json");