Class: LS4::StatService
Instance Method Summary
collapse
Methods inherited from Service
init
#ebus_bind!, #ebus_connect, extended
#ebus_all_slots, #ebus_disconnect!
#connect, #ebus_all_slots, #ebus_call_log, #ebus_call_slots, #ebus_signal_error, #ebus_signal_log, #ebus_signal_slots
#call_slot, #signal_slot
Constructor Details
Returns a new instance of StatService.
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/ls4/service/stat.rb', line 34
def initialize
@methods = {}
public_methods.each {|name|
if name =~ /^stat_(.*)$/
@methods[$~[1]] = method(name)
end
}
@start_time = Time.now
end
|
Instance Method Details
#rpc_stat(cmd) ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/ls4/service/stat.rb', line 45
def rpc_stat(cmd)
if m = @methods[cmd]
m.call
else
raise "no such status"
end
end
|
#stat_cs_address ⇒ Object
70
71
72
|
# File 'lib/ls4/service/stat.rb', line 70
def stat_cs_address
ConfigBus.get_cs_address
end
|
#stat_fault ⇒ Object
78
79
80
|
# File 'lib/ls4/service/stat.rb', line 78
def stat_fault
StatBus.fault_info
end
|
#stat_nodes ⇒ Object
74
75
76
|
# File 'lib/ls4/service/stat.rb', line 74
def stat_nodes
StatBus.membership_info
end
|
#stat_pid ⇒ Object
62
63
64
|
# File 'lib/ls4/service/stat.rb', line 62
def stat_pid
Process.pid
end
|
#stat_replset ⇒ Object
82
83
84
|
# File 'lib/ls4/service/stat.rb', line 82
def stat_replset
StatBus.replset_info
end
|
#stat_time ⇒ Object
58
59
60
|
# File 'lib/ls4/service/stat.rb', line 58
def stat_time
Time.now.utc.to_i
end
|
#stat_uptime ⇒ Object
53
54
55
56
|
# File 'lib/ls4/service/stat.rb', line 53
def stat_uptime
uptime = Time.now - @start_time
uptime.to_i
end
|
#stat_version ⇒ Object
66
67
68
|
# File 'lib/ls4/service/stat.rb', line 66
def stat_version
VERSION
end
|