city-watch 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/city_watch/reader/watchman.rb +19 -0
- data/lib/version.rb +1 -1
- data/views/watchmen/CPUUsage/summary.html.erb +3 -4
- metadata +2 -2
@@ -61,6 +61,25 @@ module Reader
|
|
61
61
|
"<img src=\"data:image/png;base64,#{sparkline(dat)}\" alt=\"#{alt}\" title=\"#{alt} max: #{dat.max} min: #{dat.min}\"/>"
|
62
62
|
end
|
63
63
|
|
64
|
+
def sparkline_for(set)
|
65
|
+
dat = get_data_set(set)
|
66
|
+
if dat.length > 1
|
67
|
+
puts dat.inspect
|
68
|
+
require 'base64'
|
69
|
+
require 'city_watch/util/spark_pr'
|
70
|
+
Base64.encode64(Spark.smooth(dat.map {|(tm,val)| val }, :height => 14, :step => 4).to_png).gsub("\n",'')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def sparkline_img_tag_for(set)
|
75
|
+
dat = get_data_set(set)
|
76
|
+
if dat.length > 1
|
77
|
+
"<img src=\"data:image/png;base64,#{sparkline(dat)}\" alt=\"#{set}\" title=\"#{set} max: #{dat.max} min: #{dat.min}\"/>"
|
78
|
+
else
|
79
|
+
""
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
64
83
|
def key(more)
|
65
84
|
"#{key_prefix}::#{more}"
|
66
85
|
end
|
data/lib/version.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
<h4><%=@name%></h4>
|
2
|
-
|
3
|
-
<strong>
|
4
|
-
<strong>
|
5
|
-
<strong>System: </strong><%=@current_data["sys"]%><br/>
|
2
|
+
<strong>User: </strong><%=@current_data["usr"]%> <%=sparkline_img_tag_for(:cpu_user)%><br/>
|
3
|
+
<strong>Idle: </strong><%=@current_data["idle"]%> <%=sparkline_img_tag_for(:cpu_idle)%><br/>
|
4
|
+
<strong>System: </strong><%=@current_data["sys"]%> <%=sparkline_img_tag_for(:cpu_system)%>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: city-watch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|