git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4251
91ce42f0-d328-0410-95d8-
f526ca767f89
9) using bfileview.pl
10) accessing to bweb
11) setting mysql read-only account
9) using bfileview.pl
10) accessing to bweb
11) setting mysql read-only account
################ FILE COPY #####################################
# you must get bweb svn files
################ FILE COPY #####################################
# you must get bweb svn files
ALTER TABLE brestore_pathvisibility ADD Size int8;
ALTER TABLE brestore_pathvisibility ADD Files int4;
ALTER TABLE brestore_pathvisibility ADD Size int8;
ALTER TABLE brestore_pathvisibility ADD Files int4;
-################ ACCESSING TO BWEB ###############################
+################ ACCESSING TO BWEB ############################
Now, you are able to launch firefox/mozilla and go on
http://your-server/bweb
Now, you are able to launch firefox/mozilla and go on
http://your-server/bweb
-################ SETTING MYSQL ACCOUNT ###########################
+################ SETTING MYSQL ACCOUNT ########################
At this time, Bweb needs a write access to :
- Location
At this time, Bweb needs a write access to :
- Location
GRANT UPDATE (LocationId,Comment,RecyclePoolId) ON bacula.Media
TO 'bweb'@'%' IDENTIFIED BY 'password';
GRANT UPDATE (LocationId,Comment,RecyclePoolId) ON bacula.Media
TO 'bweb'@'%' IDENTIFIED BY 'password';
-###################################################################
+################ GET MORE STATISTICS ###########################
+
+You keep Jobs informations across retention into a job_old table.
+You have to setup stat_job_table = job_old in bweb configuration.
+
+CREATE TABLE job_old (LIKE Job);
+
+And run this on crontab when you want :
+INSERT INTO job_old
+ (SELECT * FROM Job WHERE JobId NOT IN (SELECT JobId FROM job_old) );
+
+################################################################
Release Notes for bweb 2.0
Release Notes for bweb 2.0
2007/02/25
- Update INSTALL notes (GRANT options for mysql)
2007/02/25
- Update INSTALL notes (GRANT options for mysql)
+ - You can choose a other table than Job to do your statistics
+ Job is purged by Media or Job retention, it's not very useful
+ to follow trends.
2007/02/14
- Add EndTime to display_job if you want add it to your tpl
2007/02/14
- Add EndTime to display_job if you want add it to your tpl
my $conf = new Bweb::Config(config_file => $Bweb::config_file);
$conf->load();
my $conf = new Bweb::Config(config_file => $Bweb::config_file);
$conf->load();
my $bweb = new Bweb(info => $conf);
$bweb->connect_db();
my $dbh = $bweb->{dbh};
my $debug = $bweb->{debug};
my $bweb = new Bweb(info => $conf);
$bweb->connect_db();
my $dbh = $bweb->{dbh};
my $debug = $bweb->{debug};
+# Job table keep use Media or Job retention, so it's quite enought
+# for good statistics
+# CREATE TABLE job_old (LIKE Job);
+# INSERT INTO job_old
+# (SELECT * FROM Job WHERE JobId NOT IN (SELECT JobId FROM job_old) );
+my $jobt = $conf->{stat_job_table} || 'Job';
+
my $graph = CGI::param('graph') || 'job_size';
my $legend = CGI::param('legend') || 'on' ;
$legend = ($legend eq 'on')?1:0;
my $graph = CGI::param('graph') || 'job_size';
my $legend = CGI::param('legend') || 'on' ;
$legend = ($legend eq 'on')?1:0;
my ($limitq, $label) = $bweb->get_limit(age => $arg->{age},
limit => $arg->{limit},
offset=> $arg->{offset},
my ($limitq, $label) = $bweb->get_limit(age => $arg->{age},
limit => $arg->{limit},
offset=> $arg->{offset},
- order => 'Job.StartTime ASC',
+ order => "$jobt.StartTime ASC",
);
my $statusq='';
if ($arg->{status} and $arg->{status} ne 'Any') {
);
my $statusq='';
if ($arg->{status} and $arg->{status} ne 'Any') {
- $statusq = " AND Job.JobStatus = '$arg->{status}' ";
+ $statusq = " AND $jobt.JobStatus = '$arg->{status}' ";
}
my $levelq='';
if ($arg->{level} and $arg->{level} ne 'Any') {
}
my $levelq='';
if ($arg->{level} and $arg->{level} ne 'Any') {
- $levelq = " AND Job.Level = '$arg->{level}' ";
+ $levelq = " AND $jobt.Level = '$arg->{level}' ";
my $jobnameq='';
if ($arg->{jjobnames}) {
my $jobnameq='';
if ($arg->{jjobnames}) {
- $jobnameq = " AND Job.Name IN ($arg->{jjobnames}) ";
+ $jobnameq = " AND $jobt.Name IN ($arg->{jjobnames}) ";
} else {
$arg->{jjobnames} = 'all'; # skip warning
}
} else {
$arg->{jjobnames} = 'all'; # skip warning
}
- UNIX_TIMESTAMP(Job.StartTime) AS starttime,
+ UNIX_TIMESTAMP($jobt.StartTime) AS starttime,
Client.Name AS clientname,
Client.Name AS clientname,
- Job.Name AS jobname,
- Job.JobBytes AS jobbytes
-FROM Job, Client, FileSet
-WHERE Job.ClientId = Client.ClientId
- AND Job.FileSetId = FileSet.FileSetId
- AND Job.Type = 'B'
+ $jobt.Name AS jobname,
+ $jobt.JobBytes AS jobbytes
+FROM $jobt, Client, FileSet
+WHERE $jobt.ClientId = Client.ClientId
+ AND $jobt.FileSetId = FileSet.FileSetId
+ AND $jobt.Type = 'B'
$clientq
$statusq
$filesetq
$clientq
$statusq
$filesetq
- UNIX_TIMESTAMP(Job.StartTime) AS starttime,
+ UNIX_TIMESTAMP($jobt.StartTime) AS starttime,
Client.Name AS clientname,
Client.Name AS clientname,
- Job.Name AS jobname,
- Job.JobFiles AS jobfiles
-FROM Job, Client, FileSet
-WHERE Job.ClientId = Client.ClientId
- AND Job.FileSetId = FileSet.FileSetId
- AND Job.Type = 'B'
+ $jobt.Name AS jobname,
+ $jobt.JobFiles AS jobfiles
+FROM $jobt, Client, FileSet
+WHERE $jobt.ClientId = Client.ClientId
+ AND $jobt.FileSetId = FileSet.FileSetId
+ AND $jobt.Type = 'B'
$clientq
$statusq
$filesetq
$clientq
$statusq
$filesetq
}
# it works only with postgresql at this time
}
# it works only with postgresql at this time
+# we dont use $jobt because we use File, so job is in Job table
elsif ($graph eq 'file_histo' and $arg->{where}) {
my $dir = $dbh->quote(dirname($arg->{where}) . '/');
elsif ($graph eq 'file_histo' and $arg->{where}) {
my $dir = $dbh->quote(dirname($arg->{where}) . '/');
- UNIX_TIMESTAMP(Job.StartTime) AS starttime,
+ UNIX_TIMESTAMP($jobt.StartTime) AS starttime,
Client.Name AS clientname,
Client.Name AS clientname,
- Job.Name AS jobname,
- Job.JobBytes /
+ $jobt.Name AS jobname,
+ $jobt.JobBytes /
($bweb->{sql}->{SEC_TO_INT}(
$bweb->{sql}->{UNIX_TIMESTAMP}(EndTime)
- $bweb->{sql}->{UNIX_TIMESTAMP}(StartTime)) + 0.01)
AS rate
($bweb->{sql}->{SEC_TO_INT}(
$bweb->{sql}->{UNIX_TIMESTAMP}(EndTime)
- $bweb->{sql}->{UNIX_TIMESTAMP}(StartTime)) + 0.01)
AS rate
-FROM Job, Client, FileSet
-WHERE Job.ClientId = Client.ClientId
- AND Job.FileSetId = FileSet.FileSetId
- AND Job.Type = 'B'
+FROM $jobt, Client, FileSet
+WHERE $jobt.ClientId = Client.ClientId
+ AND $jobt.FileSetId = FileSet.FileSetId
+ AND $jobt.Type = 'B'
$clientq
$statusq
$filesetq
$clientq
$statusq
$filesetq
- UNIX_TIMESTAMP(Job.StartTime) AS starttime,
+ UNIX_TIMESTAMP($jobt.StartTime) AS starttime,
Client.Name AS clientname,
Client.Name AS clientname,
$bweb->{sql}->{SEC_TO_INT}( $bweb->{sql}->{UNIX_TIMESTAMP}(EndTime)
- $bweb->{sql}->{UNIX_TIMESTAMP}(StartTime))
AS duration
$bweb->{sql}->{SEC_TO_INT}( $bweb->{sql}->{UNIX_TIMESTAMP}(EndTime)
- $bweb->{sql}->{UNIX_TIMESTAMP}(StartTime))
AS duration
-FROM Job, Client, FileSet
-WHERE Job.ClientId = Client.ClientId
- AND Job.FileSetId = FileSet.FileSetId
- AND Job.Type = 'B'
+FROM $jobt, Client, FileSet
+WHERE $jobt.ClientId = Client.ClientId
+ AND $jobt.FileSetId = FileSet.FileSetId
+ AND $jobt.Type = 'B'
$clientq
$statusq
$filesetq
$clientq
$statusq
$filesetq
if ($t eq 'sum' or $t eq 'avg') {
push @arg, ('y_number_format' => \&Bweb::human_size);
}
if ($t eq 'sum' or $t eq 'avg') {
push @arg, ('y_number_format' => \&Bweb::human_size);
}
+
+ my $stime = $bweb->{sql}->{"STARTTIME_$d"};
+ $stime =~ s/Job\./$jobt\./;
- " . ($per_t?"":"UNIX_TIMESTAMP") . "(" . $bweb->{sql}->{"STARTTIME_$d"} . ") AS A,
+ " . ($per_t?"":"UNIX_TIMESTAMP") . "($stime) AS A,
-FROM Job, Client, FileSet
-WHERE Job.ClientId = Client.ClientId
- AND Job.FileSetId = FileSet.FileSetId
- AND Job.Type = 'B'
+FROM $jobt, Client, FileSet
+WHERE $jobt.ClientId = Client.ClientId
+ AND $jobt.FileSetId = FileSet.FileSetId
+ AND $jobt.Type = 'B'
$clientq
$statusq
$filesetq
$clientq
$statusq
$filesetq
<tr><td>fv_write_path :</td>
<td> <input class="formulaire" title="Este directorio debe tener permisos de escritura para el usuario apache y debe ser accesible en /bweb/fv" type='text' value='<TMPL_VAR fv_write_path>' size='64' name='fv_write_path'>
</td></tr>
<tr><td>fv_write_path :</td>
<td> <input class="formulaire" title="Este directorio debe tener permisos de escritura para el usuario apache y debe ser accesible en /bweb/fv" type='text' value='<TMPL_VAR fv_write_path>' size='64' name='fv_write_path'>
</td></tr>
+ <tr><td>stat_job_table :</td>
+ <td> <input class="formulaire" title="You can choose the Job table that you want to use to get statistics" type='text' value='<TMPL_IF stat_job_table><TMPL_VAR stat_job_table><TMPL_ELSE>Job</TMPL_IF>' size='64' name='stat_job_table'>
<tr><td>bconsole :</td>
<td> <input class="formulaire" type='text' value='<TMPL_VAR bconsole>' size='64' name='bconsole'>
</td></tr>
<tr><td>bconsole :</td>
<td> <input class="formulaire" type='text' value='<TMPL_VAR bconsole>' size='64' name='bconsole'>
</td></tr>
<tr><td title="/path/a/tu/template_dir">template_dir :</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="/path/a/a/font.ttf">graph_font :</td> <td> <TMPL_VAR graph_font> </td></tr>
<tr><td title="Este directorio debe tener permisos de escritura para el usuario apache y debe ser accesible en /bweb/fv">fv_write_path :</td> <td> <TMPL_VAR fv_write_path> </td></tr>
<tr><td title="/path/a/tu/template_dir">template_dir :</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="/path/a/a/font.ttf">graph_font :</td> <td> <TMPL_VAR graph_font> </td></tr>
<tr><td title="Este directorio debe tener permisos de escritura para el usuario apache y debe ser accesible en /bweb/fv">fv_write_path :</td> <td> <TMPL_VAR fv_write_path> </td></tr>
+ <tr><td title="You can choose the Job table that you want to use to get statistics">stat_job_table :</td> <td> <TMPL_IF stat_job_table><TMPL_VAR stat_job_table><TMPL_ELSE>Job</TMPL_IF> </td></tr>
<tr><td title="/path/a/bconsole -n -c /path/to/bconsole.conf">bconsole :</td> <td> <TMPL_VAR bconsole> </td></tr>
<tr><td>debug :</td> <td> <TMPL_VAR debug> </td></tr>
<TMPL_IF achs>
<tr><td title="/path/a/bconsole -n -c /path/to/bconsole.conf">bconsole :</td> <td> <TMPL_VAR bconsole> </td></tr>
<tr><td>debug :</td> <td> <TMPL_VAR debug> </td></tr>
<TMPL_IF achs>
<tr><td>fv_write_path :</td>
<td> <input class="formulaire" title="Ce répertoire doit être accessible en écriture pour apache et être sous /bweb/fv" type='text' value='<TMPL_VAR fv_write_path>' size='64' name='fv_write_path'>
</td></tr>
<tr><td>fv_write_path :</td>
<td> <input class="formulaire" title="Ce répertoire doit être accessible en écriture pour apache et être sous /bweb/fv" type='text' value='<TMPL_VAR fv_write_path>' size='64' name='fv_write_path'>
</td></tr>
+ <tr><td>stat_job_table :</td>
+ <td> <input class="formulaire" title="Vous pouvez choisir une autre table que Job pour calculer vos statisques" type='text' value='<TMPL_IF stat_job_table><TMPL_VAR stat_job_table><TMPL_ELSE>Job</TMPL_IF>' size='64' name='stat_job_table'>
+ </td></tr>
<tr><td>bconsole :</td>
<td> <input class="formulaire" title="/chemin/vers/bconsole -n -c /chemin/vers/bconsole.conf" type='text' value='<TMPL_VAR NAME=bconsole>' size='64' name='bconsole'>
</td></tr>
<tr><td>bconsole :</td>
<td> <input class="formulaire" title="/chemin/vers/bconsole -n -c /chemin/vers/bconsole.conf" type='text' value='<TMPL_VAR NAME=bconsole>' size='64' name='bconsole'>
</td></tr>
<tr><td title="/chemin/vers/votre/template_dir">template_dir :</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="/chemin/vers/une/font.ttf">graph_font :</td> <td> <TMPL_VAR graph_font> </td></tr>
<tr><td title="Ce répertoire doit être accessible en ecriture pour apache et être sous /bweb/fv">fv_write_path :</td> <td> <TMPL_VAR fv_write_path> </td></tr>
<tr><td title="/chemin/vers/votre/template_dir">template_dir :</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="/chemin/vers/une/font.ttf">graph_font :</td> <td> <TMPL_VAR graph_font> </td></tr>
<tr><td title="Ce répertoire doit être accessible en ecriture pour apache et être sous /bweb/fv">fv_write_path :</td> <td> <TMPL_VAR fv_write_path> </td></tr>
+ <tr><td title="Vous pouvez utiliser une autre table que Job pour vos statistiques">stat_job_table :</td> <td> <TMPL_IF stat_job_table><TMPL_VAR stat_job_table><TMPL_ELSE>Job</TMPL_IF> </td></tr>
<tr><td title="/chemin/vers/bconsole -n -c /chemin/vers/bconsole.conf">bconsole :</td> <td> <TMPL_VAR bconsole> </td></tr>
<tr><td>debug :</td> <td> <TMPL_VAR debug> </td></tr>
<TMPL_IF achs>
<tr><td title="/chemin/vers/bconsole -n -c /chemin/vers/bconsole.conf">bconsole :</td> <td> <TMPL_VAR bconsole> </td></tr>
<tr><td>debug :</td> <td> <TMPL_VAR debug> </td></tr>
<TMPL_IF achs>
<td> <input class="formulaire" type='text' value='10' name='cost' size='3'>
</td>
</tr>
<td> <input class="formulaire" type='text' value='10' name='cost' size='3'>
</td>
</tr>
+ <tr><td>En ligne :</td>
<td> <input class="formulaire" type='checkbox' value='10' name='enabled'>
</td>
</tr>
<td> <input class="formulaire" type='checkbox' value='10' name='enabled'>
</td>
</tr>
bconsole => qr!^(.+)?$!,
syslog_file => qr!^(.+)?$!,
log_dir => qr!^(.+)?$!,
bconsole => qr!^(.+)?$!,
syslog_file => qr!^(.+)?$!,
log_dir => qr!^(.+)?$!,
+ stat_job_table => qr!^(\w*)$!,
</td></tr>
<tr><td>fv_write_path :</td>
<td> <input class="formulaire" title="This folder must be writable by apache user and must be accessible on /bweb/fv" type='text' value='<TMPL_VAR fv_write_path>' size='64' name='fv_write_path'>
</td></tr>
<tr><td>fv_write_path :</td>
<td> <input class="formulaire" title="This folder must be writable by apache user and must be accessible on /bweb/fv" type='text' value='<TMPL_VAR fv_write_path>' size='64' name='fv_write_path'>
+ <tr><td>stat_job_table :</td>
+ <td> <input class="formulaire" title="You can choose the Job table that you want to use to get statistics" type='text' value='<TMPL_IF stat_job_table><TMPL_VAR stat_job_table><TMPL_ELSE>Job</TMPL_IF>' size='64' name='stat_job_table'>
</td></tr>
<tr><td>bconsole :</td>
<td> <input class="formulaire" type='text' value='<TMPL_VAR bconsole>' size='64' name='bconsole'>
</td></tr>
<tr><td>bconsole :</td>
<td> <input class="formulaire" type='text' value='<TMPL_VAR bconsole>' size='64' name='bconsole'>
<tr><td title="/path/to/your/template_dir">template_dir :</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="/path/to/a/font.ttf">graph_font :</td> <td> <TMPL_VAR graph_font> </td></tr>
<tr><td title="This folder must be writable by apache user and must be accessible on /bweb/fv">fv_write_path :</td> <td> <TMPL_VAR fv_write_path> </td></tr>
<tr><td title="/path/to/your/template_dir">template_dir :</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="/path/to/a/font.ttf">graph_font :</td> <td> <TMPL_VAR graph_font> </td></tr>
<tr><td title="This folder must be writable by apache user and must be accessible on /bweb/fv">fv_write_path :</td> <td> <TMPL_VAR fv_write_path> </td></tr>
+ <tr><td title="You can choose the Job table that you want to use to get statistics">stat_job_table :</td> <td> <TMPL_IF stat_job_table><TMPL_VAR stat_job_table><TMPL_ELSE>Job</TMPL_IF> </td></tr>
<tr><td title="/path/to/bconsole -n -c /path/to/bconsole.conf">bconsole :</td> <td> <TMPL_VAR bconsole> </td></tr>
<tr><td>debug :</td> <td> <TMPL_VAR debug> </td></tr>
<TMPL_IF achs>
<tr><td title="/path/to/bconsole -n -c /path/to/bconsole.conf">bconsole :</td> <td> <TMPL_VAR bconsole> </td></tr>
<tr><td>debug :</td> <td> <TMPL_VAR debug> </td></tr>
<TMPL_IF achs>