In the message dated: Tue, 28 Aug 2007 09:49:35 +0200,
The pithy ruminations from Arno Lehmann on 
<Re: [Bacula-users] "status dir" and scheduled jobs> were:
=> Hi,
=> 
=> 28.08.2007 02:35,, Charles Sprickman wrote::
=> > Hi all,
=> > 
=> > I'm starting to work on a script to alert me to what tapes will be needed 
=> > for upcoming runs.  According to the manual (I think), this info should be 
=> > shown in the "status dir" output.
=> > 

        [SNIP!]

=> 
=> I don't thinky you screwed up anything... the problem is that Bacula 
=> does not look ahead in time during a 'sta dir' command. Most of the 
=> time, the "*unknown*" volume display is caused by having no volumes 
=> available at the time of the display, but later, volumes might get 
=> recycled.
=> 
=> By the way: Given that Bacula works with an implicit "Accept Any 
=> Volume" setting anyway, the exact volume to be used is only partly 
=> interesting. Having the pool which will be used displayed would, in 
=> many cases, be more informative.

I agree.

Here's my solution to the question:


I run a script (after the nightly catalog backup) to produce a report of:

        what tapes are in the changer that are in need of replacement

        what tapes are available for reuse

        what backups are scheduled for the next day

        estimates of the size of the upcoming backups,
        how many volumes will be required, and how many
        volumes are available in the changer in the 
        specificed pool and the Scratch pool


I've attached the "dailyreport" script, which depends on the 
"bacula_pool_report" script (also attached). The "dailyreport" script also 
depends on two SQL queries. These could be embedded in the script, but since I 
call the queries manually as well, they are in my "query.sql" file. In my case, 
they happen to be numbered queries 18 & 24 (and those numbers are hard-coded 
into the "dailyreport" script). The queries are:

########################################
# 18
:List Volumes in the changer that are in need of replacement
SELECT VolumeName As VolName,Storage.Name AS Storage,Slot,Pool.Name AS 
Pool,MediaType,VolStatus AS
 Status, VolErrors AS Errors
  FROM Media,Pool,Storage
  WHERE Media.PoolId=Pool.PoolId
  AND Slot>0 AND InChanger=1
  AND Media.StorageId=Storage.StorageId
  AND ( (VolErrors>0) OR (VolStatus='Error') OR 
         (VolStatus='Disabled') OR (VolStatus='Full'))
  ORDER BY Slot ASC, VolumeName;
###############################################################
# 24
:Find next volumes to load
SELECT VolumeName AS VolName,Pool.Name AS Pool,MediaType AS Type,VolStatus AS 
Status, InChanger
  FROM Media,Pool,Storage
  WHERE Media.PoolId=Pool.PoolId
        AND InChanger=0
        AND Media.StorageId=Storage.StorageId
        AND ( VolStatus IN ('Purged', 'Recycle') OR Pool.Name='Scratch')
  ORDER BY VolumeName;
##################################################################
        

                        
=> 
=> Arno
=> 
=> > Thanks,
=> > 
=> > Charles

Attachment: dailyreport
Description: dailyreport

Attachment: bacula_pool_report
Description: bacula_pool_report

----
Mark Bergman                      [EMAIL PROTECTED]
System Administrator
Section of Biomedical Image Analysis             215-662-7310
Department of Radiology,           University of Pennsylvania

http://pgpkeys.pca.dfn.de:11371/pks/lookup?search=mark.bergman%40.uphs.upenn.edu
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to