module NewRelicManagement::Notifier

> Notification Methods

Public Instance Methods

add_servers(servers) click to toggle source

> Application-Specific Messages

# File lib/newrelic-management/notifier.rb, line 45
def add_servers(servers)
  servers(servers, 'Adding Server(s) to Alert')
end
msg(message, subtitle = message, title = 'NewRelic Management') click to toggle source

> Primary Notification Message Controller

# File lib/newrelic-management/notifier.rb, line 23
def msg(message, subtitle = message, title = 'NewRelic Management')
  # => Stdout Messages
  terminal_notification(message, subtitle)

  return if Config.silent

  # => Pretty GUI Messages
  osx_notification(message, subtitle, title) if OS.x?
end
osx_notification(message, subtitle, title) click to toggle source

> OS X Cocoa Messages

# File lib/newrelic-management/notifier.rb, line 40
def osx_notification(message, subtitle, title)
  TerminalNotifier.notify(message, title: title, subtitle: subtitle)
end
remove_servers(servers) click to toggle source
# File lib/newrelic-management/notifier.rb, line 49
def remove_servers(servers)
  servers(servers, 'Removing Server(s) from Alert')
end
remove_stale(servers) click to toggle source
# File lib/newrelic-management/notifier.rb, line 53
def remove_stale(servers)
  servers(servers, 'Removing Server(s) from Alert')
end
terminal_notification(message, subtitle = nil) click to toggle source

> Console Messages

# File lib/newrelic-management/notifier.rb, line 34
def terminal_notification(message, subtitle = nil)
  message = "#{subtitle}: #{message}" if subtitle && (message != subtitle)
  puts message
end

Private Instance Methods

servers(servers, subtitle) click to toggle source
# File lib/newrelic-management/notifier.rb, line 57
        def servers(servers, subtitle)
  list = Manager.list_servers
  msg = list.select { |svr| Array(servers).include?(svr[:id]) }.map { |x| x[:name] }

  msg(msg, subtitle)
end