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, #frequency, #metric_group, #name, #tags

Instance Method Summary collapse

Methods inherited from Bipbip::Plugin

factory, factory_from_plugin, #initialize, #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



3
4
5
6
7
# File 'lib/bipbip/plugin/postfix.rb', line 3

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

#monitorObject



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

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