This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 164
Service
John E. Vincent edited this page Jan 23, 2011
·
1 revision
In the Noah world a Service
is fairly similar to that of a Nagios service. A service has the following attributes
- Name string, unique
- Status string, one of "up","down" or "pending"
- Host ID int, id of existing Host
You can see the draft API specifications for each object type here: Draft Host API. When creating a Service via the REST API, the Host must already exist.
curl -d '{"name":"myservice", "status":"pending","host":"fraggle"}' -X PUT http://localhost:9292/s/service
{"action":"add","result":"success","id":"20","host":"fraggle","name":"service"}
You can use the irbstub.rb
file to load the models (irb -r ./irbstub.rb
)
>> h = Host.all.first
=> #<Host:1 created_at="2011-01-22 20:43:06 UTC" updated_at="2011-01-22 20:43:06 UTC" name="localhost" status="up">
>> s = Service.create(:name => "myservices", "status" => "pending", :host => h)
=> #<Service:21 created_at="2011-01-23 11:16:30 UTC" updated_at="2011-01-23 11:16:30 UTC" name="myservices" status="pending" host_id="1">
>> s.valid?
=> true
>> s.save
=> #<Service:21 created_at="2011-01-23 11:16:30 UTC" updated_at="2011-01-23 11:16:35 UTC" name="myservices" status="pending" host_id="1">