Sha256: 638426565d57c811719bb9f57c0a68b96a57c267f1e68565b9be644542ac9086

Contents?: true

Size: 553 Bytes

Versions: 5

Compression:

Stored size: 553 Bytes

Contents

class ZabbixRubyClient
  module Plugins
    module Who
      extend self

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

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

    end
  end
end

ZabbixRubyClient::Plugins.register('who', ZabbixRubyClient::Plugins::Who)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zabbix-ruby-client-0.0.15 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.14 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.13 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.12 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.11 lib/zabbix-ruby-client/plugins/who.rb