ref: refs/heads/master
commit 193578ead2fa2e41e31b4ffc371a592932cd31da
Author: Stefan Schubert
Date: Fri Nov 6 10:38:38 2009 +0100
df returns sometimes unexpected 0 values (bnc#546345)
---
.../status/app/controllers/status_controller.rb | 6 +++++-
plugins/status/app/views/status/index.html.erb | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/plugins/status/app/controllers/status_controller.rb b/plugins/status/app/controllers/status_controller.rb
index 0eec63e..8c7352d 100644
--- a/plugins/status/app/controllers/status_controller.rb
+++ b/plugins/status/app/controllers/status_controller.rb
@@ -45,13 +45,17 @@ class StatusController < ApplicationController
end
def write_data_group(label, group, metric_name)
-# metric_name += "/" + label.name if label.name != "value" #more than one labels of a group
+ metric_name += "/" + label.name if label.name != "value" #more than one labels of a group
values = label.attributes["values"]
if values.uniq != ["invalid"] #use only entries which have at least one valid value
value_size = values.length
divisor = (group == "memory")? 1024*1024 : 1 # take MByte for the value
data_list = Array.new
value_size.times{|t| data_list << [t,values[t].to_f/divisor]}
+ if group == "df"
+ data_list.reject! {|value| value[1] == 0 } if group == "df" #df returns sometime 0 entries
+ data_list = [[0,0]] if data_list.size == 0 #it is really 0 :-)
+ end
@data_group[group].merge!({metric_name => data_list})
limits = label.attributes["limits"]
diff --git a/plugins/status/app/views/status/index.html.erb b/plugins/status/app/views/status/index.html.erb
index 619d594..7bda808 100644
--- a/plugins/status/app/views/status/index.html.erb
+++ b/plugins/status/app/views/status/index.html.erb
@@ -211,9 +211,9 @@ function plotLineGraphError(graph_id, graph_title, graph_data ) {
$('#' + '<%= graph_id %>').html("");
<% used_key = graph_key[0..graph_key.length-5] + "used" %>
<% if not @limits_list[:reached].blank? and @limits_list[:reached].include?(limit_key) %>
- plotPieGraphError ('<%= graph_id %>', '<%= graph_key[2..graph_key.length-5].tr('_','/') %>', [["<%= _("free") %>", <%= list_value.last[1] %>], ["<%= _("used") %>", <%= map[used_key].last[1] %>]]);
+ plotPieGraphError ('<%= graph_id %>', '<%= graph_key[2..graph_key.length-5].tr('-','/') %>', [["<%= _("free") %>", <%= list_value.last[1] %>], ["<%= _("used") %>", <%= map[used_key].last[1] %>]]);
<% else %>
- plotPieGraph ('<%= graph_id %>', '<%= graph_key[2..graph_key.length-5].tr('_','/') %>', [["<%= _("free") %>", <%= list_value.last[1] %>], ["<%= _("used") %>", <%= map[used_key].last[1] %>]]);
+ plotPieGraph ('<%= graph_id %>', '<%= graph_key[2..graph_key.length-5].tr('-','/') %>', [["<%= _("free") %>", <%= list_value.last[1] %>], ["<%= _("used") %>", <%= map[used_key].last[1] %>]]);
<% end %>
<% end %>
<% end %>
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org