83 |
|
$mount = getPregMatch("$diskRoot.p$i.attributes.mount", $input); |
84 |
|
if ($name || $mount) { |
85 |
|
$used = "$diskRoot.p$i.attributes.used"; |
86 |
< |
$kbytes = "$diskRoot.p$i.attributes.kbytes"; |
86 |
> |
$total = "$diskRoot.p$i.attributes.total"; |
87 |
|
$graph = preg_replace("/_/", "$hex_underscore", $mount); |
88 |
|
$graph = preg_replace("/\//", "$hex_slash", $graph); |
89 |
|
$totalinodes = getPregMatch("$diskRoot.p$i.attributes.totalinodes", $input); |
90 |
|
$freeinodes = getPregMatch("$diskRoot.p$i.attributes.freeinodes", $input); |
91 |
< |
showBar("$name ($mount)<br>space used", $used, $kbytes, $units, $input, "disk-$graph"); |
91 |
> |
showBar("$name ($mount)<br>space used", $used, $total, $units, $input, "disk-$graph"); |
92 |
|
showBar("inodes used", (int) $freeinodes, (int) $totalinodes, " inodes", $input, "", "swap"); |
93 |
|
print " <br><br>\n"; |
94 |
|
} |
98 |
|
$i++; |
99 |
|
} |
100 |
|
} |
101 |
+ |
|
102 |
+ |
|
103 |
+ |
# show all disk IO information. |
104 |
+ |
function showDiskIO($diskRoot, $input) { |
105 |
+ |
include("latest_config.inc.php"); |
106 |
+ |
|
107 |
+ |
$i = 0; |
108 |
+ |
while(1) { |
109 |
+ |
$name = getPregMatch("$diskRoot.p$i.attributes.name", $input); |
110 |
+ |
if ($name) { |
111 |
+ |
print "<br><center><b>(Disk $name)</b></center>"; |
112 |
+ |
showStat("Read bytes (per sec)", "$diskRoot.p$i.attributes.rbytes", $input, "diskio-$name"); |
113 |
+ |
showStat("Write bytes (per sec)", "$diskRoot.p$i.attributes.wbytes", $input, "diskio-$name"); |
114 |
+ |
print " <br>\n"; |
115 |
+ |
} |
116 |
+ |
else { |
117 |
+ |
break; |
118 |
+ |
} |
119 |
+ |
$i++; |
120 |
+ |
} |
121 |
+ |
} |
122 |
+ |
|
123 |
+ |
|
124 |
+ |
# show all network information. |
125 |
+ |
function showNet($netRoot, $input) { |
126 |
+ |
include("latest_config.inc.php"); |
127 |
+ |
|
128 |
+ |
$i = 0; |
129 |
+ |
while(1) { |
130 |
+ |
$name = getPregMatch("$netRoot.p$i.attributes.name", $input); |
131 |
+ |
if ($name) { |
132 |
+ |
print "<br><center><b>(Network Interface $name)</b></center>"; |
133 |
+ |
showStat("Received bytes (per sec)", "$netRoot.p$i.attributes.rx", $input, "net-$name"); |
134 |
+ |
showStat("Transfered bytes (per sec)", "$netRoot.p$i.attributes.tx", $input, "net-$name"); |
135 |
+ |
print " <br>\n"; |
136 |
+ |
} |
137 |
+ |
else { |
138 |
+ |
break; |
139 |
+ |
} |
140 |
+ |
$i++; |
141 |
+ |
} |
142 |
+ |
} |
143 |
+ |
|
144 |
|
|
145 |
|
# Return a preg_match result. |
146 |
|
function getPregMatch($value, $input) { |