Class: Opstat::Plugins::Task
- Inherits:
-
Object
- Object
- Opstat::Plugins::Task
- Includes:
- Logging
- Defined in:
- lib/opstat-client/plugins.rb
Instance Attribute Summary collapse
-
#interval ⇒ Object
, :next_run#, :data, :data_sended.
-
#next_run ⇒ Object
, :next_run#, :data, :data_sended.
Instance Method Summary collapse
- #external_plugin_needed? ⇒ Boolean
-
#initialize(name, queue, config) ⇒ Task
constructor
A new instance of Task.
- #parse_and_queue ⇒ Object
Methods included from Logging
#log_level, #oplogger, #preconfig_logger
Constructor Details
#initialize(name, queue, config) ⇒ Task
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/opstat-client/plugins.rb', line 25 def initialize (name, queue, config) @name = name @queue = queue @interval = config['interval'] @interval ||= 60 @data_sended = {} @count_number = 0 #TODO how big it should be @send_number = 0 #TODO how big it should be @log_level = config['log_level'] @run = config['run'] @external_plugin = config['external_plugin'] end |
Instance Attribute Details
#interval ⇒ Object
, :next_run#, :data, :data_sended
23 24 25 |
# File 'lib/opstat-client/plugins.rb', line 23 def interval @interval end |
#next_run ⇒ Object
, :next_run#, :data, :data_sended
23 24 25 |
# File 'lib/opstat-client/plugins.rb', line 23 def next_run @next_run end |
Instance Method Details
#external_plugin_needed? ⇒ Boolean
45 46 47 48 49 50 |
# File 'lib/opstat-client/plugins.rb', line 45 def external_plugin_needed? if @external_plugin.nil? return false end return true end |
#parse_and_queue ⇒ Object
38 39 40 41 42 43 |
# File 'lib/opstat-client/plugins.rb', line 38 def parse_and_queue oplogger.info "collecting stats" report = parse oplogger.debug report @queue.push({ :timestamp => Time.now, :plugin => @name, :data => report, :interval => @interval}) end |