Class: Ganymed::Collector
- Inherits:
-
Object
- Object
- Ganymed::Collector
- Defined in:
- lib/ganymed/collector.rb
Overview
The Collector is a simple thread that polls various system-level metrics that are not pushed to the Processor from third-party applications.
The Collector features a very simple DSL to implement custom collector plugins. Simply create a file with a .rb
file extension and a collect
block:
collect do
File.open('/proc/foobar').each do |line|
parse(line)
end
end
Copy this plugin to a location of your choice and set collector.load_paths
in your configuration to point to the containing directory.
The collector thread will then call this plugin once per resolution tick. See configuration for details.
Custom intervals can also be specified for high frequency sampling:
collect(0.3) do
File.open('/proc/foobar').each do |line|
parse(line)
end
end
Defined Under Namespace
Classes: Plugin
Instance Attribute Summary collapse
-
#config ⇒ Section
readonly
The configuration object.
Instance Method Summary collapse
-
#initialize(config) ⇒ Collector
constructor
Create a new collector instance and initialize all configured collectors.
Constructor Details
#initialize(config) ⇒ Collector
Create a new collector instance and initialize all configured collectors.
46 47 48 49 |
# File 'lib/ganymed/collector.rb', line 46 def initialize(config) @config = config load_collectors end |
Instance Attribute Details
#config ⇒ Section (readonly)
The configuration object.
41 42 43 |
# File 'lib/ganymed/collector.rb', line 41 def config @config end |