Class: ElasticNotifier::Signal
- Inherits:
-
Object
- Object
- ElasticNotifier::Signal
- Defined in:
- lib/elastic_notifier/signal.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(overrides = {}) ⇒ Signal
constructor
A new instance of Signal.
- #severity ⇒ Object
- #to_hash ⇒ Object
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
#attributes ⇒ Object (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
#data ⇒ Object
29 30 31 |
# File 'lib/elastic_notifier/signal.rb', line 29 def data raise NotImplementedError end |
#severity ⇒ Object
25 26 27 |
# File 'lib/elastic_notifier/signal.rb', line 25 def severity raise NotImplementedError end |
#to_hash ⇒ Object
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 |