From: <ha...@us...> - 2009-09-15 21:58:05
|
Revision: 2077 http://ganglia.svn.sourceforge.net/ganglia/?rev=2077&view=rev Author: hawson Date: 2009-09-15 21:57:57 +0000 (Tue, 15 Sep 2009) Log Message: ----------- Check cpu count and load numbers before using. A continuation of r2069. Modified Paths: -------------- trunk/monitor-core/web/cluster_view.php Modified: trunk/monitor-core/web/cluster_view.php =================================================================== --- trunk/monitor-core/web/cluster_view.php 2009-09-15 21:55:08 UTC (rev 2076) +++ trunk/monitor-core/web/cluster_view.php 2009-09-15 21:57:57 UTC (rev 2077) @@ -91,9 +91,16 @@ { foreach ($hosts_up as $host => $val) { - $cpus = $metrics[$host]["cpu_num"]['VAL']; - if (!$cpus) $cpus=1; - $load_one = $metrics[$host]["load_one"]['VAL']; + if ( isset($metrics[$host]["cpu_num"]['VAL']) and $metrics[$host]["cpu_num"]['VAL'] != 0 ){ + $cpus = $metrics[$host]["cpu_num"]['VAL']; + } else { + $cpus = 1; + } + if ( isset($metrics[$host]["load_one"]['VAL']) ){ + $load_one = $metrics[$host]["load_one"]['VAL']; + } else { + $load_one = 0; + } $load = ((float) $load_one)/$cpus; $host_load[$host] = $load; if(isset($percent_hosts[load_color($load)])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |