Class: Bipbip::Plugin::Postfix

Inherits:
Bipbip::Plugin show all
Defined in:
lib/bipbip/plugin/postfix.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_schemaObject



5
6
7
8
9
# File 'lib/bipbip/plugin/postfix.rb', line 5

def metrics_schema
  [
      {:name => 'mails_queued_total', :type => 'gauge', :unit => 'Mails'},
  ]
end

#monitorObject



11
12
13
14
15
16
# File 'lib/bipbip/plugin/postfix.rb', line 11

def monitor
  queue_counter = /(\d+) Request+s?\.$/.match(postqueue)
  {
      'mails_queued_total' => queue_counter.nil? ? 0 : queue_counter[1].to_i
  }
end