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"] );
43 $dbSql->tpl->assign( 'jobs_list', $dbSql->Get_BackupJob_Names() );
47 $dbSql->tpl->assign( 'clients_list', $dbSql->getClients() );
49 // Last 24 hours status (completed, failed and waiting jobs)
50 $dbSql->tpl->assign( 'completed_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'completed' ) );
51 $dbSql->tpl->assign( 'failed_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'failed' ) );
52 $dbSql->tpl->assign( 'waiting_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'waiting' ) );
54 // Last 24 hours jobs Level
55 $dbSql->tpl->assign( 'incr_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'ALL', J_INCR) );
56 $dbSql->tpl->assign( 'diff_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'ALL', J_DIFF) );
57 $dbSql->tpl->assign( 'full_jobs', $dbSql->countJobs( LAST_DAY, NOW, 'ALL', J_FULL) );
59 // Last 24 hours Job status graph
60 $jobs_status_data = array();
61 $jobs_status = array( 'Running', 'Completed', 'Failed', 'Canceled', 'Waiting' );
63 foreach( $jobs_status as $status )
64 $jobs_status_data[] = array( $status, $dbSql->countJobs(LAST_DAY, NOW, $status) );
66 $graph = new CGraph( "graph.png" );
67 $graph->SetData( $jobs_status_data, 'pie', 'text-data-single' );
68 $graph->SetGraphSize( 400, 230 );
71 $dbSql->tpl->assign('graph_jobs', $graph->Get_Image_file() );
74 // Volumes by pools graph
75 $vols_by_pool = array();
76 $graph = new CGraph( "graph1.png" );
78 foreach( $dbSql->getPools() as $pool )
79 $vols_by_pool[] = array( $pool['name'], $dbSql->countVolumes( $pool['poolid'] ) );
81 $graph->SetData( $vols_by_pool, 'pie', 'text-data-single' );
82 $graph->SetGraphSize( 400, 230 );
85 $dbSql->tpl->assign('graph_pools', $graph->Get_Image_file() );
87 // Last 7 days stored Bytes graph
88 $days = CTimeUtils::getLastDaysIntervals( 7 );
89 foreach( $days as $day ) {
90 $stored_bytes = $dbSql->getStoredBytes( $day['start'], $day['end']);
91 $stored_bytes = CUtils::Get_Human_Size( $stored_bytes, 1, 'GB', false );
92 $days_stored_bytes[] = array( date("m-d", $day['start']), $stored_bytes );
95 $graph = new CGraph( "graph2.png" );
96 $graph->SetData( $days_stored_bytes, 'bars', 'text-data' );
97 $graph->SetGraphSize( 400, 230 );
98 $graph->SetYTitle( "GB" );
101 $dbSql->tpl->assign('graph_stored_bytes', $graph->Get_Image_file() );
104 // Last 15 used volumes
107 $query = "SELECT DISTINCT Media.Volumename, Media.Lastwritten, Media.VolStatus, Job.JobId FROM Job ";
108 $query .= "LEFT JOIN JobMedia ON Job.JobId = JobMedia.JobId ";
109 $query .= "LEFT JOIN Media ON JobMedia.MediaId = Media.MediaId ";
110 $query .= "ORDER BY Job.JobId DESC ";
111 $query .= "LIMIT 10 ";
114 $result = $dbSql->db_link->runQuery($query);
115 foreach($result->fetchall() as $vol)
117 }catch(PDOException $e) {
118 CDBError::raiseError($e);
121 $dbSql->tpl->assign( 'volume_list', $vol_list );
124 $dbSql->tpl->display('index.tpl');