Browse code

Cpu mod: to notify or not

Cinan Rakosnik authored on 16/12/2012 at 00:05:59
Showing 1 changed files
... ...
@@ -9,19 +9,20 @@ module Rubysermon
9 9
 				line =~ /^cpu[\d]/
10 10
 			}.length
11 11
 
12
-			@load = 0
12
+			@cpu_load = 0
13
+			@options = {notify_threshold: @cpu_count*0.90}
13 14
 		end
14 15
 
15
-		def load_options
16
+		def load_options(options)
16 17
 
17 18
 		end
18 19
 
19 20
 		def results
20
-			@load = File.read("/proc/loadavg").split(" ").first.to_s
21
+			@cpu_load = File.read("/proc/loadavg").split(" ").first.to_s
21 22
 		end
22 23
 
23 24
 		def notify?
24
-
25
+			@cpu_load >= @options[:notify_threshold]
25 26
 		end
26 27
 
27 28
 		def y_axis_name