Class: ElasticNotifier::Signal

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_notifier/signal.rb

Direct Known Subclasses

Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(overrides = {}) ⇒ Signal

Returns a new instance of Signal.


5
6
7
8
9
10
11
12
# File 'lib/elastic_notifier/signal.rb', line 5

def initialize(overrides = {})
  @pid = Process.pid
  @hostname = Socket.gethostname
  @ip = find_ip_address
  @timestamp = Time.now.strftime('%Y-%m-%dT%H:%M:%S')
  @program_name = $PROGRAM_NAME
  @overrides = overrides
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.


3
4
5
# File 'lib/elastic_notifier/signal.rb', line 3

def attributes
  @attributes
end

Instance Method Details

#dataObject

Raises:

  • (NotImplementedError)

30
31
32
# File 'lib/elastic_notifier/signal.rb', line 30

def data
  raise NotImplementedError
end

#severityObject

Raises:

  • (NotImplementedError)

26
27
28
# File 'lib/elastic_notifier/signal.rb', line 26

def severity
  raise NotImplementedError
end

#to_hashObject


14
15
16
17
18
19
20
21
22
23
24
# File 'lib/elastic_notifier/signal.rb', line 14

def to_hash
  {
    severity: severity,
    timestamp: @timestamp,
    program_name: @program_name,
    pid: @pid,
    hostname: @hostname,
    ip: @ip,
    data: data
  }.merge(@overrides)
end