Nagios Service class.
This commit is contained in:
parent
125025e078
commit
86f8428c41
12
lib/nsca/client/service.rb
Normal file
12
lib/nsca/client/service.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
module NSCA
|
||||||
|
module Client
|
||||||
|
class Service
|
||||||
|
attr_accessor :name, :host
|
||||||
|
|
||||||
|
def initialize(options)
|
||||||
|
@name = options[:name]
|
||||||
|
@host = options[:host] || Host.current
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
spec/nsca/client/service_spec.rb
Normal file
16
spec/nsca/client/service_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe NSCA::Client::Service do
|
||||||
|
let(:host) { NSCA::Client::Host.new(:hostname => 'asdf') }
|
||||||
|
subject { described_class.new(:name => 'TestMessage', :host => host) }
|
||||||
|
|
||||||
|
its(:name) { should eq 'TestMessage' }
|
||||||
|
its(:host) { should eq host }
|
||||||
|
|
||||||
|
context "default host to current machine" do
|
||||||
|
subject { described_class.new(:name => 'SimpleMessage') }
|
||||||
|
|
||||||
|
its(:name) { should eq 'SimpleMessage' }
|
||||||
|
its(:host) { should be_a NSCA::Client::Host }
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue