Sha256: 651544bd0644374bd0c09c1518b809bf22ce89e1db14942f91fdd7262a0ce27d

Contents?: true

Size: 588 Bytes

Versions: 11

Compression:

Stored size: 588 Bytes

Contents

require "zabbix-ruby-client/logger"

module ZabbixRubyClient
  module Plugins
    module Who
      extend self

      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

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

    end
  end
end

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
zabbix-ruby-client-0.1.2 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.1.1 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.1.0 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.23 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.22 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.21 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.20 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.19 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.18 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.17 lib/zabbix-ruby-client/plugins/who.rb
zabbix-ruby-client-0.0.16 lib/zabbix-ruby-client/plugins/who.rb