collectd-interface 0.3.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/collectd-interface-daemon +21 -361
- data/bin/collectd-interface-plugins +11 -11
- data/lib/collectd/interface/config.rb +117 -0
- data/lib/collectd/interface/options.rb +68 -0
- data/lib/collectd/interface/service/data.rb +110 -0
- data/lib/collectd/interface/service/graph.rb +106 -0
- data/lib/collectd/interface/service/report.rb +82 -0
- data/lib/collectd/interface/service.rb +44 -0
- data/public/images/cpus.png +0 -0
- data/public/images/device/ops/sda.png +0 -0
- data/public/images/device/ops/sda1.png +0 -0
- data/public/images/device/ops/sda2.png +0 -0
- data/public/images/device/ops/sda5.png +0 -0
- data/public/images/device/ops/sda6.png +0 -0
- data/public/images/device/ops/sda7.png +0 -0
- data/public/images/device/ops/sda8.png +0 -0
- data/public/images/device/ops/sda9.png +0 -0
- data/public/images/device/ops/sdb.png +0 -0
- data/public/images/device/ops/sdb1.png +0 -0
- data/public/images/device/ops/sdh.png +0 -0
- data/public/images/device/ops/sdh1.png +0 -0
- data/public/images/device/ops/sdh2.png +0 -0
- data/public/images/device/ops/sdh3.png +0 -0
- data/public/images/device/ops/sdh4.png +0 -0
- data/public/images/device/ops/sr0.png +0 -0
- data/public/images/device/time/sda.png +0 -0
- data/public/images/device/time/sda1.png +0 -0
- data/public/images/device/time/sda2.png +0 -0
- data/public/images/device/time/sda5.png +0 -0
- data/public/images/device/time/sda6.png +0 -0
- data/public/images/device/time/sda7.png +0 -0
- data/public/images/device/time/sda8.png +0 -0
- data/public/images/device/time/sda9.png +0 -0
- data/public/images/device/time/sdb.png +0 -0
- data/public/images/device/time/sdb1.png +0 -0
- data/public/images/device/time/sdh.png +0 -0
- data/public/images/device/time/sdh1.png +0 -0
- data/public/images/device/time/sdh2.png +0 -0
- data/public/images/device/time/sdh3.png +0 -0
- data/public/images/device/time/sdh4.png +0 -0
- data/public/images/device/time/sr0.png +0 -0
- data/public/images/device/traffic/sda.png +0 -0
- data/public/images/device/traffic/sda1.png +0 -0
- data/public/images/device/traffic/sda2.png +0 -0
- data/public/images/device/traffic/sda5.png +0 -0
- data/public/images/device/traffic/sda6.png +0 -0
- data/public/images/device/traffic/sda7.png +0 -0
- data/public/images/device/traffic/sda8.png +0 -0
- data/public/images/device/traffic/sda9.png +0 -0
- data/public/images/device/traffic/sdb.png +0 -0
- data/public/images/device/traffic/sdb1.png +0 -0
- data/public/images/device/traffic/sdh.png +0 -0
- data/public/images/device/traffic/sdh1.png +0 -0
- data/public/images/device/traffic/sdh2.png +0 -0
- data/public/images/device/traffic/sdh3.png +0 -0
- data/public/images/device/traffic/sdh4.png +0 -0
- data/public/images/device/traffic/sr0.png +0 -0
- data/public/images/irqs.png +0 -0
- data/public/images/load.png +0 -0
- data/public/images/memory.png +0 -0
- data/public/images/network/packets/eth0.png +0 -0
- data/public/images/network/packets/lo.png +0 -0
- data/public/images/network/packets/nbr0-nic.png +0 -0
- data/public/images/network/packets/nbr0.png +0 -0
- data/public/images/network/packets/virbr0.png +0 -0
- data/public/images/network/packets/vnet0.png +0 -0
- data/public/images/network/packets/vnet1.png +0 -0
- data/public/images/network/packets/vnet2.png +0 -0
- data/public/images/network/packets/vnet3.png +0 -0
- data/public/images/network/packets/vnet4.png +0 -0
- data/public/images/network/packets/vnet5.png +0 -0
- data/public/images/network/traffic/eth0.png +0 -0
- data/public/images/network/traffic/lo.png +0 -0
- data/public/images/network/traffic/nbr0-nic.png +0 -0
- data/public/images/network/traffic/nbr0.png +0 -0
- data/public/images/network/traffic/virbr0.png +0 -0
- data/public/images/network/traffic/vnet0.png +0 -0
- data/public/images/network/traffic/vnet1.png +0 -0
- data/public/images/network/traffic/vnet2.png +0 -0
- data/public/images/network/traffic/vnet3.png +0 -0
- data/public/images/network/traffic/vnet4.png +0 -0
- data/public/images/network/traffic/vnet5.png +0 -0
- data/public/images/processes.png +0 -0
- data/public/images/users.png +0 -0
- data/public/script/table_filter.js +1217 -0
- data/public/style/default.css +28 -0
- data/test/collectd/interface/config_test.rb +9 -0
- data/test/collectd/interface/service_config_test.rb +26 -0
- data/test/collectd/interface/service_data_test.rb +46 -0
- data/test/start.rb +3 -0
- data/views/graph_header.erb +13 -4
- data/views/graphs/device/ops.erb +37 -0
- data/views/graphs/device/time.erb +37 -0
- data/views/graphs/device/traffic.erb +38 -0
- data/views/graphs/{irq.erb.disabled → irqs.erb} +8 -8
- data/views/graphs/network/packets.erb +35 -0
- data/views/graphs/network/traffic.erb +35 -0
- data/views/graphs/{users.erb.disabled → users.erb} +0 -0
- data/views/report.erb +32 -14
- data/views/reports/open-files/local.erb +62 -0
- data/views/reports/{processes-cpu-usage.erb → processes.erb} +0 -0
- data/views/reports/{system-sockets.erb → sockets.erb} +0 -0
- data/views/reports/{disk-free.erb → storage.erb} +1 -1
- data/views/template/options/graph.erb +1 -1
- metadata +98 -30
- data/public/images/cpus.svg +0 -946
- data/public/images/disk-traffic-root.png +0 -0
- data/public/images/disk-traffic-srv.png +0 -0
- data/public/images/disk-traffic-tmp.png +0 -0
- data/public/images/disk-traffic-var.png +0 -0
- data/public/images/irq.png +0 -0
- data/public/images/load.svg +0 -638
- data/public/images/memory.svg +0 -741
- data/public/images/network-eth0.png +0 -0
- data/public/images/network-eth0.svg +0 -609
- data/public/images/network-lo.png +0 -0
- data/public/images/network-lo.svg +0 -644
- data/public/images/processes.svg +0 -832
- data/views/graphs/disk-traffic-root.erb +0 -24
- data/views/graphs/disk-traffic-srv.erb.disabled +0 -25
- data/views/graphs/disk-traffic-tmp.erb.disabled +0 -24
- data/views/graphs/disk-traffic-var.erb.disabled +0 -25
- data/views/graphs/network-eth0.erb +0 -23
- data/views/graphs/network-lo.erb +0 -23
- data/views/reports/list-open-files-lustre.erb.disabled +0 -44
- data/views/reports/list-open-files-tmp.erb +0 -44
data/public/style/default.css
CHANGED
@@ -261,6 +261,34 @@ tbody tr:nth-child(odd) th {
|
|
261
261
|
background-color: #f5f5f5;
|
262
262
|
}
|
263
263
|
|
264
|
+
table input {
|
265
|
+
width:100%;
|
266
|
+
font-size: 12px;
|
267
|
+
text-align: left;
|
268
|
+
vertical-align:middle;
|
269
|
+
cursor:pointer;
|
270
|
+
border: 1px solid #ccc;
|
271
|
+
-webkit-border-radius: 3px;
|
272
|
+
-moz-border-radius: 3px;
|
273
|
+
border-radius: 3px;
|
274
|
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
275
|
+
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
276
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
277
|
+
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
|
278
|
+
-moz-transition: border linear 0.2s, box-shadow linear 0.2s;
|
279
|
+
-ms-transition: border linear 0.2s, box-shadow linear 0.2s;
|
280
|
+
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
|
281
|
+
transition: border linear 0.2s, box-shadow linear 0.2s;
|
282
|
+
}
|
283
|
+
|
284
|
+
table input:focus {
|
285
|
+
border-color: rgba(82, 168, 236, 0.8);
|
286
|
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
|
287
|
+
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
|
288
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
|
289
|
+
outline: 0;
|
290
|
+
outline: thin dotted \9;
|
291
|
+
}
|
264
292
|
|
265
293
|
|
266
294
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rack/test'
|
3
|
+
require 'pp'
|
4
|
+
require 'collectd/interface/service'
|
5
|
+
|
6
|
+
class TestCollectdInterfaceService < Test::Unit::TestCase
|
7
|
+
include Rack::Test::Methods
|
8
|
+
def app
|
9
|
+
Collectd::Interface::Service
|
10
|
+
end
|
11
|
+
def test_config
|
12
|
+
%w(
|
13
|
+
root
|
14
|
+
rrd_path
|
15
|
+
public_folder
|
16
|
+
graphs
|
17
|
+
data
|
18
|
+
reports
|
19
|
+
).each do |config|
|
20
|
+
get "/config/#{config}"
|
21
|
+
assert last_response.ok?
|
22
|
+
end
|
23
|
+
get "/config/foo"
|
24
|
+
assert last_response.status == 404
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rack/test'
|
3
|
+
require 'pp'
|
4
|
+
require 'collectd/interface/service'
|
5
|
+
|
6
|
+
class TestCollectdInterfaceService < Test::Unit::TestCase
|
7
|
+
include Rack::Test::Methods
|
8
|
+
def app
|
9
|
+
Collectd::Interface::Service
|
10
|
+
end
|
11
|
+
def test_service_data_selector
|
12
|
+
get "/data"
|
13
|
+
assert last_response.ok?
|
14
|
+
get "/data?format=json"
|
15
|
+
assert last_response.ok?
|
16
|
+
assert last_response.header['Content-Type'] =~ /^application\/json.*/
|
17
|
+
get "/data?format=text"
|
18
|
+
assert last_response.ok?
|
19
|
+
assert last_response.header['Content-Type'] =~ /^text\/plain.*/
|
20
|
+
get "/data/"
|
21
|
+
follow_redirect!
|
22
|
+
assert last_response.ok?
|
23
|
+
end
|
24
|
+
def test_service_data_sources
|
25
|
+
_source = '/data/load/load/midterm'
|
26
|
+
[
|
27
|
+
_source,
|
28
|
+
"#{_source}?last=1w",
|
29
|
+
"#{_source}?last=1d",
|
30
|
+
"#{_source}?last=30",
|
31
|
+
"#{_source}?last=3m",
|
32
|
+
"#{_source}?last=0",
|
33
|
+
"#{_source}?last=1d&function=last",
|
34
|
+
"#{_source}?last=1d&resolution=30s",
|
35
|
+
].each do |query|
|
36
|
+
get query
|
37
|
+
assert last_response.ok?
|
38
|
+
end
|
39
|
+
get "#{_source}?format=json"
|
40
|
+
assert last_response.ok?
|
41
|
+
assert last_response.header['Content-Type'] =~ /^application\/json.*/
|
42
|
+
get "#{_source}?format=text"
|
43
|
+
assert last_response.ok?
|
44
|
+
assert last_response.header['Content-Type'] =~ /^text\/plain.*/
|
45
|
+
end
|
46
|
+
end
|
data/test/start.rb
ADDED
data/views/graph_header.erb
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
rrdtool graph <%= @target %> \
|
2
|
-
|
3
|
-
--end <%= @end %>
|
4
|
-
--
|
5
|
-
--
|
2
|
+
--imgformat <%= @type.upcase %> \
|
3
|
+
--end <%= @end %> \
|
4
|
+
--start=<%= @start %> \
|
5
|
+
--grid-dash 1:1 \
|
6
|
+
--width=<%= @width %> \
|
7
|
+
--height=<%= @height %> \
|
8
|
+
<% if @graph_only %>
|
9
|
+
--full-size-mode \
|
10
|
+
--only-graph \
|
11
|
+
<% end %>
|
12
|
+
--tabwidth=10 \
|
13
|
+
--border=0 \
|
14
|
+
--color=BACK#FFFFFF \
|
6
15
|
<%= yield %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%# Return a list of all devices this plug-in can answer for %>
|
2
|
+
<% if @config %>
|
3
|
+
<% __supports = Array.new %>
|
4
|
+
<% __path = @rrd_path %>
|
5
|
+
<% Dir["#{__path}/disk*/disk_ops.rrd"].each do |file| %>
|
6
|
+
<% __supports << file.gsub(%r<#{__path}/disk->,'').gsub(/\/disk_ops\.rrd/,'') %>
|
7
|
+
<% end %>
|
8
|
+
<% require 'json' %>
|
9
|
+
<%= JSON.generate(__supports.sort)%>
|
10
|
+
<%# Return the RRD graph parameters to generate the image %>
|
11
|
+
<% else %>
|
12
|
+
<% __mount_point = `df -l | grep "/dev/#{@param}"`.split[-1] %>
|
13
|
+
<% __title = "Disk IO Opperations on /dev/#{@param}" %>
|
14
|
+
--title='<%= __title %>' \
|
15
|
+
--vertical-label="Per Second" \
|
16
|
+
--alt-autoscale-max \
|
17
|
+
DEF:read_av=<%= @rrd_path %>disk-<%= @param %>/disk_ops.rrd:read:AVERAGE \
|
18
|
+
DEF:read_min=<%= @rrd_path %>disk-<%= @param %>/disk_ops.rrd:read:MIN \
|
19
|
+
DEF:read_max=<%= @rrd_path %>disk-<%= @param %>/disk_ops.rrd:read:MAX \
|
20
|
+
DEF:write_av=<%= @rrd_path %>disk-<%= @param %>/disk_ops.rrd:write:AVERAGE \
|
21
|
+
DEF:write_min=<%= @rrd_path %>disk-<%= @param %>/disk_ops.rrd:write:MIN \
|
22
|
+
DEF:write_max=<%= @rrd_path %>disk-<%= @param %>/disk_ops.rrd:write:MAX \
|
23
|
+
AREA:read_max<%= @color[:green_light] %> \
|
24
|
+
AREA:read_min#ffffff \
|
25
|
+
AREA:write_max<%= @color[:blue_light] %> \
|
26
|
+
AREA:write_min#ffffff \
|
27
|
+
LINE1:read_av<%= @color[:green_dark] %>:"Read\t\t\t\t\t\t" \
|
28
|
+
GPRINT:read_min:MIN:"Min. %4.0lf" \
|
29
|
+
GPRINT:read_av:AVERAGE:"Avg. %4.0lf" \
|
30
|
+
GPRINT:read_max:MAX:"Max. %4.0lf" \
|
31
|
+
GPRINT:read_av:LAST:"Last %4.0lf" \
|
32
|
+
LINE1:write_av<%= @color[:blue_dark] %>:"Write\t\t\t\t\t" \
|
33
|
+
GPRINT:write_min:MIN:"Min. %4.0lf" \
|
34
|
+
GPRINT:write_av:AVERAGE:"Avg. %4.0lf" \
|
35
|
+
GPRINT:write_max:MAX:"Max. %4.0lf" \
|
36
|
+
GPRINT:write_av:LAST:"Last %4.0lf" \
|
37
|
+
<% end %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%# Return a list of all devices this plug-in can answer for %>
|
2
|
+
<% if @config %>
|
3
|
+
<% __supports = Array.new %>
|
4
|
+
<% __path = @rrd_path %>
|
5
|
+
<% Dir["#{__path}/disk*/disk_time.rrd"].each do |file| %>
|
6
|
+
<% __supports << file.gsub(%r<#{__path}/disk->,'').gsub(/\/disk_time\.rrd/,'') %>
|
7
|
+
<% end %>
|
8
|
+
<% require 'json' %>
|
9
|
+
<%= JSON.generate(__supports.sort)%>
|
10
|
+
<%# Return the RRD graph parameters to generate the image %>
|
11
|
+
<% else %>
|
12
|
+
<% __mount_point = `df -l | grep "/dev/#{@param}"`.split[-1] %>
|
13
|
+
<% __title = "Disk Time per Opperation on /dev/#{@param}" %>
|
14
|
+
--title='<%= __title %>' \
|
15
|
+
--vertical-label="Avg. Time/Ops" \
|
16
|
+
--alt-autoscale-max \
|
17
|
+
DEF:read_av=<%= @rrd_path %>disk-<%= @param %>/disk_time.rrd:read:AVERAGE \
|
18
|
+
DEF:read_min=<%= @rrd_path %>disk-<%= @param %>/disk_time.rrd:read:MIN \
|
19
|
+
DEF:read_max=<%= @rrd_path %>disk-<%= @param %>/disk_time.rrd:read:MAX \
|
20
|
+
DEF:write_av=<%= @rrd_path %>disk-<%= @param %>/disk_time.rrd:write:AVERAGE \
|
21
|
+
DEF:write_min=<%= @rrd_path %>disk-<%= @param %>/disk_time.rrd:write:MIN \
|
22
|
+
DEF:write_max=<%= @rrd_path %>disk-<%= @param %>/disk_time.rrd:write:MAX \
|
23
|
+
AREA:read_max<%= @color[:green_light] %> \
|
24
|
+
AREA:read_min#ffffff \
|
25
|
+
AREA:write_max<%= @color[:blue_light] %> \
|
26
|
+
AREA:write_min#ffffff \
|
27
|
+
LINE1:read_av<%= @color[:green_dark] %>:"Read\t\t\t\t\t" \
|
28
|
+
GPRINT:read_min:MIN:"Min. %4.0lf%ss" \
|
29
|
+
GPRINT:read_av:AVERAGE:"Avg. %4.0lf%ss" \
|
30
|
+
GPRINT:read_max:MAX:"Max. %4.0lf%ss" \
|
31
|
+
GPRINT:read_av:LAST:"Last %4.0lf%ss" \
|
32
|
+
LINE1:write_av<%= @color[:blue_dark] %>:"Write\t\t\t\t" \
|
33
|
+
GPRINT:write_min:MIN:"Min. %4.0lf%ss" \
|
34
|
+
GPRINT:write_av:AVERAGE:"Avg. %4.0lf%ss" \
|
35
|
+
GPRINT:write_max:MAX:"Max. %4.0lf%ss" \
|
36
|
+
GPRINT:write_av:LAST:"Last %4.0lf%ss" \
|
37
|
+
<% end %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<%# Return a list of all devices this plug-in can answer for %>
|
2
|
+
<% if @config %>
|
3
|
+
<% __supports = Array.new %>
|
4
|
+
<% __path = @rrd_path %>
|
5
|
+
<% Dir["#{__path}/disk*/disk_octets.rrd"].each do |file| %>
|
6
|
+
<% __supports << file.gsub(%r<#{__path}/disk->,'').gsub(/\/disk_octets\.rrd/,'') %>
|
7
|
+
<% end %>
|
8
|
+
<% require 'json' %>
|
9
|
+
<%= JSON.generate(__supports.sort)%>
|
10
|
+
<%# Return the RRD graph parameters to generate the image %>
|
11
|
+
<% else %>
|
12
|
+
<% __mount_point = `df -l | grep "/dev/#{@param}"`.split[-1] %>
|
13
|
+
<% __title = "Disk Traffic /dev/#{@param}" %>
|
14
|
+
<% __title << " at #{__mount_point}" unless __mount_point.nil? %>
|
15
|
+
--title='<%= __title %>' \
|
16
|
+
--vertical-label="Bytes" \
|
17
|
+
--alt-autoscale-max --base 1024 \
|
18
|
+
DEF:read_av=<%= @rrd_path %>disk-<%= @param %>/disk_octets.rrd:read:AVERAGE \
|
19
|
+
DEF:read_min=<%= @rrd_path %>disk-<%= @param %>/disk_octets.rrd:read:MIN \
|
20
|
+
DEF:read_max=<%= @rrd_path %>disk-<%= @param %>/disk_octets.rrd:read:MAX \
|
21
|
+
DEF:write_av=<%= @rrd_path %>disk-<%= @param %>/disk_octets.rrd:write:AVERAGE \
|
22
|
+
DEF:write_min=<%= @rrd_path %>disk-<%= @param %>/disk_octets.rrd:write:MIN \
|
23
|
+
DEF:write_max=<%= @rrd_path %>disk-<%= @param %>/disk_octets.rrd:write:MAX \
|
24
|
+
AREA:read_max<%= @color[:green_light] %> \
|
25
|
+
AREA:read_min#ffffff \
|
26
|
+
AREA:write_max<%= @color[:blue_light] %> \
|
27
|
+
AREA:write_min#ffffff \
|
28
|
+
LINE1:read_av<%= @color[:green_dark] %>:"Read\t\t\t" \
|
29
|
+
GPRINT:read_min:MIN:"Min. %3.0lf%sB" \
|
30
|
+
GPRINT:read_av:AVERAGE:"Avg. %3.0lf%sB" \
|
31
|
+
GPRINT:read_max:MAX:"Max. %3.0lf%sB" \
|
32
|
+
GPRINT:read_av:LAST:"Last %3.0lf%sB" \
|
33
|
+
LINE1:write_av<%= @color[:blue_dark] %>:"Write\t\t" \
|
34
|
+
GPRINT:write_min:MIN:"Min. %3.0lf%sB" \
|
35
|
+
GPRINT:write_av:AVERAGE:"Avg. %3.0lf%sB" \
|
36
|
+
GPRINT:write_max:MAX:"Max. %3.0lf%sB" \
|
37
|
+
GPRINT:write_av:LAST:"Last %3.0lf%sB" \
|
38
|
+
<% end %>
|
@@ -22,14 +22,14 @@ CDEF:irqs_avg=<%= (files.map { |f| "irq_" + i_num(f) + "_avg,UN,0," "irq_" + i_
|
|
22
22
|
CDEF:irqs_min=<%= (files.map { |f| "irq_" + i_num(f) + "_min,UN,0," "irq_" + i_num(f) + "_min,IF" }).join(',') %>,<%= tail.join(',') %> \
|
23
23
|
AREA:irqs_max<%= @color[:blue_light] %> \
|
24
24
|
AREA:irqs_min#ffffff \
|
25
|
-
LINE1:irqs_avg<%= @color[:blue_dark] %>:"Sum \t\t\t\t\t\t\t\t\t\t
|
26
|
-
GPRINT:irqs_max:MIN:"Min. %
|
27
|
-
GPRINT:irqs_avg:AVERAGE:"Avg. %
|
28
|
-
GPRINT:irqs_max:MAX:"Max. %
|
25
|
+
LINE1:irqs_avg<%= @color[:blue_dark] %>:"Sum \t\t\t\t\t\t\t\t\t\t" \
|
26
|
+
GPRINT:irqs_max:MIN:"Min. %7.0lf" \
|
27
|
+
GPRINT:irqs_avg:AVERAGE:"Avg. %7.0lf" \
|
28
|
+
GPRINT:irqs_max:MAX:"Max. %7.0lf" \
|
29
29
|
<% files.each do |file| %>
|
30
30
|
<% i = i_num(file) %>
|
31
|
-
LINE1:irq_<%= i %>_max#ffffff00:"IRQ <%= i %> \t\t\t\t\t\t\t\t\t\t
|
32
|
-
GPRINT:irq_<%= i %>_min:MIN:"Min. %
|
33
|
-
GPRINT:irq_<%= i %>_avg:AVERAGE:"Avg. %
|
34
|
-
GPRINT:irq_<%= i %>_max:MAX:"Max. %
|
31
|
+
LINE1:irq_<%= i %>_max#ffffff00:"IRQ <%= i %> \t\t\t\t\t\t\t\t\t\t" \
|
32
|
+
GPRINT:irq_<%= i %>_min:MIN:"Min. %7.0lf" \
|
33
|
+
GPRINT:irq_<%= i %>_avg:AVERAGE:"Avg. %7.0lf" \
|
34
|
+
GPRINT:irq_<%= i %>_max:MAX:"Max. %7.0lf" \
|
35
35
|
<% end %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<%# Return a list of all network interfaces this plug-in can answer for %>
|
2
|
+
<% if @config %>
|
3
|
+
<% __supports = Array.new%>
|
4
|
+
<% __path = File.join(@rrd_path,'interface')%>
|
5
|
+
<% Dir["#{__path}/if_packets*.rrd"].each do |file| %>
|
6
|
+
<% __supports << file.gsub(/\.rrd/,'').gsub(%r<#{__path}/if_packets->,'') %>
|
7
|
+
<% end %>
|
8
|
+
<% require 'json' %>
|
9
|
+
<%= JSON.generate(__supports.sort)%>
|
10
|
+
<%# Return the RRD graph parameters to generate the image %>
|
11
|
+
<% else %>
|
12
|
+
--title='Network Packets Interface "<%= @param %>"' \
|
13
|
+
--vertical-label="Packets per Second" \
|
14
|
+
--alt-autoscale-max \
|
15
|
+
DEF:rx_av=<%= @rrd_path %>/interface/if_packets-<%= @param %>.rrd:rx:AVERAGE \
|
16
|
+
DEF:rx_min=<%= @rrd_path %>/interface/if_packets-<%= @param %>.rrd:rx:MIN \
|
17
|
+
DEF:rx_max=<%= @rrd_path %>/interface/if_packets-<%= @param %>.rrd:rx:MAX \
|
18
|
+
DEF:tx_av=<%= @rrd_path %>/interface/if_packets-<%= @param %>.rrd:tx:AVERAGE \
|
19
|
+
DEF:tx_min=<%= @rrd_path %>/interface/if_packets-<%= @param %>.rrd:tx:MIN \
|
20
|
+
DEF:tx_max=<%= @rrd_path %>/interface/if_packets-<%= @param %>.rrd:tx:MAX \
|
21
|
+
AREA:rx_max#00F00022 \
|
22
|
+
AREA:rx_min#ffffff \
|
23
|
+
AREA:tx_max#0000ff22 \
|
24
|
+
AREA:tx_min#ffffff \
|
25
|
+
LINE1:rx_av#00f000aa:"Receive " \
|
26
|
+
GPRINT:rx_min:MIN:"Min. %3.0lf%s" \
|
27
|
+
GPRINT:rx_av:AVERAGE:"Avg. %3.0lf%s" \
|
28
|
+
GPRINT:rx_max:MAX:"Max. %3.0lf%s" \
|
29
|
+
GPRINT:rx_av:LAST:"Last %3.0lf%s" \
|
30
|
+
LINE1:tx_av#0000ffaa:"Transmit" \
|
31
|
+
GPRINT:tx_min:MIN:"Min. %3.0lf%s" \
|
32
|
+
GPRINT:tx_av:AVERAGE:"Avg. %3.0lf%s" \
|
33
|
+
GPRINT:tx_max:MAX:"Max. %3.0lf%s" \
|
34
|
+
GPRINT:tx_av:LAST:"Last %3.0lf%s"
|
35
|
+
<% end %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<%# Return a list of all network interfaces this plug-in can answer for %>
|
2
|
+
<% if @config %>
|
3
|
+
<% __supports = Array.new%>
|
4
|
+
<% __path = File.join(@rrd_path,'interface')%>
|
5
|
+
<% Dir["#{__path}/if_octets*.rrd"].each do |file| %>
|
6
|
+
<% __supports << file.gsub(/\.rrd/,'').gsub(%r<#{__path}/if_octets->,'') %>
|
7
|
+
<% end %>
|
8
|
+
<% require 'json' %>
|
9
|
+
<%= JSON.generate(__supports.sort)%>
|
10
|
+
<%# Return the RRD graph parameters to generate the image %>
|
11
|
+
<% else %>
|
12
|
+
--title='Network Traffic Interface "<%= @param %>"' \
|
13
|
+
--vertical-label="Bytes per Second" \
|
14
|
+
--alt-autoscale-max \
|
15
|
+
DEF:rx_av=<%= @rrd_path %>/interface/if_octets-<%= @param %>.rrd:rx:AVERAGE \
|
16
|
+
DEF:rx_min=<%= @rrd_path %>/interface/if_octets-<%= @param %>.rrd:rx:MIN \
|
17
|
+
DEF:rx_max=<%= @rrd_path %>/interface/if_octets-<%= @param %>.rrd:rx:MAX \
|
18
|
+
DEF:tx_av=<%= @rrd_path %>/interface/if_octets-<%= @param %>.rrd:tx:AVERAGE \
|
19
|
+
DEF:tx_min=<%= @rrd_path %>/interface/if_octets-<%= @param %>.rrd:tx:MIN \
|
20
|
+
DEF:tx_max=<%= @rrd_path %>/interface/if_octets-<%= @param %>.rrd:tx:MAX \
|
21
|
+
AREA:rx_max#00F00022 \
|
22
|
+
AREA:rx_min#ffffff \
|
23
|
+
AREA:tx_max#0000ff22 \
|
24
|
+
AREA:tx_min#ffffff \
|
25
|
+
LINE1:rx_av#00f000aa:"Receive " \
|
26
|
+
GPRINT:rx_min:MIN:"Min. %3.0lf%sb" \
|
27
|
+
GPRINT:rx_av:AVERAGE:"Avg. %3.0lf%sb" \
|
28
|
+
GPRINT:rx_max:MAX:"Max. %3.0lf%sb" \
|
29
|
+
GPRINT:rx_av:LAST:"Last %3.0lf%sb" \
|
30
|
+
LINE1:tx_av#0000ffaa:"Transmit" \
|
31
|
+
GPRINT:tx_min:MIN:"Min. %3.0lf%sb" \
|
32
|
+
GPRINT:tx_av:AVERAGE:"Avg. %3.0lf%sb" \
|
33
|
+
GPRINT:tx_max:MAX:"Max. %3.0lf%sb" \
|
34
|
+
GPRINT:tx_av:LAST:"Last %3.0lf%sb"
|
35
|
+
<% end %>
|
File without changes
|
data/views/report.erb
CHANGED
@@ -1,17 +1,35 @@
|
|
1
1
|
<ul style='list-style-type:none; padding-left:0'>
|
2
|
-
<%
|
3
|
-
|
4
|
-
|
5
|
-
<%=
|
6
|
-
|
7
|
-
<a href="<%= url %>"><%= url %></a>
|
8
|
-
</li>
|
9
|
-
<% end %>
|
10
|
-
<% else %>
|
11
|
-
<li>
|
12
|
-
<%= erb("/reports/#{@display}".to_sym)%>
|
13
|
-
<% url = "/report/#{@display}?format=json" %>
|
14
|
-
<a href="<%= url%>"><%= url %></a>
|
15
|
-
</li>
|
2
|
+
<% @reports_selected.each_pair do |path,html| %>
|
3
|
+
<li>
|
4
|
+
<%= html %>
|
5
|
+
<a href="<%= path %>"><%= path %></a>
|
6
|
+
</li>
|
16
7
|
<% end %>
|
17
8
|
</ul>
|
9
|
+
<% if @reports_selected.length < 2 %>
|
10
|
+
<script src="script/table_filter.js" type="text/javascript"></script>
|
11
|
+
<script language="javascript" type="text/javascript">
|
12
|
+
var tableFilters = {
|
13
|
+
btn: true,
|
14
|
+
loader: true,
|
15
|
+
display_all_text: "[ Show all ]",
|
16
|
+
loader_text: "Filtering...",
|
17
|
+
btn_reset_text: "Clear",
|
18
|
+
btn_reset: true,
|
19
|
+
}
|
20
|
+
|
21
|
+
var elems = document.getElementsByTagName('div'),i;
|
22
|
+
for (i in elems)
|
23
|
+
{
|
24
|
+
if(elems[i].className == "content")
|
25
|
+
{
|
26
|
+
var tables = elems[i].getElementsByTagName("table"),k;
|
27
|
+
for(k in tables)
|
28
|
+
{
|
29
|
+
tables[k].id="table"+k+"";
|
30
|
+
setFilterGrid(tables[k].id,0,tableFilters);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
</script>
|
35
|
+
<% end %>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<% if @config %>
|
2
|
+
<% __mounts = Array.new %>
|
3
|
+
<% __devices = `df -l | grep '^/dev/'` %>
|
4
|
+
<% __devices.split("\n").each do |dev| %>
|
5
|
+
<% __mount = dev.split(' ')[-1] %>
|
6
|
+
<% if __mount == '/' %>
|
7
|
+
<% __mounts << 'root' %>
|
8
|
+
<% else %>
|
9
|
+
<% __mounts << __mount.gsub(/^\//,'') %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<%= JSON.generate(__mounts) %>
|
13
|
+
<% else %>
|
14
|
+
<% if @param == 'root' %>
|
15
|
+
<% __path = '/' %>
|
16
|
+
<% else %>
|
17
|
+
<% __path = "/#{@param}" %>
|
18
|
+
<% end %>
|
19
|
+
<% __content = `lsof -u ^root -S2 #{__path} | tr -s ' ' | cut -d' ' -f2-4,9-` %>
|
20
|
+
<% if @type == 'text' %>
|
21
|
+
<%= __content %>
|
22
|
+
<% elsif @type == 'json' %>
|
23
|
+
<% require 'json' %>
|
24
|
+
<% __struct = Array.new %>
|
25
|
+
<% __content = __content.split("\n")[1..-1] %>
|
26
|
+
<% __keys = ['pid','user','state','file'] %>
|
27
|
+
<% unless __content.empty? %>
|
28
|
+
<% __content.each do |file| %>
|
29
|
+
<% file = file.split %>
|
30
|
+
<% values = file[0..2] %>
|
31
|
+
<% values << file[3..-1].join(' ') %>
|
32
|
+
<% __struct << Hash[*__keys.zip(values).flatten] %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
<%= JSON.pretty_generate __struct %>
|
36
|
+
<% else %>
|
37
|
+
<div style="font-size:160%"><strong>Open Files in <%= __path %></strong></div>
|
38
|
+
<table>
|
39
|
+
<thead>
|
40
|
+
<tr>
|
41
|
+
<td>Process ID</td>
|
42
|
+
<td>User</td>
|
43
|
+
<td>State</td>
|
44
|
+
<td>File</td>
|
45
|
+
</tr>
|
46
|
+
</thead>
|
47
|
+
<tbody>
|
48
|
+
<% if __content.empty? %>
|
49
|
+
<tr><td>none</td><td>none</td><td>none</td><td>none</td></tr>
|
50
|
+
<% else %>
|
51
|
+
<% __content.split("\n")[1..-1].each do |file| %>
|
52
|
+
<% file = file.split%>
|
53
|
+
<tr>
|
54
|
+
<td><%= file[0..2].join('</td><td>') %></td>
|
55
|
+
<td><span style="font-size:80%"><%= file[3..-1].join(' ')%></span></td>
|
56
|
+
</tr>
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
59
|
+
</tbody>
|
60
|
+
</table>
|
61
|
+
<% end %>
|
62
|
+
<% end %>
|
File without changes
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<ul>
|
2
2
|
<li>
|
3
3
|
<div class="label">Select graphs to display:</div>
|
4
|
-
<select multiple="yes" size="
|
4
|
+
<select multiple="yes" size="6" name='display[]'>
|
5
5
|
<option value='all'>all</option>
|
6
6
|
<% @graphs.keys.sort.each do |name| %>
|
7
7
|
<option value='<%= name %>'><%= name %></option>
|