Last active
August 29, 2015 14:05
-
-
Save junaid18183/663025b174cc5d8bf486 to your computer and use it in GitHub Desktop.
Dashing Widget for hadoop_job_tracker_stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dashing Widget for hadoop_job_tracker_stats |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% content_for :title do %>Hadoop dashboard<% end %> | |
<div class="gridster"> | |
<ul> | |
<li data-row="1" data-col="1" data-sizex="2" data-sizey="1"> | |
<div data-view="Clock"></div> | |
<i class="icon-time icon-background"></i> | |
</li> | |
<li data-row="2" data-col="1" data-sizex="1" data-sizey="1"> | |
<div data-id="Nodes" data-view="HadoopJobTrackerStats" data-title="TaskTrackerNodes"></div> | |
</li> | |
<li data-row="2" data-col="2" data-sizex="1" data-sizey="1"> | |
<div data-id="Blacklisted_Nodes" data-view="HadoopJobTrackerStats" data-title="Blacklisted_Nodes"></div> | |
</li> | |
<li data-row="2" data-col="3" data-sizex="1" data-sizey="1"> | |
<div data-id="Excluded_Nodes" data-view="HadoopJobTrackerStats" data-title="Excluded_Nodes" ></div> | |
</li> | |
<li data-row="1" data-col="3" data-sizex="2" data-sizey="1"> | |
<div data-id="Running_Map_Tasks" data-view="HadoopJobTrackerStats" data-title="Running_Map_Tasks"></div> | |
</li> | |
<li data-row="2" data-col="4" data-sizex="1" data-sizey="2"> | |
<div data-id="Running_Reduce_Tasks" data-view="HadoopJobTrackerStats" data-title="Running_Reduce_Tasks"></div> | |
</li> | |
<li data-row="3" data-col="1" data-sizex="1" data-sizey="1"> | |
<div data-id="Avg._Tasks/Node" data-view="HadoopJobTrackerStats" data-title="Avg_Tasks/Node"></div> | |
</li> | |
<li data-row="3" data-col="2" data-sizex="1" data-sizey="1"> | |
<div data-id="Map_Task_Capacity" data-view="HadoopJobTrackerStats" data-title="Maps_Capacity"></div> | |
</li> | |
<li data-row="3" data-col="3" data-sizex="1" data-sizey="1"> | |
<div data-id="Reduce_Task_Capacity" data-view="HadoopJobTrackerStats" data-title="Reduce_Capacity"></div> | |
</li> | |
</ul> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'open-uri' | |
JobTracker_URL = 'http://cshdpm3.glam.colo:50030/jobtracker.jsp' | |
#---------------------------------------------------------------------------------------------------- | |
def get_job_tracker_status() | |
jt_stats=Hash.new | |
name=Array.new | |
value=Array.new | |
page = Nokogiri::HTML(open("#{JobTracker_URL}")) | |
search_str='Cluster Summary' | |
key=page.search "[text()*=\'#{search_str}\']" | |
key=key.first | |
key=key.next.next # This gives me the Table containing Cluster Summary | |
i=0 | |
key.css('th').each do |el| | |
name[i]=el.text.strip.tr(' ','_') # this will also replace space with _ | |
i=i+1 | |
end | |
j=0 | |
key.css('td').each do |el| | |
el=el.text.strip | |
value[j]=el.split | |
j=j+1 | |
end | |
name.zip(value).each do |n,v| | |
jt_stats[n]=v | |
end | |
return jt_stats | |
end | |
#---------------------------------------------------------------------------------------------------- | |
jt_stats=Hash.new | |
points = [] | |
SCHEDULER.every '1m' do | |
begin | |
jt_stats=get_job_tracker_status() | |
jt_stats.each do |key,value| | |
send_event( key.to_s, { current: value[0] }) | |
end | |
end | |
end | |
#---------------------------------------------------------------------------------------------------- | |
#Below are the widget_event_id it will send to Dashbord | |
#Running_Map_Tasks | |
#Running_Reduce_Tasks | |
#Total_Submissions | |
#Nodes | |
#Occupied_Map_Slots | |
#Occupied_Reduce_Slots | |
#Reserved_Map_Slots | |
#Reserved_Reduce_Slots | |
#Map_Task_Capacity | |
#Reduce_Task_Capacity | |
#Avg._Tasks/Node | |
#Blacklisted_Nodes | |
#Excluded_Nodes | |
#---------------------------------------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dashing.HadoopJobTrackerStats extends Dashing.Widget | |
@accessor 'current', Dashing.AnimatedValue | |
ready: -> | |
# This is fired when the widget is done being rendered | |
onData: (data) -> | |
# Handle incoming data | |
# You can access the html node of this widget with `@node` | |
# Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in. | |
$(@node).fadeOut().fadeIn() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1 class="title" data-bind="title"></h1> | |
<h2 class="value" data-bind="current | shortenedNumber | prepend prefix | append suffix"></h2> | |
<p class="change-rate"> | |
<i data-bind-class="arrow"></i><span data-bind="difference"></span> | |
</p> | |
<p class="more-info" data-bind="moreinfo"></p> | |
<p class="updated-at" data-bind="updatedAtMessage"></p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------------------------------------------------------------------------- | |
// Sass declarations | |
// ---------------------------------------------------------------------------- | |
$background-color: #96bf48; | |
$value-color: white; | |
$title-color: rgba(255, 255, 255, 0.7); | |
$moreinfo-color: rgba(255, 255, 255, 0.7); | |
// ---------------------------------------------------------------------------- | |
// Widget styles | |
// ---------------------------------------------------------------------------- | |
.widget-hadoop-job-tracker-stats { | |
background-color: $background-color; | |
.title { | |
color: $title-color; | |
} | |
.value { | |
color: $value-color; | |
} | |
.change-rate { | |
font-weight: 500; | |
font-size: 30px; | |
color: $value-color; | |
} | |
.updated-at { | |
color: rgba(0, 0, 0, 0.3); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment