Skip to content

Commit

Permalink
Reportula V2.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveiraped committed Nov 14, 2014
1 parent 9a7154f commit 6e59d61
Show file tree
Hide file tree
Showing 929 changed files with 22,435 additions and 25,505 deletions.
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
2.0.10 - 9 Nov - 2014
===============================================

Features:
- [Add] Bacula reload Configuration Option in Menu Configuration.

Bugfixes:

- [fix] Clicking on a job ID with jobs that have no files processed.
- [fix] "Comments Read" Configuration files Fix - Thanks to DavidBuzz


2.0.9 - 7 Oct - 2014
===============================================

Bugfixes:

- [fix] Portgres Bug Fixes missed on 2.0.8 Version
- [fix] Portgresql Bug Fixes missed on 2.0.8 Version


2.0.8 - 6 Oct - 2014
Expand All @@ -26,7 +38,6 @@ Bugfixes:
- [fix] BootBox - Downgraded to 3.3.0 Version
- [fix] BaculaStats Crontab Command - HoursDiff Bug


Code Refactor

- [upg] Upgraded Laravel Framework to 4.2.x
Expand Down Expand Up @@ -78,7 +89,6 @@ Code Refactor
* Configuration Controller - Refactoring the code



2.0.5 - 7 July - 2014
===============================================

Expand Down
2 changes: 1 addition & 1 deletion app/config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
),


'pgsql' => array(
'pgsql' => array(
'driver' => 'pgsql',

'host' => 'localhost',
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ public function __construct()
{

parent::__construct();
// Asset::add('tabletools', 'assets/js/TableTools.min.js');
Asset::add('amcharts', 'assets/js/amcharts.js');
Asset::add('amchartsPie', 'assets/js/pie.js');

Asset::add('bootstrap-tooltip.js', 'assets/js/bootstrap-tooltip.js');
Asset::add('bootstrap-dropdown.js', 'assets/js/bootstrap-dropdown.js');

Expand Down Expand Up @@ -63,8 +61,6 @@ public function __construct()
Cache::forever('nFiles', $media->files);
Cache::forever('nBytes', $media->bytes);



}

public function dashboard($data=null)
Expand Down
32 changes: 5 additions & 27 deletions app/controllers/FilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,9 @@ public function __construct()
Asset::add('sprintf.js', 'assets/js/sprintf.js');
Asset::add('jspdf.js', 'assets/js/jspdf.js');
Asset::add('base64.js', 'assets/js/base64.js');
// Asset::add('jstree', 'assets/css/jstree.css');
// Asset::add('jstree', 'assets/js/jstree.js');

}

/* public function recursion($multi_dimensional_array)
{
$m = $multi_dimensional_array;
$keys = array();
foreach ($m as $key=>$value) {
$keys[] = $key;
}
$i = 0;
$ul='';
while ($i < count($multi_dimensional_array)) {
$ul.= '<li><a href="#">'.$keys[$i].'</a>';
if (is_array($multi_dimensional_array[$keys[$i]])) {
$ul.= '<ul>';
$ul.= $this->recursion($multi_dimensional_array[$keys[$i]]);
$ul.= '</ul>';
}
$ul.= '</li>';
$i++;
}

return $ul;
}*/
}

public function files($job)
{
Expand All @@ -69,8 +44,11 @@ public function files($job)
->join($this->tables['filename'],$this->tables['file'].'.filenameid', '=', $this->tables['filename'].'.filenameid')
->join($this->tables['path'],$this->tables['file'].'.pathid', '=', $this->tables['path'].'.pathid')
->where('jobid','=', $job)->remember(10)->get();

$files = $files->toArray();
$t= Filessearch::insert($files);
if (!empty($files)) {
$t= Filessearch::insert($files);
}
}

/* Mostra o log do Job */
Expand Down
5 changes: 0 additions & 5 deletions app/controllers/StatsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,13 @@ public function insertStats()
// Get Number of Files Transfered
$filesNumber = DB::table('file')->select(DB::raw('count(*) AS filesNumber'))->get();



// Get Storage Bytes
$bytesStorage = Media::sum('volbytes');

//* Query For Hour Starts
$dataInicio = date('Y-m-d', strtotime("-1 days")).(' 18:29');
$dataFim = date('Y-m-d').(' 18:29');


/* Query timediff Stats */
$timediff = DB::table('job')->select(DB::raw('(max(starttime) - min(starttime)) AS timediff'))
->where('starttime','>=', $dataInicio )
Expand All @@ -114,7 +111,6 @@ public function insertStats()
->where('starttime','>=', $dataInicio )
->where('endtime','<=', $dataFim);


$jobbytes = $query->sum('jobbytes');
$starttime = $query->min('starttime');
$endtime = $query->max('endtime');
Expand All @@ -130,7 +126,6 @@ public function insertStats()
'databasesize' => $dbsize[0]->dbsize
);


$hourstats = array(
'data' => date('Y-m-d') ,
'server' => $servername ,
Expand Down
5 changes: 1 addition & 4 deletions app/controllers/VolumesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public function __construct()
Asset::add('jspdf.js', 'assets/js/jspdf.js');
Asset::add('base64.js', 'assets/js/base64.js');


Asset::add('volumes', 'assets/js/volumes.js');

/* Fill Up the Select Box */
Expand Down Expand Up @@ -100,12 +99,10 @@ public function volumes($volumes=null)

}

/*Gets Data from the Jobs */

/*Gets Data from the Volumes */
public function getvolumes()
{


$tjobs = Job::select(array($this->tables['job'].'.jobid','name','starttime','endtime',
'level','jobbytes','jobfiles','jobstatus'))
->join($this->tables['jobmedia'],$this->tables['jobmedia'].'.jobid', '=', $this->tables['job'].'.jobid')
Expand Down
37 changes: 26 additions & 11 deletions app/controllers/admin/ConfiguratorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,21 @@ public function gettreedata()
return Response::json ($tree);
}

/*****
* Restart Bacula Daemon
* @return Json
*/
public function restartbacula()
{
$output = shell_exec('sudo echo reload | bconsole ');

//$message = array('html' => '<div class="alert alert-danger">'.$output.'</div>');
//if ($output=="") {
$message = array('html' => '<div class="alert alert-info"> '.$output.' </div>');
// }
return Response::json($message);
}


