3 +-------------------------------------------------------------------------+
4 | Copyright (C) 2004 Juan Luis Francés Jiménez |
5 | Copyright 2010-2011, Davide Franco |
7 | This program is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU General Public License |
9 | as published by the Free Software Foundation; either version 2 |
10 | of the License, or (at your option) any later version. |
12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. |
16 +-------------------------------------------------------------------------+
19 include_once( 'config/global.inc.php' );
22 $days_stored_bytes = array();
24 // Stored files number
25 $dbSql->tpl->assign('stored_files', number_format($dbSql->getStoredFiles( FIRST_DAY, NOW ), 0, '.', "'" ) );
28 $dbSql->tpl->assign('database_size', $dbSql->GetDbSize());
30 // Overall stored bytes
31 $stored_bytes = CUtils::Get_Human_Size( $dbSql->getStoredBytes( FIRST_DAY, NOW ) );
32 $dbSql->tpl->assign('stored_bytes', $stored_bytes);
34 // Total bytes and files for last 24 hours
35 $dbSql->tpl->assign('bytes_last', CUtils::Get_Human_Size( $dbSql->getStoredBytes( LAST_DAY, NOW ) ) );
36 $dbSql->tpl->assign('files_last', number_format($dbSql->getStoredFiles( LAST_DAY, NOW ), 0, '.', "'" ) );
39 $nb_clients = $dbSql->Get_Nb_Clients();
40 $dbSql->tpl->assign('clientes_totales',$nb_clients["nb_client"] );
42 // Backup Job list for report.tpl and last_run_report.tpl
43 $dbSql->tpl->assign( 'jobs_list', $dbSql->Get_BackupJob_Names() );
45 // Last 24 hours status (completed, failed and waiting jobs)
46 $dbSql->tpl->assign( 'completed_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'completed' ) );
47 $dbSql->tpl->assign( 'failed_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'failed' ) );
48 $dbSql->tpl->assign( 'waiting_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'waiting' ) );
50 // Last 24 hours jobs Level
51 $dbSql->tpl->assign( 'incr_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'ALL', J_INCR) );
52 $dbSql->tpl->assign( 'diff_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'ALL', J_DIFF) );
53 $dbSql->tpl->assign( 'full_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'ALL', J_FULL) );
55 // Last 24 hours Job status graph
56 $jobs_status_data = array();
57 $jobs_status = array( 'Running', 'Completed', 'Failed', 'Canceled', 'Waiting' );
59 foreach( $jobs_status as $status )
60 $jobs_status_data[] = array( $status, $dbSql->countJobs(LAST_DAY, NOW, $status) );
62 $graph = new CGraph( "graph.png" );
63 $graph->SetData( $jobs_status_data, 'pie', 'text-data-single' );
64 $graph->SetGraphSize( 400, 230 );
67 $dbSql->tpl->assign('graph_jobs', $graph->Get_Image_file() );
70 // Volumes by pools graph
71 $vols_by_pool = array();
72 $graph = new CGraph( "graph1.png" );
74 foreach( $dbSql->getPools() as $pool )
75 $vols_by_pool[] = array( $pool['name'], $dbSql->countVolumes( $pool['poolid'] ) );
77 $graph->SetData( $vols_by_pool, 'pie', 'text-data-single' );
78 $graph->SetGraphSize( 400, 230 );
81 $dbSql->tpl->assign('graph_pools', $graph->Get_Image_file() );
83 // Last 7 days stored Bytes graph
84 $days = CTimeUtils::getLastDaysIntervals( 7 );
85 foreach( $days as $day ) {
86 $stored_bytes = $dbSql->getStoredBytes( $day['start'], $day['end']);
87 $stored_bytes = CUtils::Get_Human_Size( $stored_bytes, 1, 'GB', false );
88 $days_stored_bytes[] = array( date("m-d", $day['start']), $stored_bytes );
91 $graph = new CGraph( "graph2.png" );
92 $graph->SetData( $days_stored_bytes, 'bars', 'text-data' );
93 $graph->SetGraphSize( 400, 230 );
94 $graph->SetYTitle( "GB" );
97 $dbSql->tpl->assign('graph_stored_bytes', $graph->Get_Image_file() );
100 // Last 15 used volumes
103 $query = "SELECT DISTINCT Media.Volumename, Media.Lastwritten, Media.VolStatus, Job.JobId FROM Job ";
104 $query .= "LEFT JOIN JobMedia ON Job.JobId = JobMedia.JobId ";
105 $query .= "LEFT JOIN Media ON JobMedia.MediaId = Media.MediaId ";
106 $query .= "ORDER BY Job.JobId DESC ";
107 $query .= "LIMIT 10 ";
109 $result = $dbSql->db_link->query( $query );
111 if ( PEAR::isError( $result ) )
112 $this->TriggerDBError( 'Unable to get last used volumes from catalog' . $result );
114 while ( $vol = $result->fetchRow() )
115 array_push( $vol_list, $vol );
117 $dbSql->tpl->assign( 'volume_list', $vol_list );
120 $dbSql->tpl->display('index.tpl');