All pastes #777577 Raw Edit

Someone

public text v1 · immutable
·published 2007-11-16 22:08 UTC
rendered paste body
Index: web/graph.php
===================================================================
--- web/graph.php	(revision 873)
+++ web/graph.php	(working copy)
@@ -236,8 +236,56 @@
                ."LINE2:'bytes_in'#$mem_cached_color:'In' "
                ."LINE2:'bytes_out'#$mem_used_color:'Out' ";
          }
-      else
+      else if ("temp_report" == $graph)
          {
+            $lower_limit    = '--lower-limit 20 --rigid';
+            $vertical_label = '--vertical-label "Temperature(C)"';
+            $style          = 'Average Temperatures';
+            $series =       ''; 
+            $extras = "--base 1024";
+
+            $sys_temp_color = '';
+
+
+            $line_size = $size !== 'small' ? '2' : '1';
+            $LINE="LINE$line_size";
+            
+            foreach ( glob("${rrd_dir}/*temp*.rrd") as $filename) {
+
+                if ( eregi('/([^/]+_temp.*\.rrd)$', $filename, $rrd) ) {
+                
+                    $str = $rrd[0];
+                    $length = strlen ($str);
+                    $metric = substr ($str, 1, $length-5);
+                    
+                    //error_log("metric=$metric");
+
+                    if ($matches = eregi('(sys|cpu|hd|disk|disc)(_temp_([0-9]))?', $metric,$type) ) {
+                        if (!empty($type[3])) {
+                            $tmp = "$type[1]_$type[3]";
+                        } else {
+                            $tmp = $type[1];
+                        }
+                        $color = $temp_type_colors[$tmp];
+                        
+                        //error_log(print_r($type,1));
+                        //error_log("metric=$metric , color=$color , tmp=$tmp");
+                        
+                        $series .= "DEF:'${metric}_sum'='$filename':sum:AVERAGE ";
+                        $series .= "DEF:'${metric}_num'='$filename':num:AVERAGE ";
+                        $series .= "CDEF:${metric}=${metric}_sum,${metric}_num,/ ";
+                        $series .= "$LINE:${metric}#{$color}:'${metric}' ";
+                    }
+                }
+                
+            }
+            
+            //error_log( "SERIES ==> $series");
+            
+            
+         }
+      else  // End canned graph section
+         {
             /* Got a strange value for $graph */
             exit();
          }
Index: web/cluster_view.php
===================================================================
--- web/cluster_view.php	(revision 873)
+++ web/cluster_view.php	(working copy)
@@ -52,7 +52,7 @@
 	$tpl->newBlock('optional_graphs');
 	$tpl->assign('name',$g);
 	$tpl->assign('graph_args',$graph_args);
-	
+	$tpl->gotoBlock('_ROOT');
 }
 
 #
Index: web/pie.php
===================================================================
--- web/pie.php	(revision 873)
+++ web/pie.php	(working copy)
@@ -393,11 +393,16 @@
          }
    }
 
-if (!$w or !$h)
-   {
-      $w = 400;
-      $h = 300;
-   }
+if (!isset($w) or !isset($h) or 
+    !is_numeric($w) or !is_numeric($h)) {
+        $w = 250;
+        $h = 150;
+}
+
+if (!isset($heads)) {
+    $heads[] = array('Pie Chart', 4, 'c');
+}
+   
 $pie->init($w, $h, $vals);
 $pie->draw_heading($heads);
 $pie->set_legend_percent();
Index: web/conf.php
===================================================================
--- web/conf.php	(revision 873)
+++ web/conf.php	(working copy)
@@ -102,6 +102,31 @@
 );
 
 #
+# Colors based on temperatures
+#
+$temp_colors = array (
+   '50'  => 'ff3300',
+   '45'  => 'ff9900',
+   '40'  => 'ccee00',
+   '35'  => 'ccff33',
+   '30'  => '33cc00',
+   '20'  => '33ccff',
+   '10'  => '000099'
+);
+
+$temp_type_colors = array (
+    'cpu' => 'ff00cc',
+    'cpu_0' => 'ff00cc',
+    'cpu_1' => '990099',
+    'cpu_2' => '99cc66',
+    'cpu_3' => '6600ff',
+    'sys'   => '000000',
+    'hd'    => '00ff00',
+    'disk'  => '00ff00',
+    'disc'  => '00ff00',
+);
+
+#
 # Load scaling
 #
 $load_scale = 1.0;
@@ -124,6 +149,6 @@
 #
 # Optional summary graphs
 #
-#$optional_graphs = array('packet');
+$optional_graphs = array('temp', 'jobqueue');
 
 ?>