From: Davide Franco Date: Tue, 15 Feb 2011 11:08:29 +0000 (+0100) Subject: bacula-web: Added graph for last 7 days stored file in Backup Job report X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=32743f8b35db541bd2f3b4b4403708f92da01205;p=bacula%2Fbacula bacula-web: Added graph for last 7 days stored file in Backup Job report - New graph in Backup Job report page which display last 7 days stored files --- diff --git a/gui/bacula-web/backupjob-report.php b/gui/bacula-web/backupjob-report.php index 59e3c9dc87..9e8f9ce813 100644 --- a/gui/bacula-web/backupjob-report.php +++ b/gui/bacula-web/backupjob-report.php @@ -20,30 +20,30 @@ $smarty->config_dir = "./configs"; $backupjob_name = ""; - + $days = array(); + + // Get Backup Job name from GET or POST if( isset( $_POST["backupjob_name"] ) ) $backupjob_name = $_POST["backupjob_name"]; elseif( isset( $_GET["backupjob_name"] ) ) $backupjob_name = $_GET["backupjob_name"]; else die( "Please specify a backup job name " ); - - // Last 7 days stored Bytes graph - $graph = new BGraph( "graph2.png" ); - $days = array(); // Get the last 7 days interval (start and end) for( $c = 6 ; $c >= 0 ; $c-- ) { $today = ( mktime() - ($c * LAST_DAY) ); array_push( $days, array( 'start' => date( "Y-m-d 00:00:00", $today ), 'end' => date( "Y-m-d 23:59:00", $today ) ) ); } + + // Last 7 days stored Bytes graph + $graph = new BGraph( "graph2.png" ); $days_stored_bytes = array(); $backupjob_bytes = 0; - foreach( $days as $day ) { + foreach( $days as $day ) array_push( $days_stored_bytes, $dbSql->GetStoredBytesByJob( $backupjob_name, $day['start'], $day['end'] ) ); - } // Calculate total bytes for this period foreach( $days_stored_bytes as $day ) @@ -55,6 +55,25 @@ $graph->Render(); $smarty->assign('graph_stored_bytes', $graph->Get_Image_file() ); + // Getting last 7 days stored files graph + $graph = new BGraph("graph3.png" ); + + $days_stored_files = array(); + $backupjob_files = 0; + + foreach( $days as $day ) + array_push( $days_stored_files, $dbSql->GetStoredFilesByJob( $backupjob_name, $day['start'], $day['end'] ) ); + + // Calculate total files for this period + foreach( $days_stored_files as $day ) + $backupjob_files += $day[1]; + + $graph->SetData( $days_stored_files, 'bars', 'text-data' ); + $graph->SetGraphSize( 400, 230 ); + + $graph->Render(); + $smarty->assign('graph_stored_files', $graph->Get_Image_file() ); + $smarty->assign('backupjob_name', $backupjob_name ); $smarty->assign('backupjob_bytes', $backupjob_bytes );