Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
John E. Vincent edited this page Jan 23, 2011 · 5 revisions

Host

In the Noah world a Host is fairly similar to that of a Nagios host. A host has the following attributes

  • Name string, unique
  • Status string, one of "up","down" or "pending"
  • Services - set of Service ids

Creating a new Host

irb via Ohm models

You can use the irbstub.rb file to load the models (irb -r ./irbstub.rb)

host1 = Host.create(:name => 'myserver.domain.com', :status => "up")
if host1.valid?
	host1.save
else
	host1.errors
end
Host.find(:name => 'myserver.domain.com').first
#<Host:2 created_at="2011-01-17 17:41:12 UTC" updated_at="2011-01-17 17:41:36 UTC" name="myserver.domain.com" status="up">

You can also add a Service to the server at creation

host2 = Host.create(:name => 'myserver1.domain.com', :status => "up") 
if host2.save
	s = Service.create(:name => 'myservice', :status => "up", :host => host2)
	host2.services << s
end
host2.services.all
[#<Service:3 created_at="2011-01-17 17:49:36 UTC" updated_at="2011-01-17 17:49:36 UTC" name="myservice" status="up" host_id="3">]

via curl

You can see the draft API specifications for each object type here: Draft Host API - Add Host curl -d '{"name":"fraggle", "status":"pending"}' -X PUT http://localhost:9292/h/fraggle {"result":"success","id":"7","status":"pending","name":"fraggle"}

Clone this wiki locally