Sha256: 4cd099f3d9753ac462d22782896c4a036fc02f7c0225ef1e7b9e345d105cc771

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

require "zabbix-ruby-client/logger"

module ZabbixRubyClient
  module Plugins
    module Who
      extend self
      extend ZabbixRubyClient::PluginBase

      def collect(*args)
        host = args[0]
        who = get_who
        if $?.to_i != 0
          Log.warn "Are you running on ubuntu ?"
          return []
        end
        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

1 entries across 1 versions & 1 rubygems

Version Path
zabbix-ruby-client-0.1.3 lib/zabbix-ruby-client/plugins/who.rb