Sha256: 34eb06d863795fe6056e0ef5f6a6c3a2e4b7dda6ce858a0d196f0974746a7da6
Contents?: true
Size: 837 Bytes
Versions: 7
Compression:
Stored size: 837 Bytes
Contents
#!/usr/bin/env ruby require 'ostruct' module Flapjack class Notifier attr_reader :recipients, :log def initialize(opts={}) @log = opts[:logger] raise "you have to specify a logger" unless @log @recipients = (opts[:recipients] || []) @notifiers = [] if opts[:notifiers] opts[:notifiers].each do |n| @notifiers << n @log.info("using the #{n.class.to_s.split("::").last} notifier") end else @log.warning("there are no notifiers") end end def notify!(result) @notifiers.each do |n| @recipients.each do |recipient| @log.info("Notifying #{recipient.name} via #{n.class} about check #{result.id}") n.notify(:result => result, :who => recipient) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems