From: <vv...@us...> - 2011-04-12 01:05:50
|
Revision: 2563 http://ganglia.svn.sourceforge.net/ganglia/?rev=2563&view=rev Author: vvuksan Date: 2011-04-12 01:05:44 +0000 (Tue, 12 Apr 2011) Log Message: ----------- Space is a bad separator since some clusters can have spaces. Use regular expressions instead to determine arguments Modified Paths: -------------- branches/monitor-web-2.0/graph.php Modified: branches/monitor-web-2.0/graph.php =================================================================== --- branches/monitor-web-2.0/graph.php 2011-04-12 00:14:33 UTC (rev 2562) +++ branches/monitor-web-2.0/graph.php 2011-04-12 01:05:44 UTC (rev 2563) @@ -409,19 +409,18 @@ if ( $user['json_output'] || $user['csv_output'] ) { $rrdtool_graph_args = ""; - $graph_series = explode(" ", $rrdtool_graph['series']); - // First find RRDtool DEFs - foreach ( $graph_series as $key => $value ) { - if ( preg_match("/^DEF/", $value ) ) { - if ( preg_match("/(DEF:\')(.*)(\'=\')(.*)\/(.*)\/(.*)\/(.*)(\.rrd)/", $value, $out ) ) { + // First find RRDtool DEFs by parsing $rrdtool_graph['series'] + preg_match_all("| DEF:(.*) |U", $rrdtool_graph['series'], $matches); + + foreach ( $matches[0] as $key => $value ) { + if ( preg_match("/(DEF:\')(.*)(\'=\')(.*)\/(.*)\/(.*)\/(.*)(\.rrd)/", $value, $out ) ) { $ds_name = $out[2]; $cluster_name = $out[5]; $host_name = $out[6]; $metric_name = $out[7]; $output_array[] = array( "ds_name" => $ds_name, "cluster_name" => $out[5], "host_name" => $out[6], "metric_name" => $out[7] ); $rrdtool_graph_args .= $value . " " . "XPORT:" . $ds_name . ":" . $metric_name . " "; - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |