Class: LogStash::Inputs::Perfmon
- Inherits:
-
Base
- Object
- Base
- LogStash::Inputs::Perfmon
- Defined in:
- lib/logstash/inputs/perfmon.rb
Overview
filter
grok {
match => {
"message" => "%{DATESTAMP:Occurred,%NUMBER:PrivilegedTime:float,%NUMBER:ProcessorTime:float,%NUMBER:UserTime:float"
}
}
}
Instance Attribute Summary collapse
-
#counters ⇒ Object
readonly
Returns the value of attribute counters.
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
Instance Method Summary collapse
-
#register ⇒ Object
Registers the plugin with logstash.
-
#run(queue) ⇒ Object
Runs the perf monitor and monitors its output.
-
#teardown ⇒ Object
Cleans up any resources.
Instance Attribute Details
#counters ⇒ Object (readonly)
Returns the value of attribute counters.
30 31 32 |
# File 'lib/logstash/inputs/perfmon.rb', line 30 def counters @counters end |
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
30 31 32 |
# File 'lib/logstash/inputs/perfmon.rb', line 30 def interval @interval end |
Instance Method Details
#register ⇒ Object
Registers the plugin with logstash
50 51 52 53 54 |
# File 'lib/logstash/inputs/perfmon.rb', line 50 def register @host = Socket.gethostname @typeperf = TypeperfWrapper.new(PerfmonProcGetter.new, @interval) @counters.each { |counter| @typeperf.add_counter(counter) } end |
#run(queue) ⇒ Object
Runs the perf monitor and monitors its output
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/logstash/inputs/perfmon.rb', line 57 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) queue << event @logger.debug("Added event to queue: #{event}") end end end |
#teardown ⇒ Object
Cleans up any resources
74 75 76 77 78 |
# File 'lib/logstash/inputs/perfmon.rb', line 74 def teardown @typeperf.stop_monitor @logger.debug("Stopped the perfmon monitor") finished end |