Sha256: 6018a76aed426d04dfa65140f769b570279b99d271fa232022ff1a874c232086

Contents?: true

Size: 897 Bytes

Versions: 3

Compression:

Stored size: 897 Bytes

Contents

require 'faraday'
require 'logger'
require 'json'

require_relative 'utils'
require_relative 'base'

module Kishu
  class Pipeline 

    def initialize
      @conn = Faraday.new(:url => LOGSTASH_HOST)
      # logger = Logger.new(STDOUT)
      # logger.info 
    end

    def is_ready?
      main  = @conn.get do |req|
        req.url '/_node/stats/pipelines/main'
      end
      response = JSON.parse(main.body)
      return nil unless response.dig("pipelines","main","events","out") == 0
    end

    def status?
      main  = @conn.get do |req|
        req.url '/_node/stats/pipelines/main'
        req.options.timeout = 200
      end
      response = JSON.parse(main.body)
      puts "Pipeline Status"
      puts response.dig("pipelines","main","events") 
      puts response.dig("pipelines","main","events","in")
      puts response.dig("pipelines","main","events","out")
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kishu-1.0.4 lib/kishu/pipeline.rb
kishu-1.0.3 lib/kishu/pipeline.rb
kishu-1.0.2 lib/kishu/pipeline.rb