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.inc.php' );
22 $days_stored_bytes = array();
24 // Stored files number
25 $dbSql->tpl->assign('stored_files', $dbSql->GetStoredFiles( ALL ) );
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 stored bytes since last 24 hours
35 $bytes_last = CUtils::Get_Human_Size( $dbSql->getStoredBytes( LAST_DAY, NOW ) );
36 $dbSql->tpl->assign('bytes_last', $bytes_last );
38 // Total stored files since last 24 hours
39 $files_last = $dbSql->GetStoredFiles( LAST_DAY );
40 $dbSql->tpl->assign('files_last', $files_last );
44 $nb_clients = $dbSql->Get_Nb_Clients();
45 $dbSql->tpl->assign('clientes_totales',$nb_clients["nb_client"] );
47 // Backup Job list for report.tpl and last_run_report.tpl
48 $dbSql->tpl->assign( 'jobs_list', $dbSql->Get_BackupJob_Names() );
50 // Last 24 hours status (completed, failed and waiting jobs)
51 $dbSql->tpl->assign( 'completed_jobs', $dbSql->countJobs( NOW-DAY, NOW, 'completed' ) );
52 $dbSql->tpl->assign( 'failed_jobs', $dbSql->countJobs( NOW-DAY, NOW, 'failed' ) );
53 $dbSql->tpl->assign( 'waiting_jobs', $dbSql->countJobs( NOW-DAY, NOW, 'waiting' ) );
55 // Last 24 hours jobs Level
56 $dbSql->tpl->assign( 'incr_jobs', $dbSql->countJobs( NOW-DAY, NOW, 'ALL', J_INCR) );
57 $dbSql->tpl->assign( 'diff_jobs', $dbSql->countJobs( NOW-DAY, NOW, 'ALL', J_DIFF) );
58 $dbSql->tpl->assign( 'full_jobs', $dbSql->countJobs( NOW-DAY, NOW, 'ALL', J_FULL) );
60 // Last 24 hours Job status graph
62 $status = array( 'completed', 'terminated_errors', 'failed', 'waiting', 'created', 'running', 'error' );
64 foreach( $status as $job_status ) {
65 array_push( $data, $dbSql->GetJobsStatistics( $job_status ) );
68 $graph = new CGraph( "graph.png" );
69 $graph->SetData( $data, 'pie', 'text-data-single' );
70 $graph->SetGraphSize( 400, 230 );
73 $dbSql->tpl->assign('graph_jobs', $graph->Get_Image_file() );
76 // Pool and volumes graph
78 $graph = new CGraph( "graph1.png" );
80 $pools = $dbSql->Get_Pools_List();
81 while( $pool = $pools->fetchRow( ) ) {
82 array_push( $data, $dbSql->CountVolumesByPool( $pool['poolid']) );
85 $graph->SetData( $data, 'pie', 'text-data-single' );
86 $graph->SetGraphSize( 400, 230 );
89 $dbSql->tpl->assign('graph_pools', $graph->Get_Image_file() );
91 // Last 7 days stored Bytes graph
94 for( $c = 6 ; $c >= 0 ; $c-- ) {
95 $today = NOW - ($c * DAY);
96 $days[] = CTimeUtils::get_Day_Intervals($today);
99 foreach( $days as $day ) {
100 $stored_bytes = $dbSql->getStoredBytes( $day['start'], $day['end']);
101 $stored_bytes = CUtils::Get_Human_Size( $stored_bytes, 1, 'GB', false );
102 $days_stored_bytes[] = array( date("m-d", $day['start']), $stored_bytes );
105 $graph = new CGraph( "graph2.png" );
106 $graph->SetData( $days_stored_bytes, 'bars', 'text-data' );
107 $graph->SetGraphSize( 400, 230 );
108 $graph->SetYTitle( "GB" );
111 $dbSql->tpl->assign('graph_stored_bytes', $graph->Get_Image_file() );
114 // Last 15 used volumes
117 $query = "SELECT DISTINCT Media.Volumename, Media.Lastwritten, Media.VolStatus, Job.JobId FROM Job ";
118 $query .= "LEFT JOIN JobMedia ON Job.JobId = JobMedia.JobId ";
119 $query .= "LEFT JOIN Media ON JobMedia.MediaId = Media.MediaId ";
120 $query .= "ORDER BY Job.JobId DESC ";
121 $query .= "LIMIT 10 ";
123 $result = $dbSql->db_link->query( $query );
125 if ( PEAR::isError( $result ) )
126 $this->TriggerDBError( 'Unable to get last used volumes from catalog' . $result );
128 while ( $vol = $result->fetchRow() )
129 array_push( $vol_list, $vol );
131 $dbSql->tpl->assign( 'volume_list', $vol_list );
134 $dbSql->tpl->display('index.tpl');