Class: Bipbip::Plugin::Gearman
- Inherits:
-
Bipbip::Plugin
- Object
- Bipbip::Plugin
- Bipbip::Plugin::Gearman
- Defined in:
- lib/bipbip/plugin/gearman.rb
Instance Attribute Summary
Attributes inherited from Bipbip::Plugin
#config, #metric_group, #name, #pid
Instance Method Summary collapse
Methods inherited from Bipbip::Plugin
factory, #frequency, #initialize, #interrupt, #interrupted?, #metrics_names, #run, #source_identifier
Methods included from InterruptibleSleep
#interrupt_sleep, #interruptible_sleep
Constructor Details
This class inherits a constructor from Bipbip::Plugin
Instance Method Details
#metrics_schema ⇒ Object
9 10 11 12 13 |
# File 'lib/bipbip/plugin/gearman.rb', line 9 def metrics_schema [ {:name => 'jobs_queued_total', :type => 'gauge', :unit => 'Jobs'}, ] end |
#monitor ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bipbip/plugin/gearman.rb', line 15 def monitor gearman = GearmanServer.new(config['hostname'] + ':' + config['port'].to_s) stats = gearman.status jobs_queued_total = 0 stats.each do |function_name, data| data.each do |queue, stats| jobs_queued_total += queue.to_i end end {:jobs_queued_total => jobs_queued_total} end |