diff --git a/cgi-bin/malp.rb b/cgi-bin/malp.rb
index 8be0289..c9a4cdc 100755
--- a/cgi-bin/malp.rb
+++ b/cgi-bin/malp.rb
@@ -182,16 +182,20 @@ if cgi.params.key?("content")
end
if filesystems.any?
- html << %(
)
- filesystems.each do |entry|
- mount = CGI.escapeHTML(entry["mount"].to_s)
+ total_size = filesystems.sum { |e| e["size"].to_i }
+ total_used = filesystems.sum { |e| e["used"].to_i }
+ total_pct_f = total_size > 0 ? (total_used * 100.0 / total_size) : 0.0
+ total_pct = total_pct_f.round
+ total_cls = total_pct_f >= 90 ? "bad" : total_pct_f >= 75 ? "warn" : "ok"
+
+ fs_rows = filesystems.map do |entry|
+ mount = CGI.escapeHTML(entry["mount"].to_s)
source = CGI.escapeHTML(entry["source"].to_s)
fstype = CGI.escapeHTML(entry["fstype"].to_s)
size_b = entry["size"].to_i
used_b = entry["used"].to_i
- pct_f = size_b > 0 ? (used_b * 100.0 / size_b) : 0.0
- pct = pct_f.round
+ pct_f = size_b > 0 ? (used_b * 100.0 / size_b) : 0.0
+ pct = pct_f.round
space_cls = pct_f >= 90 ? "bad" : pct_f >= 75 ? "warn" : "ok"
used_h = CGI.escapeHTML(human_capacity(used_b))
size_h = CGI.escapeHTML(human_capacity(size_b))
@@ -207,30 +211,62 @@ if cgi.params.key?("content")
fs_stats << ["warn", "READ-ONLY"] if entry["readonly"]
severities = [space_cls, inode_cls]
- card_cls = severities.include?("bad") ? "bad" :
- severities.include?("warn") ? "warn" : "ok"
+ row_cls = severities.include?("bad") ? "bad" :
+ severities.include?("warn") ? "warn" : "ok"
stats_html = fs_stats.map { |c, txt|
%(
#{CGI.escapeHTML(txt)})
}.join
stats_block = fs_stats.empty? ? "" :
- %(
#{stats_html}
)
+ %(
#{stats_html}
)
- html << <<~HTML
-
-