Sha256: 0f6b4bd3aa823341efbf6e740268691ffe260b0aa5474cdf7ebc9f86856de599

Contents?: true

Size: 769 Bytes

Versions: 2

Compression:

Stored size: 769 Bytes

Contents

require "zabbix-ruby-client/logger"

module ZabbixRubyClient
  module Plugins
    module Apt
      extend self

      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

    end
  end
end

ZabbixRubyClient::Plugins.register('apt', ZabbixRubyClient::Plugins::Apt)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zabbix-ruby-client-0.0.17 lib/zabbix-ruby-client/plugins/apt.rb
zabbix-ruby-client-0.0.16 lib/zabbix-ruby-client/plugins/apt.rb