Mailinglist Archive: yast-commit (1809 mails)

< Previous Next >
[yast-commit] <web-client> network : status module: added new xml format
  • From: root <root@xxxxxxxxxxxxxxxxxx (none)>
  • Date: Mon, 31 Aug 2009 09:22:14 +0200
  • Message-id: <E1MjDJW-0001GZ-Gv@xxxxxxxxxxxxxxxx>
ref: refs/heads/network
commit 04e72c9e7ce2500089b54a2ea4129751cc58088e
Author: root <root@linux-qwou.(none)>
Date: Mon Aug 31 09:22:14 2009 +0200

status module: added new xml format
---
.../status/app/controllers/status_controller.rb | 36 ++++++++++++++++++--
1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/plugins/status/app/controllers/status_controller.rb
b/plugins/status/app/controllers/status_controller.rb
index 146b2d7..bd5d22c 100644
--- a/plugins/status/app/controllers/status_controller.rb
+++ b/plugins/status/app/controllers/status_controller.rb
@@ -15,7 +15,36 @@ class StatusController < ApplicationController
end

def create_data_map( tree, label = "")
- data_map = Hash.new
+ tree.attributes["metric"].each{ |metric|
+ metric_name = metric.name
+ group = metric.metricgroup
+ interval = metric.interval #TODO: not used yet
+ starttime = metric.starttime
+ case metric.attributes["label"]
+ when YaST::ServiceResource::Proxies::Status::Metric::Label
+ label = metric.attributes["label"].attributes["name"]
+ data_list = Array.new
+ metric.attributes["label"].attributes["values"].each{ |value|
data_list << value.to_f }
+ @limits[label] = metric.attributes["limits"].attributes if
metric.attributes.has_key? "limits" #TODO
+ @data["/#{group}/#{metric_name}"] = data_list
+
+ when Array
+ metric.attributes["label"].each{ |l|
+ label = l.attributes["value"]
+ data_list = Array.new
+ l.attributes["values"].each{ |value|
+ if label == "memory" # take MByte for the value
+ data_list << value.to_f/1024/1024
+ else
+ data_list << value.to_f
+ end
+ }
+ @limits[label] = l.attributes["limits"].attributes if
l.attributes.has_key? "limits" #TODO
+ @data["/#{group}/#{metric_name}/#{label}"] = data_list
+ }
+ end
+ }
+=begin
if tree.methods.include?("attributes")
tree.attributes.each do |key, branch|
if key.start_with?("t_")
@@ -40,7 +69,8 @@ class StatusController < ApplicationController
else
logger.error "wrong result: #{tree.inspect}"
end
- return data_map
+=end
+# return data_map
end

def create_data
@@ -52,7 +82,7 @@ class StatusController < ApplicationController
begin
till = Time.new
from = till - 300 #last 5 minutes
-
+#puts File.read(@client.find(:dummy_param, :params => { :start =>
from.to_i.to_s, :stop => till.to_i.to_s }))
status = @client.find(:dummy_param, :params => { :start =>
from.to_i.to_s, :stop => till.to_i.to_s })

rescue ActiveResource::ClientError => e
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages