Class: NSCA::Client::Message
- Inherits:
-
Object
- Object
- NSCA::Client::Message
- Defined in:
- lib/nsca/client/message.rb
Constant Summary collapse
- CODE =
{ :ok => 0, :warn => 1, :critical => 2 }
Instance Attribute Summary collapse
-
#return_code ⇒ Object
readonly
Returns the value of attribute return_code.
Instance Method Summary collapse
-
#initialize(alert, status, service, remote_server) ⇒ Message
constructor
A new instance of Message.
- #to_h ⇒ Object
Constructor Details
#initialize(alert, status, service, remote_server) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 13 |
# File 'lib/nsca/client/message.rb', line 8 def initialize(alert, status, service, remote_server) @return_code = CODE[alert] @status = status @service = service @remote_server = remote_server end |
Instance Attribute Details
#return_code ⇒ Object (readonly)
Returns the value of attribute return_code.
6 7 8 |
# File 'lib/nsca/client/message.rb', line 6 def return_code @return_code end |
Instance Method Details
#to_h ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/nsca/client/message.rb', line 15 def to_h { :nscahost => @remote_server.host, :port => @remote_server.port, :hostname => @service.host.hostname, :service => @service.name, :return_code => @return_code, :status => @status } end |