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.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#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 [queue] The queue to add new events to.
-
#stop ⇒ Object
Manual way to stop the plugin.
-
#teardown ⇒ Object
Cleans up any resources, called when Ctrl+C used.
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 |
#host ⇒ Object (readonly)
Returns the value of attribute host.
30 31 32 |
# File 'lib/logstash/inputs/perfmon.rb', line 30 def host @host 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
61 62 63 64 |
# 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) ⇒ Object
Runs the perf monitor and monitors its output
- queue
-
The queue to add new events to
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# 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['host'] = @host queue << event @logger.debug("Added event to queue: #{event}") end end end |
#stop ⇒ Object
Manual way to stop the plugin
96 97 98 99 100 |
# 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 ⇒ Object
Cleans up any resources, called when Ctrl+C used
88 89 90 91 92 93 |
# 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 |