Class: Backup::Notifier::Nagios

Inherits:
Base
  • Object
show all
Defined in:
lib/backup/notifier/nagios.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#max_retries, #message, #model, #on_failure, #on_success, #on_warning, #retry_waitsec

Instance Method Summary collapse

Methods inherited from Base

#perform!

Methods included from Config::Helpers

included

Constructor Details

#initialize(model, &block) ⇒ Nagios

Returns a new instance of Nagios.



27
28
29
30
31
32
33
34
35
36
# File 'lib/backup/notifier/nagios.rb', line 27

def initialize(model, &block)
  super
  instance_eval(&block) if block_given?

  @nagios_host  ||= Config.hostname
  @nagios_port  ||= 5667
  @send_nsca_cfg||= "/etc/nagios/send_nsca.cfg"
  @service_name ||= "Backup #{ model.trigger }"
  @service_host ||= Config.hostname
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Backup::Config::Helpers

Instance Attribute Details

#nagios_hostObject

Host of Nagios server to notify on backup completion.



9
10
11
# File 'lib/backup/notifier/nagios.rb', line 9

def nagios_host
  @nagios_host
end

#nagios_portObject

Port of Nagios server to notify on backup completion.



13
14
15
# File 'lib/backup/notifier/nagios.rb', line 13

def nagios_port
  @nagios_port
end

#send_nsca_cfgObject

Nagios nrpe configuration file.



17
18
19
# File 'lib/backup/notifier/nagios.rb', line 17

def send_nsca_cfg
  @send_nsca_cfg
end

#service_hostObject

Host name in Nagios for the backup check.



25
26
27
# File 'lib/backup/notifier/nagios.rb', line 25

def service_host
  @service_host
end

#service_nameObject

Name of the Nagios service for the backup check.



21
22
23
# File 'lib/backup/notifier/nagios.rb', line 21

def service_name
  @service_name
end