function __construct( $filename = "graph.png" )
{
if( !empty($filename) )
- $this->output_file = "graph.png";
- else
$this->output_file = $filename;
+ else
+ $this->output_file = 'graph.png';
}
public function SetData( $data_in, $type, $data_type, $shading = 5 )
} // end if else
} // end function GetLastErrorJobs
+ // Return the list of Pools in a array
+ public function Get_Pools_List()
+ {
+ $pool_list = array();
+ $result = "";
+
+ $query = "SELECT Name, PoolId FROM Pool";
+
+ $result = $this->db_link->query ( $query );
+
+ if( PEAR::isError( $result ) ) {
+ die( "Unable to get the pool list from catalog" );
+ }else {
+ while( $pool = $result->fetchRow(DB_FETCHMODE_ASSOC) ) {
+ array_push( $pool_list, array( $pool['Name'] => $pool['PoolId'] ) );
+ }
+ return $pool_list;
+ }
+ }
+
public function Get_BackupJob_Names()
{
$query = "SELECT Name FROM Job GROUP BY Name";
}
} // end function GetJobsStatistics()
- public function GetPoolsStatistics()
+ public function GetPoolsStatistics( $pools )
{
+ foreach( $pools as $pool_name => $pool ) {
+ //var_dump( $pool );
+ $query = "SELECT COUNT(*) AS nb_vol FROM Media WHERE PoolId = '$pool'";
+ //echo $query . '<br />';
+ //echo 'Pool name ' . $pool_name . '<br />';
+ $result = $this->db_link->query( $query );
+
+ if( PEAR::isError( $result ) ) {
+ die("Unable to get volume number from catalog");
+ }else{
+ $nb_vol = $result->fetchRow();
+ return array( $pool_name, $nb_vol['nb_vol'] );
+ }
+ }
}
} // end class Bweb
*/
}
-// Create a graph for last 24 hours job status
+// Last 24 hours Job status graph
$data = array();
$status = array( 'completed', 'completed_errors', 'failed', 'waiting', 'created', 'running', 'error' );
array_push( $data, $dbSql->GetJobsStatistics( $job_status ) );
}
-$graph = new BGraph( );
+$graph = new BGraph( "graph.png" );
$graph->SetData( $data, 'pie', 'text-data-single' );
//$graph->SetTitle("Overall jobs status");
$graph->SetGraphSize( 400, 230 );
//$graph->SetColors( array('green', 'yellow','red','blue','white','green','red') );
$graph->Render();
-$smarty->assign('graph', $graph->Get_Image_file() );
+$smarty->assign('graph_jobs', $graph->Get_Image_file() );
+unset($graph);
+
+// Pool and volumes graph
+$data = array();
+$graph = new BGraph( "graph1.png" );
+
+$pools = $dbSql->Get_Pools_List();
+
+foreach( $pools as $pool ) {
+ array_push( $data, $dbSql->GetPoolsStatistics( $pool ) );
+}
+
+$graph->SetData( $data, 'pie', 'text-data-single' );
+$graph->SetGraphSize( 400, 230 );
+
+
+$graph->Render();
+$smarty->assign('graph_pools', $graph->Get_Image_file() );
if ($_GET['Full_popup'] == "yes" || $_GET['pop_graph1'] == "yes" || $_GET['pop_graph2'] == "yes")
$smarty->display('full_popup.tpl');
<!-- Last job Status -->
<div class="box">
<p class="title">Job Status Report (last 24 hours)</p>
- <img src="{$graph}" alt="" />
+ <img src="{$graph_jobs}" alt="" />
+ </div> <!-- end div box -->
+
+ <!-- Pools and Volumes Status -->
+ <div class="box">
+ <p class="title">Job Status Report (last 24 hours)</p>
+ <img src="{$graph_pools}" alt="" />
</div> <!-- end div box -->
<!-- General information -->
<div class="box">