Example #1
0
                  <th>' . $lang['nodeRole'] . '</th>
                  <th>' . $lang['createTime'] . '</th>
                  <th>' . $lang['action'] . '</th>
                </tr>
                </thead>
                <tbody>';
        $i = 1;
        while ($arr = $mysql->FetchArray()) {
            echo '<tr>
                  	<td>' . $i . '</td>
                  	<td>' . $arr['hostname'] . '</td>
                  	<td>' . $arr['ip'] . '</td>
                  	<td>' . $arr['role'] . '</td>
                  	<td>' . $arr['create_time'] . '</td>
                  	<td>';
            if (!$monitor->CheckAgentAlive($arr['ip'], 30050)) {
                echo '<a class="btn btn-danger" href="InstallManager.php?action=PushHadoopFiles&ip=' . $arr['ip'] . '">' . $lang['push'] . '</a>';
            } else {
                echo '<a class="btn btn-success" href="InstallManager.php?action=PushHadoopFiles&ip=' . $arr['ip'] . '">' . $lang['push'] . '</a>';
            }
            echo '</td>
                	</tr>';
            $i++;
        }
        echo '</tbody>
			</table>';
        echo '</div>';
    } else {
        $ip = $_GET['ip'];
        if ($handle = opendir('./hadoop')) {
            $i = 0;
Example #2
0
 while ($arr = $mysql->FetchArray()) {
     echo '<tr>
              	<td>' . $i . '</td>
              	<td><a href=NodeMonitor.php?action=NodeMrUsed&ip=' . $arr['ip'] . '>' . $arr['hostname'] . '</a></td>
              	<td>' . $arr['ip'] . '</td>';
     echo '<td>';
     $json = $monitor->GetJson($arr['ip'], "tasktracker");
     $map_task_slots = intval($monitor->GetJsonObject($json->{"beans"}, "mapTaskSlots"));
     $maps_running = intval($monitor->GetJsonObject($json->{"beans"}, "maps_running"));
     $reduce_task_slots = intval($monitor->GetJsonObject($json->{"beans"}, "reduceTaskSlots"));
     $reduces_running = intval($monitor->GetJsonObject($json->{"beans"}, "reduces_running"));
     $perc_map_running = round($maps_running / $map_task_slots * 100);
     $perc_map_remain = 100 - $perc_map_running;
     $perc_reduce_running = round($reduces_running / $reduce_task_slots * 100);
     $perc_reduce_remain = 100 - $perc_reduce_running;
     $bool = $monitor->CheckAgentAlive($arr['ip'], 30050);
     if ($bool == FALSE) {
         echo '
     		<div class="progress">
             <div class="bar bar-danger" style="width: 100%;">No Agent Alive</div>
    			</div>';
         echo '
     		<div class="progress">
             <div class="bar bar-danger" style="width: 100%;">No Agent Alive</div>
    			</div>';
     } else {
         echo '
     		<div class="progress">
             <div class="bar bar-success" style="width: ' . $perc_map_remain . '%;">Free Map Slots</div>
             <div class="bar bar-danger" style="width: ' . $perc_map_running . '%;">Running Map Slots</div>
     		</div>';