Permalink
Browse files

add host@cluster in the header of the csv output

  • Loading branch information...
1 parent b48d369 commit 397b419528b79db9cf8c51a592ac885aabecd15c @koebi001 committed Jun 29, 2011
Showing with 13 additions and 6 deletions.
  1. +13 −6 ganglia-web/graph.php
View
@@ -570,22 +570,29 @@
header("Content-Disposition: inline; filename=\"ganglia-metrics.csv\"");
// Print out headers
- print "Timestamp,Cluster,Host";
- foreach ( $metrics_name_array as $key => $value) {
- print "," . $key;
+ print "Time";
+ $clusters=current($csv_array);
+ foreach ( $clusters as $cluster => $hosts ){
+ foreach ( $hosts as $host => $metrics ){
+ foreach ( $metrics_name_array as $key => $value) {
+ if( isset( $metrics[$key] ) )
+ print "," . $key . " on " . $host . "@" . $cluster;
+ }
+ }
}
print "\n";
// Print out data
foreach ( $csv_array as $timestamp => $clusters ){
foreach ( $clusters as $cluster => $hosts ){
+ print date("c", $timestamp);
foreach ( $hosts as $host => $metrics){
- print date("c", $timestamp) . "," . $cluster . "," . $host;
foreach ( $metrics_name_array as $key => $value) {
- print "," . $metrics[$key];
+ if( isset( $metrics[$key] ) )
+ print "," . $metrics[$key];
}
- print "\n";
}
+ print "\n";
}
}

0 comments on commit 397b419

Please sign in to comment.