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
# 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 = overrides[:program_name] || $PROGRAM_NAME
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)


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

def data
  raise NotImplementedError
end

#severityObject

Raises:

  • (NotImplementedError)


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

def severity
  raise NotImplementedError
end

#to_hashObject



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

def to_hash
  { 
    severity: severity,
    timestamp: @timestamp,
    program_name: @program_name,
    pid: @pid,
    hostname: @hostname,
    ip: @ip,
    data: data
  }
end