city-watch 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/city_watch/watchmen/uptime.rb +17 -0
- data/lib/city_watch/watchmen.rb +1 -0
- data/lib/version.rb +1 -1
- metadata +3 -2
@@ -0,0 +1,17 @@
|
|
1
|
+
class Uptime
|
2
|
+
|
3
|
+
include Watchman
|
4
|
+
|
5
|
+
def self.data
|
6
|
+
out = {}
|
7
|
+
out[:uptime], out[:idle] = File.read('/proc/uptime').strip.split.map {|t| Float(t) }
|
8
|
+
base = out.dup
|
9
|
+
[[:minutes,Proc.new{|t| t / 60 }],[:hours,Proc.new{|t| t / (60*60) }],[:days,Proc.new{|t| t / (60*60*24) }]].each do |(id,func)|
|
10
|
+
base.each do |k,v|
|
11
|
+
out["#{k.to_s}_#{id.to_s}".to_sym] = func.call(v).round(2)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
out.merge({:summary => [:uptime_days]})
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/lib/city_watch/watchmen.rb
CHANGED
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: city-watch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- John Bragg
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2013-02-
|
13
|
+
date: 2013-02-12 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: redis
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- lib/city_watch/watchmen/server_load.rb
|
149
149
|
- lib/city_watch/watchmen/sysinfo.rb
|
150
150
|
- lib/city_watch/watchmen/unicorns.rb
|
151
|
+
- lib/city_watch/watchmen/uptime.rb
|
151
152
|
- lib/version.rb
|
152
153
|
- static/javascripts/city_watch.js
|
153
154
|
- static/javascripts/highlight.pack.js
|