Module: ZabbixRubyClient::Plugins::Who

Extended by:
Who
Included in:
Who
Defined in:
lib/zabbix-ruby-client/plugins/who.rb

Instance Method Summary collapse

Instance Method Details

#collect(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/zabbix-ruby-client/plugins/who.rb', line 8

def collect(*args)
  host = args[0]
  who = get_who
  if $?.to_i != 0
    Log.warn "Are you running on ubuntu ?"
    return []
  end
  time = Time.now.to_i
  back = []
  back << "#{host} who[total] #{time} #{who}"
  return back
end

#get_whoObject



21
22
23
24
# File 'lib/zabbix-ruby-client/plugins/who.rb', line 21

def get_who
  who = `who`
  who.each_line.count
end