class LogStash::Inputs::Perfmon

filter {
  grok {
    match => {
      "message" => "%{DATESTAMP:Occurred},%{NUMBER:PrivilegedTime:float},%{NUMBER:ProcessorTime:float},%{NUMBER:UserTime:float}"
  }
}

}

Attributes

counters[R]
host[R]
interval[R]

Public Instance Methods

register() click to toggle source

Registers the plugin with logstash

# File lib/logstash/inputs/perfmon.rb, line 61
def register
  @typeperf = TypeperfWrapper.new(PerfmonProcGetter.new, @interval)
  @counters.each { |counter| @typeperf.add_counter(counter) }
end
run(queue) click to toggle source

Runs the perf monitor and monitors its output

queue

The queue to add new events to

# File lib/logstash/inputs/perfmon.rb, line 68
def run(queue)
  @typeperf.start_monitor
  
  @logger.debug("Started perfmon monitor")

  while @typeperf.alive?
    data = @typeperf.get_next

    @codec.decode(data) do |event|
      decorate(event)
      
      event.set('host', @host)
      
      queue << event
      @logger.debug("Added event to queue: #{event}")
    end
  end
end
stop() click to toggle source

Manual way to stop the plugin

# File lib/logstash/inputs/perfmon.rb, line 96
def stop
  @logger.debug("Calling stop on logstash-input-perfmon")
  @typeperf.stop_monitor
  @logger.debug("Stopped the perfmon monitor")
end
teardown() click to toggle source

Cleans up any resources, called when Ctrl+C used

# File lib/logstash/inputs/perfmon.rb, line 88
def teardown
  @logger.debug("Calling teardown on logstash-input-perfmon")
  @typeperf.stop_monitor
  @logger.debug("Stopped the perfmon monitor")
  finished
end