| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 | 
							- <?php
 
- require_once('datasources.inc');
 
- require_once('class_cpu.inc');
 
- require_once('class_if.inc');
 
- require_once('class_io.inc');
 
- require_once('class_mem.inc');
 
- require_once('class_pf.inc');
 
- if (!empty($GLOBALS["QUERY_STRING"])) {
 
-     $args = $GLOBALS["QUERY_STRING"];
 
-     // rework args to contain ony last set 'command' 
 
-     $options = array();
 
-     $allargs = explode('&', $args);
 
-     $i = 0;
 
-     while ($i < count($allargs)) {
 
- 	$operand = split('=', $allargs[$i]);
 
- 	if (count($operand) == 2) {
 
- 	    $options[$operand[0]]=$operand[1];
 
- 	}
 
- 	$i++;
 
-     }
 
-     // decode done, now recode
 
-     $i = 0;
 
-     $args = "";
 
-     reset($options);
 
-     while (list($key,$val) = each($options)) {
 
- 	if ($args) {
 
- 	    $args .= '&';
 
- 	}
 
- 	$args .= $key.'='.$val;
 
-     }
 
- } else {
 
-     $args = "";
 
- }
 
- function make_graph_url($type, $new_args) {
 
-     global $args;
 
-     $new_args = urlencode($new_args);
 
-     $url = "graph_".$type.".php?";
 
-     $allargs="";
 
-     if ($args) {
 
- 	$allargs.=$args.'&';
 
-     }
 
-     $allargs .= $new_args;
 
-     switch ($type) {
 
-     case 'cpu':
 
- 	$g = new CPU_Graph();
 
- 	break;
 
-     case 'if':
 
- 	$g = new IF_Graph();
 
- 	break;
 
-     case 'io':
 
- 	$g = new IO_Graph();
 
- 	break;
 
-     case 'mem':
 
- 	$g = new MEM_Graph();
 
- 	break;
 
-     case 'pf':
 
- 	$g = new PF_Graph();
 
-     }
 
-     $g->execute($allargs);
 
-     return ($url . $g->settings2url());
 
- }
 
- function print_index_url($new_args) {
 
-     global $args;
 
-     $url = 'index.php?';
 
-     if ($args) {
 
- 	$url.=$args.'&';
 
-     }
 
-     $url .= sprintf("%s", $new_args);
 
-     print $url;
 
- }
 
- ?>
 
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
 
- <html>
 
- <head>
 
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
-  <title>mon statistics</title>
 
-  <link rel="stylesheet" href="mon.css" type="text/css" />
 
- </head>
 
- <body>
 
-  <table border="0" cellspacing="0" cellpadding="0" align="center">
 
-   <tr>
 
-    <td valign="top">
 
-     <table border="0" cellpadding="0" cellspacing="0">
 
-      <tr>
 
-       <td width="5%"/></td>
 
-       <td colspan="5" bgcolor="#555599"><img src="spacer.png" width="1" height="1" /></td>
 
-       <td width="5%"/></td>
 
-      </tr>
 
-      <tr>
 
-       <!-- sidebar -->
 
-       <td width="5%"/></td>
 
-       <td width="1" bgcolor="#555599"><img src="spacer.png" width="1" height="1" /></td>
 
-       <td bgcolor="#FFFFFF" valign="top" width="20%">
 
-        <div class="left">
 
-         <img src="mon.png" width="149" border="0" alt="[mon]" />
 
-        </div> 
 
-        <div class="left">
 
-         <div class="section-head">Graph Options</div>
 
-         <div class="left-links">
 
- 	 Timespan: 
 
- 	 <a href="<? print_index_url("start=-14515200") ?>">last 6 months</a>, 
 
- 	 <a href="<? print_index_url("start=-2419200") ?>">last month</a>,
 
- 	 <a href="<? print_index_url("start=-691200") ?>">last 8 days</a>,
 
- 	 <a href="<? print_index_url("start=-86400") ?>">last 24 hours</a>,
 
- 	 <a href="<? print_index_url("start=-3600") ?>">last hour</a><br />
 
- 	 Size: 
 
- 	 <a href="<? print_index_url("size=tiny") ?>">tiny</a>, 
 
- 	 <a href="<? print_index_url("size=small") ?>">small</a>, 
 
- 	 <a href="<? print_index_url("size=normal") ?>">normal</a>, 
 
- 	 <a href="<? print_index_url("size=big") ?>">big</a>, 
 
- 	 <a href="<? print_index_url("size=huge") ?>">huge</a><br />
 
- 	</div>
 
- 	<div class="section-head">Type options</div>
 
- 	<div class="left-links">
 
