Skip to content

Instantly share code, notes, and snippets.

@netconstructor
Forked from gregology/README.md
Created June 21, 2013 11:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netconstructor/5830643 to your computer and use it in GitHub Desktop.
Save netconstructor/5830643 to your computer and use it in GitHub Desktop.

Setup

Put the loadavg1min.rb to jobs/loadavg1min.rb.

Add the code from loadavg1min.erb to the desired dashboard.

Preview

<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="loadavg1min" data-view="Graph" data-title="Server load" style="background-color:#47bbb3;" data-moreinfo="1 min intervals" ></div>
</li>
# Populate the graph with 0.00 results
points = []
(1..10).each do |i|
points << { x: i, y: 0 }
end
last_x = points.last[:x]
SCHEDULER.every '1m' do
points.shift
last_x += 1
uptime = %x('uptime')
points << { x: last_x, y: uptime[-17..-14].to_f }
send_event('loadavg1min', points: points)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment