Module: ZabbixRubyClient::Plugins::Apt

Extended by:
Apt
Included in:
Apt
Defined in:
lib/zabbix-ruby-client/plugins/apt.rb

Instance Method Summary collapse

Instance Method Details

#collect(*args) ⇒ Object



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

def collect(*args)
  host = args[0]
  aptcheck = `/usr/lib/update-notifier/apt-check 2>&1`
  if $?.to_i == 0
    security, pending = aptcheck.split(/;/).map(&:to_i)
  else
    Log.warn "Are you running on ubuntu ?"
    return []
  end
  time = Time.now.to_i
  back = []
  back << "#{host} apt[security] #{time} #{security}"
  back << "#{host} apt[pending] #{time} #{pending}"
  back << "#{host} apt[status] #{time} TODO apt #{security}/#{pending}"
  return back
end