- 	 Cpu:
 
- 	 <a href="<? print_index_url("cpu=brief")?> ">brief</a>,
 
- 	 <a href="<? print_index_url("cpu=detailed")?> ">detailed</a><br />
 
- 	 If:
 
- 	 <a href="<? print_index_url("if=brief")?> ">brief</a>,
 
- 	 <a href="<? print_index_url("if=bits")?> ">bits</a>,
 
- 	 <a href="<? print_index_url("if=packets")?> ">packets</a>,
 
- 	 <a href="<? print_index_url("if=all")?> ">all</a><br />
 
- 	 Io:
 
- 	 <a href="<? print_index_url("io=brief")?> ">brief</a>,
 
- 	 <a href="<? print_index_url("io=all")?> ">all</a><br />
 
- 	 Mem:
 
- 	 <a href="<? print_index_url("mem=brief")?> ">brief</a>,
 
- 	 <a href="<? print_index_url("mem=detailed")?> ">detailed</a><br />
 
-         </div>
 
-        </div>
 
-       </td>
 
-      <!-- main window -->
 
-       <td width="1" bgcolor="#555599"><img src="spacer.png" width="1" height="1" /></td>
 
-       <td bgcolor="#FFFFFF" valign="top" width="95%">
 
-        <div align="center" class="blue">
 
-         <table bgcolor="#6699CC" border="0" cellpadding="0" cellspacing="0">
 
-          <tr>
 
- <?
 
- 	 $root_dir = dir($mon2web["tree"]);
 
-          while ($machine = $root_dir->read()) {
 
- 	     if ($machine != '.' && 
 
- 		 $machine != '..' && 
 
- 		 is_dir($mon2web["tree"]."/".$machine)) {
 
- 		 print '
 
-           <td><a class="blue" href="';
 
- 		 print_index_url("#" . $machine);
 
- 		 print '">'. $machine . '</a>   </td>
 
- ';
 
- 	     }
 
- 	 }
 
- ?>
 
- 	 </tr>
 
-         </table>
 
-        </div>
 
-        <div class="items">
 
- 	
 
- <?php
 
- // traverse through the monrrd tree
 
-   $root_dir = dir($mon2web["tree"]);
 
-   $found_machine = 0;
 
-   while ($machine = $root_dir->read()) {
 
-       if ($machine != '.' && 
 
- 	  $machine != '..' && 
 
- 	  is_dir($mon2web["tree"]."/".$machine)) {
 
- 	  print '
 
-         <!-- item start -->
 
-         <div class="header">
 
- 	 <a class="header" name="'. $machine . '">'. $machine. '</a><br />
 
- 	</div>
 
- ';
 
- 	  $machine_dir = dir($mon2web["tree"]."/".$machine);
 
- 	  while ($filename = $machine_dir->read()) {
 
- 	      $file = $mon2web["tree"]."/".$machine."/".$filename;
 
- 	      if (is_file($file) && 
 
- 		  preg_match("/^(cpu|if|io|mem|pf)(_([a-z]+))?([0-9]?).rrd$/", 
 
- 			     $filename, $match)) {
 
- 		  $rrdtype = $match[1];
 
- 		  $rrdwhat = $match[3];
 
- 		  $rrdwhich = $match[4];
 
- 		  
 
- 		  $cmd = make_graph_url($rrdtype,
 
- 					"rrdfile=".$file.
 
- 					"&name=".$rrdwhat.$rrdwhich);
 
- 		  print '<img src="' . $cmd . '">'."\n";
 
- 		  $found_machine++;
 
- 	      }
 
- 	  }
 
- 	  print '
 
-         <div class="item-footer"></div>
 
- ';
 
-       }
 
-   }
 
-   
 
-   if ($found_machine == 0) {
 
-       print 'Did not find any host directories in '.$mon2web["tree"].'<br>';
 
-   }
 
- ?>
 
-        <div class="copyright">Copyright © 2002 Willem Dijkstra</div>
 
-       </div> <!-- end items div -->
 
-       </td> <!-- end main window -->
 
-       <!-- horizontal endline -->
 
-       <td width="1" bgcolor="#555599"><img src="spacer.png" width="1" height="1" /></td>
 
-      </tr>
 
-       <!-- vertical endline -->
 
-      <tr> 
 
-       <td width="5%"/></td>
 
-       <td colspan="5" bgcolor="#555599"><img src="spacer.png" width="1" height="1" /></td>
 
-       <td width="5%"/></td>
 
-      </tr>
 
-     </table>
 
-    </td>
 
-    <td width="5%"/></td>
 
-   </tr>
 
-  </table>
 
- </body>
 
- </html>
 
 
  |