Class: LogStash::Instrument::PeriodicPoller::Os
- Defined in:
- lib/logstash/instrument/periodic_poller/os.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #collect ⇒ Object
- #collect_cgroup ⇒ Object
-
#initialize(metric, options = {}) ⇒ Os
constructor
A new instance of Os.
-
#save_metric(namespace, k, v) ⇒ Object
Recursive function to create the Cgroups values form the created hash.
Methods inherited from Base
Methods included from Util::Loggable
included, #logger, #slow_logger
Constructor Details
#initialize(metric, options = {}) ⇒ Os
Returns a new instance of Os.
7 8 9 |
# File 'lib/logstash/instrument/periodic_poller/os.rb', line 7 def initialize(metric, = {}) super(metric, ) end |
Instance Method Details
#collect ⇒ Object
11 12 13 |
# File 'lib/logstash/instrument/periodic_poller/os.rb', line 11 def collect collect_cgroup end |
#collect_cgroup ⇒ Object
15 16 17 18 19 |
# File 'lib/logstash/instrument/periodic_poller/os.rb', line 15 def collect_cgroup if stats = Cgroup.get save_metric([:os], :cgroup, stats) end end |
#save_metric(namespace, k, v) ⇒ Object
Recursive function to create the Cgroups values form the created hash
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/logstash/instrument/periodic_poller/os.rb', line 22 def save_metric(namespace, k, v) if v.is_a?(Hash) v.each do |new_key, new_value| n = namespace.dup n << k.to_sym save_metric(n, new_key, new_value) end else metric.gauge(namespace, k.to_sym, v) end end |