Sha256: b22802409c00015e74b8d2b1d0d7691766d57d16d582ce36f10762c9e5e9e599

Contents?: true

Size: 852 Bytes

Versions: 3

Compression:

Stored size: 852 Bytes

Contents

require "zabbix-ruby-client/logger"

module ZabbixRubyClient
  module PluginBase
    extend self

    def httprequest(url)
    end

    def perform(command)
    end

    def getline(file, pattern=false)
      if File.readable? file
        File.open(file,'r') do |f|
          f.each do |l|
            line = l.strip
            if pattern
              if Regexp.new(pattern).match line
                Log.debug "File #{file}: #{line}"
                return line
              end
            else
              return line
            end
          end
        end
        Log.warn "File #{file}: pattern \"#{pattern}\" not found."
        false
      else
        if File.file? file
          Log.error "File not readable: #{file}"
        else
          Log.error "File not found: #{file}"
        end
        false
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zabbix-ruby-client-0.0.20 lib/zabbix-ruby-client/plugin_base.rb
zabbix-ruby-client-0.0.19 lib/zabbix-ruby-client/plugin_base.rb
zabbix-ruby-client-0.0.18 lib/zabbix-ruby-client/plugin_base.rb