]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/en/concepts/statistics.tex
a5732a46e9e9ce2d60ac05bf663624b6aef3c9d5
[bacula/docs] / docs / manuals / en / concepts / statistics.tex
1 \chapter{Using Bacula catalog to grab information}
2 \label{UseBaculaCatalogToExtractInformationChapter}
3 \index[general]{Statistics}
4
5 Bacula catalog contains lot of information about your IT infrastructure, how
6 many files, their size, the number of video or music files etc. Using Bacula
7 catalog during the day to get them permit to save resources on your servers.
8
9 In this chapter, you will find tips and information to measure bacula
10 efficiency and report statistics.
11
12 \section{Job statistics}
13 If you (or probably your boss) want to have statistics on your backups to
14 provide some \textit{Service Level Agreement} indicators, you could use a few
15 SQL queries on the Job table to report how many:
16
17 \begin{itemize}
18 \item jobs have run
19 \item jobs have been successful
20 \item files have been backed up
21 \item ...
22 \end{itemize}
23
24 However, these statistics are accurate only if your job retention is greater
25 than your statistics period. Ie, if jobs are purged from the catalog, you won't
26 be able to use them. 
27
28 Now, you can use the \textbf{update stats [days=num]} console command to fill
29 the JobHistory table with new Job records. If you want to be sure to take in
30 account only \textbf{good jobs}, ie if one of your important job has failed but
31 you have fixed the problem and restarted it on time, you probably want to
32 delete the first \textit{bad} job record and keep only the successful one. For
33 that simply let your staff do the job, and update JobHistory table after two or
34 three days depending on your organization using the \textbf{[days=num]} option.
35
36 These statistics records aren't used for restoring, but mainly for
37 capacity planning, billings, etc.
38
39 The Bweb interface provides a statistics module that can use this feature. You
40 can also use tools like Talend or extract information by yourself.
41
42 The \textbf{Statistics Retention = \lt{}time\gt{}} director directive defines
43 the length of time that Bacula will keep statistics job records in the Catalog
44 database after the Job End time. (In \texttt{JobHistory} table) When this time
45 period expires, and if user runs \texttt{prune stats} command, Bacula will
46 prune (remove) Job records that are older than the specified period.
47
48 You can use the following Job resource in your nightly \textbf{BackupCatalog}
49 job to maintain statistics.
50 \begin{verbatim}
51 Job {
52   Name = BackupCatalog
53   ...
54   RunScript {
55     Console = "update stats days=3"
56     Console = "prune stats yes"
57     RunsWhen = After
58     RunsOnClient = no
59   }
60 }
61 \end{verbatim}