summaryrefslogtreecommitdiff
path: root/lib/oxidized/node.rb
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2013-04-19 12:36:45 +0300
committerSaku Ytti <saku@ytti.fi>2013-04-19 12:41:29 +0300
commit96668cc2dc0367e3d1a3ec94265ce889b62d8ada (patch)
tree340f92a6dd4b68e41a946729c8fae34db7aff40b /lib/oxidized/node.rb
parent9d217025fac3e335c308f02e7377e14ccfdc0e66 (diff)
Add restful API
Diffstat (limited to 'lib/oxidized/node.rb')
-rw-r--r--lib/oxidized/node.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb
index 740834a..de04c98 100644
--- a/lib/oxidized/node.rb
+++ b/lib/oxidized/node.rb
@@ -28,6 +28,25 @@ module Oxidized
[status, config]
end
+ def serialize
+ h = {
+ :name => @name,
+ :ip => @ip,
+ :group => @group,
+ :model => @model.class.to_s,
+ :last => nil,
+ }
+ if @last
+ h[:last] = {
+ :start => @last.start,
+ :end => @last.end,
+ :status => @last.status,
+ :time => @last.time,
+ }
+ end
+ h
+ end
+
private
def resolve_prompt opt