/*****
* Write Configuration Files
Expand Down Expand Up @@ -403,7 +418,7 @@ public function writebacula()
}
}
$contents .= "}\n\n";

#tweak filename to remove spaces, they are a bit of a hassle later
$clientfname = preg_replace("/\s+/","-",$clientname);
File::put($directory.'/conf.d/clients/'.$clientfname.'.conf', $contents);
Expand Down Expand Up @@ -874,24 +889,24 @@ public function readbacula()
$filename=$file->getFilename();

# strip all comments early, so we needn't be bothered with them later...
foreach ( $config as $linenum => $line ) {
foreach ( $config as $linenum => $line ) {
$line = preg_replace("/#.*$/","",$line);
}
}
# also, lets convert semicolons to newlines, as they are kinda weird too.
$newconfig = array();
foreach ( $config as $linenum => $line ) {
if ( preg_match("/;/",$line) ) {
foreach ( $config as $linenum => $line ) {
if ( preg_match("/;/",$line) ) {
$newlines = preg_split("/;/",$line);
foreach ( $newlines as $num => $newline ) {
foreach ( $newlines as $num => $newline ) {
array_push( $newconfig, $newline);
}
} else {

} else {
array_push( $newconfig, $line);
}
}
$config = $newconfig;


if ( $filename!='bacula-fd.conf' && $filename!='bacula-sd.conf' && $filename!='mtx-changer.conf') {

Expand Down Expand Up @@ -1022,7 +1037,7 @@ public function readbacula()
do {
$i++;
$result = preg_split ('[ = ]', $config[$i]);
if ( array_key_exists(1,$result)) {
if ( array_key_exists(1,$result)) {
$storage[preg_replace('/\s*/m', '', $result[0])]= preg_replace('/(\'|")/', '', trim($result[1]));
}
} while (trim($config[$i+1]) != "}");
Expand Down Expand Up @@ -1118,7 +1133,7 @@ public function readbacula()
do {
$i++;
$result = preg_split ('[=]', $config[$i]);
if ( array_key_exists(1,$result)) {
if ( array_key_exists(1,$result)) {
// Se não for comentário adiciona
//if (substr(trim($result[0]), 0, 1) != '#')
$job[preg_replace('/\s*/m', '', $result[0])]= preg_replace('/(\'|")/', '', trim($result[1]));
Expand Down
35 changes: 14 additions & 21 deletions app/controllers/admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ class DashboardController extends BaseController
{
public function dashboard()
{
//Get Server Hardware Info

/*
//Get Server Hardware Info
// Get kernel info
list($system, $host, $kernel) = explode(" ", exec("uname -a"), 5);
// Grab uptime output
Expand All @@ -19,7 +21,8 @@ public function dashboard()
//Get the memory info, and grab the cool stuf
$meminfo = file("/proc/meminfo");
for ($i = 0; $i < count($meminfo); $i++) {
for ($i = 0; $i < count($meminfo); $i++) {
list($item, $data) = explode(":", $meminfo[$i], 2);
$item = chop($item);
$data = chop($data);
Expand All @@ -38,29 +41,19 @@ public function dashboard()
$percent_swap = round( ( $total_swap - $free_swap ) / $total_swap * 100 );
$percent_swap_free = round( $free_swap / $total_swap * 100 );
$percent_buff = round( $buffer_mem / $total_mem * 100 );
$percent_cach = round( $cache_mem / $total_mem * 100 );
$percent_cach = round( $cache_mem / $total_mem * 100 );*/

//$percent_shar = round( $shared_mem / $total_mem * 100 );
//Now it's time to grab the cool stuff from the hard drive
//This one is not quite as straight forward.....
exec ("df", $x);
$count = 1;
/*while ($count < sizeof($x)) {
list($drive[$count], $size[$count], $used[$count], $avail[$count], $percent[$count], $mount[$count]) = explode(" +", $x[$count]);
$percent_part[$count] = str_replace( "%", "", $percent[$count] );
$count++;
}*/

$rss=FeedReader::read('http://www.reportula.org/reportula/?feed=rss2');
return View::make('admin.dashboard', array (
'rss' => $rss,
'uptime' => (exec("uptime")),
'system' => $system,
'host' => $host,
'kernel' => $kernel,
'used_mem' => ( $total_mem - $free_mem ),
'used_swap' => ( $total_swap - $free_swap ),
'free_mem' => $free_mem,
'rss' => $rss,
'uptime' => "",//(exec("uptime")),
'system' => "",//$system,
'host' => "",//$host,
'kernel' => "",//$kernel,
'used_mem' => "",//( $total_mem - $free_mem ),
'used_swap' => "",//( $total_swap - $free_swap ),
'free_mem' => ""//$free_mem,
));
}

Expand Down
1 change: 1 addition & 0 deletions app/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
Route::get('configurator', array('as' => 'admin.configurator', 'uses' => 'app\controllers\admin\ConfiguratorController@configurator'));
Route::get('readbacula', array('as' => 'admin.readbacula', 'uses' => 'app\controllers\admin\ConfiguratorController@readbacula'));
Route::get('writebacula', array('as' => 'admin.writebacula', 'uses' => 'app\controllers\admin\ConfiguratorController@writebacula'));
Route::get('restartbacula', array('as' => 'admin.restartbacula', 'uses' => 'app\controllers\admin\ConfiguratorController@restartbacula'));
Route::get('gettreedata', array('as' => 'admin.gettreedata', 'uses' => 'app\controllers\admin\ConfiguratorController@gettreedata'));
Route::post('getnode', array('as' => 'admin.getnode', 'uses' => 'app\controllers\admin\ConfiguratorController@getnode'));
Route::get('getincludes', array('as' => 'admin.getincludes', 'uses' => 'app\controllers\admin\ConfiguratorController@getincludes'));
Expand Down
10 changes: 4 additions & 6 deletions app/views/admin/configurator.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@
</ul>
</li>
<li class="divider"></li>
<li><a href="#" id="readBacula"> <i class="icon-fam-database-save"></i> Read Configuration</a></li>
<li><a href="#" id="testBacula" onClick ="writeBacula('test');"><i class="icon-fam-database-key"></i> Test Configuration </a></li>
<li><a href="#" id="writeBacula" onClick ="writeBacula('write');" ><i class="icon-fam-database-table"></i> Write Configuration</a></li>
<li><a href="#" id="restartBacula"><i class="icon-fam-database-table"></i> Restart Bacula Director </a></li>


<li><a href="#" id="readBacula"><i class="icon-fam-database-save"></i> Read Configuration</a></li>
<li><a href="#" id="testBacula" onClick ="writeBacula('test');"><i class="icon-fam-database-gear"></i> Test Configuration </a></li>
<li><a href="#" id="writeBacula" onClick ="writeBacula('write');"><i class="icon-fam-database-table"></i> Write Configuration</a></li>
<li><a href="#" id="restartBacula" onClick ="restartBacula();"><i class="icon-fam-arrow-refresh-small"></i> Reload Bacula Configuration </a></li>
</ul>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"barryvdh/laravel-dompdf": "0.4.*",
"adldap/adldap": "4.0.4",
"jasonlewis/expressive-date": "1.0.*",
"laracasts/utilities": "dev-master",
"barryvdh/laravel-debugbar": "1.*",
"awjudd/feed-reader": "1.1.*"

Expand Down
Loading

0 comments on commit 6e59d61

Please sign in to comment.