| 1 |
\chapter{Using \bacula{} catalog to grab information} |
| 2 |
\label{blb: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 \ac{SLA} indicators, you could use a few \acs{SQL} queries on the \btable{Job} table to report how many: |
| 15 |
|
| 16 |
\begin{bitemize} |
| 17 |
\item jobs have run |
| 18 |
\item jobs have been successful |
| 19 |
\item files have been backed up |
| 20 |
\item \ldots{} |
| 21 |
\end{bitemize} |
| 22 |
|
| 23 |
However, these statistics are accurate only if your job retention is greater |
| 24 |
than your statistics period. I.e, if jobs are purged from the catalog, you won't |
| 25 |
be able to use them. |
| 26 |
|
| 27 |
Now, you can use the \bcommandname{update stats [days=num]} console command to fill |
| 28 |
the \btable{JobHisto} table with new Job records. If you want to be sure to take in |
| 29 |
account only \textbf{good jobs}, ie if one of your important job has failed but |
| 30 |
you have fixed the problem and restarted it on time, you probably want to |
| 31 |
delete the first \emph{bad} job record and keep only the successful one. For |
| 32 |
that simply let your staff do the job, and update \btable{JobHisto} table after two or |
| 33 |
three days depending on your organization using the \textbf{[days=num]} option. |
| 34 |
|
| 35 |
These statistics records aren't used for restoring, but mainly for |
| 36 |
capacity planning, billings, etc. |
| 37 |
|
| 38 |
The \bweb{} interface provides a statistics module that can use this feature. You |
| 39 |
can also use tools like Talend or extract information by yourself. |
| 40 |
|
| 41 |
The \textbf{Statistics Retention = \bbracket{time}} director directive defines |
| 42 |
the length of time that \bacula{} will keep statistics job records in the Catalog |
| 43 |
|
| 44 |
database after the Job End time. (In \btable{JobHisto} table) When this time |
| 45 |
period expires, and if user runs \bcommandname{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{bVerbatim} |
| 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{bVerbatim} |