null+****@clear*****
null+****@clear*****
2010年 7月 9日 (金) 23:40:13 JST
Kouhei Sutou 2010-07-09 14:40:13 +0000 (Fri, 09 Jul 2010) New Revision: 8acd3f7542d0cf86eee901c10720ec0faf31508d Log: size -> usage. Modified files: data/munin/groonga_disk Modified: data/munin/groonga_disk (+15 -15) =================================================================== --- data/munin/groonga_disk 2010-07-09 14:31:38 +0000 (a960122) +++ data/munin/groonga_disk 2010-07-09 14:40:13 +0000 (fc224cd) @@ -68,15 +68,15 @@ def schema end def parse_du_result(result) - sizes = {} + usages = {} result.each_line do |line| if /\A(\d+)\s+/ =~ line - size = $1 + usage = $1 path = $POSTMATCH.strip - sizes[path] = size.to_i + usages[path] = usage.to_i end end - sizes + usages end case command @@ -91,15 +91,15 @@ when "autoconf", "detect" end when "config" if label.nil? - title = "groonga: disk size" + title = "groonga: disk usage" else - title = "groonga: #{label}: disk size" + title = "groonga: #{label}: disk usage" end puts <<EOF graph_title #{title} graph_vlabel Bytes graph_category groonga -graph_info disk size in groonga tables and columns +graph_info disk usage in groonga tables and columns graph_total Total graph_args --base 1024 @@ -133,24 +133,24 @@ unless $?.success? puts("error: #{du_result}") exit(false) end -sizes = parse_du_result(du_result) -size = sizes[@path] || 0 +usages = parse_du_result(du_result) +usage = usages[@path] || 0 puts <<EOF -database.value #{size} +database.value #{usage} EOF schema.each do |table| table_key = table["key"] table_name = table["name"] - size = sizes[table["path"]] || 0 + usage = usages[table["path"]] || 0 puts <<EOF -#{table_key}.value #{size} +#{table_key}.value #{usage} EOF table["columns"].each do |column| column_key = column["key"] - size = sizes[column["path"]] || 0 - size += sizes["#{column['path']}.c"] || 0 + usage = usages[column["path"]] || 0 + usage += usages["#{column['path']}.c"] || 0 puts <<EOF -#{column_key}.value #{size} +#{column_key}.value #{usage} EOF end end