diff --git a/cgi-bin/malp.rb b/cgi-bin/malp.rb
index 52728b0..745eb56 100755
--- a/cgi-bin/malp.rb
+++ b/cgi-bin/malp.rb
@@ -114,7 +114,7 @@ if cgi.params.key?("content")
vms = info.select { |e| e["type"] == "vm" }
server = info.find { |e| e["type"] == "server" }
- html << %(
)
+ html << %(
)
if server
html << %(
Server
)
@@ -173,6 +173,63 @@ if cgi.params.key?("content")
html << %(
)
end
+ if filesystems.any?
+ html << %(File Systems
)
+ html << %()
+ filesystems.each 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
+ 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))
+
+ fs_stats = []
+ inode_cls = "ok"
+ if (itot = entry["inode_total"].to_i) > 0
+ iused = entry["inode_used"].to_i
+ ipct_f = iused * 100.0 / itot
+ inode_cls = ipct_f >= 90 ? "bad" : ipct_f >= 75 ? "warn" : "ok"
+ fs_stats << [inode_cls, "Inodes #{ipct_f.round}%"]
+ end
+ fs_stats << ["warn", "READ-ONLY"] if entry["readonly"]
+
+ severities = [space_cls, inode_cls]
+ card_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}
)
+
+ html << <<~HTML
+
+
+
+ #{source}
+ #{used_h} / #{size_h}
+
+
+ #{stats_block}
+
+ HTML
+ end
+ html << %(
)
+ end
+
+ html << %()
+
+ html << %()
+
if vms.any?
running = vms.count { |v| v["state"].to_s == "running" }
total = vms.size
@@ -409,61 +466,6 @@ if cgi.params.key?("content")
html << %(
)
- if filesystems.any?
- html << %()
- html << %(
File Systems
)
- html << %(
)
- filesystems.each 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
- 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))
-
- fs_stats = []
- inode_cls = "ok"
- if (itot = entry["inode_total"].to_i) > 0
- iused = entry["inode_used"].to_i
- ipct_f = iused * 100.0 / itot
- inode_cls = ipct_f >= 90 ? "bad" : ipct_f >= 75 ? "warn" : "ok"
- fs_stats << [inode_cls, "Inodes #{ipct_f.round}%"]
- end
- fs_stats << ["warn", "READ-ONLY"] if entry["readonly"]
-
- severities = [space_cls, inode_cls]
- card_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}
)
-
- html << <<~HTML
-
-
-
- #{source}
- #{used_h} / #{size_h}
-
-
- #{stats_block}
-
- HTML
- end
- html << %(
)
- html << %(
)
- end
-
cgi.out("type" => "text/html", "charset" => "UTF-8") do
html
end