From b48ad1c7ba38f51e2113a581975f11db7228b16c Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 6 Sep 2006 18:40:39 +0000 Subject: [PATCH] kes Manual updates. kes Update examples directory. kes Remove unused variable in winservice.cpp kes Make Win32 make command build installer. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3418 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/ReleaseNotes | 6 + bacula/examples/Write-DVD-with-UDF.txt | 75 +++++++++ bacula/examples/{backup => client-backup} | 0 bacula/examples/nagios/check_bacula_pools.sh | 159 ++++++++++++++++++ bacula/examples/{ => nagios}/nagios.txt | 0 .../nagios_plugin_check_bacula.tgz | Bin bacula/kernstodo | 27 ++- bacula/projects | 52 ++++++ bacula/src/stored/dev.c | 4 +- bacula/src/version.h | 6 +- bacula/src/win32/filed/winservice.cpp | 1 - bacula/src/win32/installer/Makefile | 2 +- bacula/technotes-1.39 | 5 + 13 files changed, 329 insertions(+), 8 deletions(-) create mode 100644 bacula/examples/Write-DVD-with-UDF.txt rename bacula/examples/{backup => client-backup} (100%) create mode 100644 bacula/examples/nagios/check_bacula_pools.sh rename bacula/examples/{ => nagios}/nagios.txt (100%) rename bacula/examples/{ => nagios}/nagios_plugin_check_bacula.tgz (100%) diff --git a/bacula/ReleaseNotes b/bacula/ReleaseNotes index 35cd4cdd39..157dbbb0e1 100644 --- a/bacula/ReleaseNotes +++ b/bacula/ReleaseNotes @@ -49,6 +49,12 @@ Fixes for 1.39.20: general, it should be very fast. New Features in 1.40.0 (beginning of release info) +- Additional support for removable devices. See the + Requires Mount, Mount Point, Mount Command, and Unmount + Commands in the Storage daemon configuration chapter: + http://www.bacula.org/dev-manual/Storage_Daemon_Configuratio.html + Also see the Edit Codes for Mount and Unmount Directives in the + same chapter. - There is a new cross-compiled Win32 File daemon that now has all the features that were previously only in the Unix versions. diff --git a/bacula/examples/Write-DVD-with-UDF.txt b/bacula/examples/Write-DVD-with-UDF.txt new file mode 100644 index 0000000000..17aaf63a7e --- /dev/null +++ b/bacula/examples/Write-DVD-with-UDF.txt @@ -0,0 +1,75 @@ +From stephan.ebelt@net-linx.com Fri Apr 7 21:01:24 2006 +From: Stephan Ebelt +Subject: [Bacula-devel] DVD + packet writing + UDF + +Hello, + +is anyone using this approach in production? + +I do for about a week now. And it appears to be easier to setup and is, +in fact, quite media independent. (I actually gave up on trying the +growisofs/dvd-handler method - bacula constantly rejected most of my +media...) + +Here is how it works for me (all done with bacula 1.38.5 on FC4 with the +udftools package installed): + +1. load udf file system support (modprobe udf) + +2. create a packet writing device on top of the dvd drive (pktsetup + dvd-writer /dev/hdc) + +3. format a blank media with UDF file system (mkudffs --media-type=dvd + /dev/pktcdvd/dvd-writer), I tried with DVD-RAM, DVD+RW and CD-RW + media. All appear to work fine - at different speeds of course. + +4. mount the freshly formatted media (mount -t udf + /dev/pktcdvd/dvd-writer /mnt/dvd-writer -o noatime). Note that + 'noatime' makes the media living longer. + +5. configure the SD as it would write to hard disk: + + Device { + Name = DVD-Writer + Media Type = DVD + + ArchiveDevice = /mnt/dvd-writer + + LabelMedia = no # I want only one Volume per DVD + AutomaticMount = yes + RemovableMedia = yes + AlwaysOpen = no + } + +Now the whole thing can be automated further: steps 1, 2 and 5 are +one-time system setup. + +Step 3 would require some logic to determine whether a media really is +blank. I guess something the like is already in dvd-handler?. + +Step 4 should be automatic with 1.39.5+ (with the RequiresMount, +MountPoint, MountCommand... etc... options being more general). I havn't +tried this yet. + +I do not know how stable this is yet. I am a bit concerned because I +read in a older mail (from Nicolas Boichat, end of 2004) that he +considered packet-writing/UDF as not reliable enough at that time. + +However, the few restores I tried were all successful. Also I can read +the DVDs on at least one other computer. Maybe the UDF and pkcdvd code +matured in the meantime? I'll leave it running here and keep on testing... + +best regards, +Stephan + + + +------------------------------------------------------- +This SF.Net email is sponsored by xPML, a groundbreaking scripting language +that extends applications into web and mobile media. Attend the live webcast +and join the prime developer group breaking into this new coding territory! +http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 +_______________________________________________ +Bacula-devel mailing list +Bacula-devel@lists.sourceforge.net +https://lists.sourceforge.net/lists/listinfo/bacula-devel diff --git a/bacula/examples/backup b/bacula/examples/client-backup similarity index 100% rename from bacula/examples/backup rename to bacula/examples/client-backup diff --git a/bacula/examples/nagios/check_bacula_pools.sh b/bacula/examples/nagios/check_bacula_pools.sh new file mode 100644 index 0000000000..946f83e521 --- /dev/null +++ b/bacula/examples/nagios/check_bacula_pools.sh @@ -0,0 +1,159 @@ +#! /bin/sh +# Author : Ludovic Strappazon. l.strappazon@gmail.com +# Copyright : Kern Sibbald +# Any comment, advice or enhancement are welcome :-) + +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin +MYSQL="/usr/bin/mysql -u bacula --password=mypassword" +TMP=/tmp +BACULA=/usr/local/bacula + +PROGNAME=`basename $0` +PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` +STATUS="" + +. $PROGPATH/utils.sh + +print_usage() { + echo "Usage: $PROGNAME -P -M -w -c [-S]" +} + +print_help() { + echo "" + print_usage + echo "" + echo "This plugin checks the space available in the pool against the space required for the next scheduled backups" + echo "Example : $PROGNAME -P default -M LTO -w 20 -c 10 will check the default pool, return OK if (available space) > 1,20*(required space), WARNING if 1,20*(required space) > (available space) > 1,10*(required space), and CRITICAL else." + echo "" + echo "With the -S option, it will check the pool named Scratch and return WARNING instead of CRITICAL if the Scratch pool can save the situation." + echo "Example : $PROGNAME -P default -M LTO -w 20 -c 10 -S will check the default pool, return OK if (available space) > 1,20*(required space), WARNING if 1,20*(required space) > (available space) > 1,10*(required space) or if (available space in default and Scratch) > 1,10*(required space) > (available space in default), and CRITICAL else." + echo "" + echo "The evaluation of the space required is done by adding the biggest backups of the same level than the scheduled jobs" + echo "The available space is evaluated by the number of out of retention tapes and the average VolBytes of these Full tapes" + echo "" + echo "The Information Status are : \"Required, Available, Volume Errors\" and \"Will use Scratch pool\" if necessary." + echo "" + echo "I think this plugin should be used in passive mode, and ran by a RunAfterJob" + exit 3 +} + +NB_ARGS=$# +SCRATCH=0 +while getopts :P:M:w:c:hS OPTION +do + case $OPTION in + P) POOL="$OPTARG" + ;; + M) MEDIA_TYPE="$OPTARG" + ;; + S) SCRATCH=1 + ;; + w) WARNING="$OPTARG" + ;; + c) CRITICAL="$OPTARG" + ;; + h) print_help + exit 3 + ;; + *) print_usage + exit 3 + ;; + esac +done +shift $(($OPTIND - 1)) + +if [ "$NB_ARGS" -ne 8 -a "$NB_ARGS" -ne 9 ]; then + print_revision $PROGNAME 25/05/2005 + print_usage + exit 3 +fi + +LAST_CHECK=`ps -ef | grep check_ba[Cc]ula_pools.sh | awk {'print $5'} | uniq | wc -l` +if [ "$LAST_CHECK" -gt 1 ]; then + echo "The last check was not complete, you should increase the check_period." + exit 3 +fi + + NB_VOLUMES_OUT_OF_RETENTION=`$MYSQL << EOF +USE bacula +SELECT COUNT(MediaId) from Media, Pool where Media.PoolId=Pool.PoolId and Pool.Name="$POOL" AND LastWritten <> "0000-00-00 00:00:00" AND UNIX_TIMESTAMP()-UNIX_TIMESTAMP(LastWritten)>Media.VolRetention AND Inchanger = "1"; +EOF +` + NB_VOLUMES_OUT_OF_RETENTION=`echo $NB_VOLUMES_OUT_OF_RETENTION | cut -f 2 -d ' '` + +NB_VOLUMES_ERROR=`$MYSQL << EOF +USE bacula +SELECT COUNT(MediaId) from Media, Pool where Media.PoolId=Pool.PoolId and Pool.Name="$POOL" AND VolStatus="Error" AND Inchanger = "1"; +EOF +` +NB_VOLUMES_ERROR=`echo $NB_VOLUMES_ERROR | cut -f 2 -d ' '` + +AVERAGE_CAPA_VOLUME=`$MYSQL << EOF +USE bacula +SELECT SUM(VolBytes)/COUNT(MediaId) FROM Media where VolStatus="Full" AND MediaType="$MEDIA_TYPE"; +EOF +` +AVERAGE_CAPA_VOLUME=`echo $AVERAGE_CAPA_VOLUME | cut -f 2 -d ' ' | cut -f 1 -d '.'` + +CAPA_VOLUMES_APPEND=`$MYSQL << EOF +USE bacula +SELECT SUM("$AVERAGE_CAPA_VOLUME"-VolBytes) from Media, Pool where Media.PoolId=Pool.PoolId and Pool.Name="$POOL" AND (VolStatus = "Append" OR VolStatus = "Recycle" OR VolStatus = "Purge") AND Inchanger = "1" AND MediaType="$MEDIA_TYPE"; +EOF +` +CAPA_VOLUMES_APPEND=`echo $CAPA_VOLUMES_APPEND | cut -f 2 -d ' '` + +if [ $SCRATCH -eq 1 ] +then +CAPA_VOLUMES_SCRATCH=`$MYSQL << EOF +USE bacula +SELECT SUM("$AVERAGE_CAPA_VOLUME"-VolBytes) from Media, Pool where Media.PoolId=Pool.PoolId and Pool.Name="Scratch" AND VolStatus = "Append" AND Inchanger = "1" AND MediaType="$MEDIA_TYPE"; +EOF +` +CAPA_VOLUMES_SCRATCH=`echo $CAPA_VOLUMES_SCRATCH | cut -f 2 -d ' '` +else +CAPA_VOLUMES_SCRATCH=0 +fi + +echo "st +1 +q" | $BACULA/etc/bconsole | sed -n /Scheduled/,/Running/p | grep Backup | tr -s [:blank:] | tr '[:blank:]' '@' > ${TMP}/Scheduled.txt + +CAPA_REQUIRED=0 +for LINE in `cat ${TMP}/Scheduled.txt` +do + SCHEDULED_JOB=`echo $LINE | awk -F@ '{print $6}'` + LEVEL=`echo $LINE | awk -F@ '{print $1}' | cut -c 1` + +MAX_VOLUME_JOB_FOR_LEVEL=`$MYSQL << EOF +USE bacula +SELECT MAX(JobBytes) from Job, Pool where Level="$LEVEL" AND Job.Name="$SCHEDULED_JOB" AND Job.PoolId=Pool.PoolId AND Pool.Name="$POOL"; +EOF +` +MAX_VOLUME_JOB_FOR_LEVEL=`echo $MAX_VOLUME_JOB_FOR_LEVEL | cut -f 2 -d ' ' ` + +CAPA_REQUIRED=$[CAPA_REQUIRED+MAX_VOLUME_JOB_FOR_LEVEL] +done + +rm ${TMP}/Scheduled.txt + +CAPA_WARNING=`echo $[(WARNING+100)*CAPA_REQUIRED]/100 | bc | cut -f 1 -d '.'` +CAPA_CRITICAL=`echo $[(CRITICAL+100)*CAPA_REQUIRED]/100 | bc | cut -f 1 -d '.'` +CAPA_DISP=$[NB_VOLUMES_OUT_OF_RETENTION*AVERAGE_CAPA_VOLUME+CAPA_VOLUMES_APPEND] +CAPA_DISP_INCLUDING_SCRATCH=$[CAPA_DISP+CAPA_VOLUMES_SCRATCH] + +MESSAGE="Required : $[CAPA_REQUIRED/1000000000] Go, available : $[CAPA_DISP/1000000000] Go, Volumes Error : $NB_VOLUMES_ERROR" + +if [ "$CAPA_DISP" -gt $CAPA_WARNING ]; then + echo $MESSAGE + exit 0 +elif [ "$CAPA_DISP" -gt $CAPA_CRITICAL ];then + echo $MESSAGE + exit 1 +elif [ "$CAPA_DISP_INCLUDING_SCRATCH" -gt $CAPA_CRITICAL ];then + MESSAGE="${MESSAGE}. Will use Scratch Pool !" + echo $MESSAGE + exit 1 +else + exit 2 +fi +exit 3 diff --git a/bacula/examples/nagios.txt b/bacula/examples/nagios/nagios.txt similarity index 100% rename from bacula/examples/nagios.txt rename to bacula/examples/nagios/nagios.txt diff --git a/bacula/examples/nagios_plugin_check_bacula.tgz b/bacula/examples/nagios/nagios_plugin_check_bacula.tgz similarity index 100% rename from bacula/examples/nagios_plugin_check_bacula.tgz rename to bacula/examples/nagios/nagios_plugin_check_bacula.tgz diff --git a/bacula/kernstodo b/bacula/kernstodo index ca5f74a2d7..0758a854dd 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -69,6 +69,32 @@ For 1.39: .move eject device=xxx toslot=yyy the same as above, but with a new target slot. The catalog should be updated accordingly. .move transfer device=xxx fromslot=yyy toslot=zzz +- Figure out how to configure query.sql. Suggestion to use m4: + == changequote.m4 === + changequote(`[',`]')dnl + ==== query.sql.in === + :List next 20 volumes to expire + SELECT + Pool.Name AS PoolName, + Media.VolumeName, + Media.VolStatus, + Media.MediaType, + ifdef([MySQL], + [ FROM_UNIXTIME(UNIX_TIMESTAMP(Media.LastWritten) Media.VolRetention) AS Expire, ])dnl + ifdef([PostgreSQL], + [ media.lastwritten + interval '1 second' * media.volretention as expire, ])dnl + Media.LastWritten + FROM Pool + LEFT JOIN Media + ON Media.PoolId=Pool.PoolId + WHERE Media.LastWritten>0 + ORDER BY Expire + LIMIT 20; + ==== + Command: m4 -DmySQL changequote.m4 query.sql.in >query.sql + + The problem is that it requires m4, which is not present on all machines + at ./configure time. Low priority: - Get Perl replacement for bregex.c @@ -1658,4 +1684,3 @@ Block Position: 0 > the Volumes in the magazine disabled prior to taking them offsite, and mark > them all enabled when bringing them back on site. Coupled with the options > to the slots keyword, you can apply the enable/disable to any or all volumes. - diff --git a/bacula/projects b/bacula/projects index 69b1a556d8..76c0e48a76 100644 --- a/bacula/projects +++ b/bacula/projects @@ -1022,3 +1022,55 @@ Notes: Legato Networker supports a similar system with full, incr, and 1-9 as Kern notes: I think this would add very little functionality, but a *lot* of additional overhead to Bacula. + +Item 1: include JobID in spool file name + Origin: Mark Bergman + Date: Tue Aug 22 17:13:39 EDT 2006 + Status: + + What: Change the name of the spool file to include the JobID + + Why: JobIDs are the common key used to refer to jobs, yet the + spoolfile name doesn't include that information. The date/time + stamp is useful (and should be retained). + + + +Item 2: include timestamp of job launch in "stat clients" output + Origin: Mark Bergman + Date: Tue Aug 22 17:13:39 EDT 2006 + Status: + + What: The "stat clients" command doesn't include any detail on when + the active backup jobs were launched. + + Why: Including the timestamp would make it much easier to decide whether + a job is running properly. + + Notes: It may be helpful to have the output from "stat clients" formatted + more like that from "stat dir" (and other commands), in a column + format. The per-client information that's currently shown (level, + client name, JobId, Volume, pool, device, Files, etc.) is good, but + somewhat hard to parse (both programmatically and visually), + particularly when there are many active clients. + +Item 1: Filesystemwatch triggered backup. + Date: 31 August 2006 + Origin: Jesper Krogh + Status: Unimplemented, depends probably on "client initiated backups" + + What: With inotify and similar filesystem triggeret notification + systems is it possible to have the file-daemon to monitor + filesystem changes and initiate backup. + + Why: There are 2 situations where this is nice to have. + 1) It is possible to get a much finer-grained backup than + the fixed schedules used now.. A file created and deleted + a few hours later, can automatically be caught. + + 2) The introduced load on the system will probably be + distributed more even on the system. + + Notes: This can be combined with configration that specifies + something like: "at most every 15 minutes or when changes + consumed XX MB". diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index 2ba6fa455f..e3bcda034e 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -432,7 +432,7 @@ void DEVICE::open_file_device(DCR *dcr, int omode) pm_strcpy(archive_name, dev_name); /* * If this is a virtual autochanger (i.e. changer_res != NULL) - * we simply use the deviced name, assuming it has been + * we simply use the device name, assuming it has been * appropriately setup by the "autochanger". */ if (!device->changer_res) { @@ -1908,7 +1908,7 @@ bool DEVICE::do_mount(int mount, int dotimeout) Dmsg1(20, "do_mount run_prog=%s\n", ocmd.c_str()); while ((status = run_program_full_output(ocmd.c_str(), max_open_wait/2, results)) != 0) { - /* Doesn't work with internationalisation (This is not a problem) */ + /* Doesn't work with internationalization (This is not a problem) */ if (fnmatch("*is already mounted on", results, 0) == 0) { break; } diff --git a/bacula/src/version.h b/bacula/src/version.h index ef3500c71c..5f68f53358 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "1.39.21" -#define BDATE "04 Septermber 2006" -#define LSMDATE "04Sep06" +#define VERSION "1.39.22" +#define BDATE "06 Septermber 2006" +#define LSMDATE "06Sep06" #define BYEAR "2006" /* year for copyright messages in progs */ /* Debug flags */ diff --git a/bacula/src/win32/filed/winservice.cpp b/bacula/src/win32/filed/winservice.cpp index f386abc89d..ed5054f4f3 100644 --- a/bacula/src/win32/filed/winservice.cpp +++ b/bacula/src/win32/filed/winservice.cpp @@ -326,7 +326,6 @@ bacService::InstallService(const char *pszCmdLine) const int pathlength = 2048; char path[pathlength]; char servicecmd[pathlength]; - int len; // Get the filename of this executable if (GetModuleFileName(NULL, path, pathlength-(strlen(BaculaRunService)+2)) == 0) { diff --git a/bacula/src/win32/installer/Makefile b/bacula/src/win32/installer/Makefile index dbfba40c82..74636fcaa6 100644 --- a/bacula/src/win32/installer/Makefile +++ b/bacula/src/win32/installer/Makefile @@ -97,7 +97,7 @@ SCRIPTS := \ .PHONY: all clean installer -all: +all: $(INSTALL_EXE) installer: $(INSTALL_EXE) diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index 5018864e33..9780ec87ad 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,6 +1,11 @@ Technical notes on version 1.39 General: +06Sep06 +kes Manual updates. +kes Update examples directory. +kes Remove unused variable in winservice.cpp +kes Make Win32 make command build installer. 04Sep06 kes Correct dvd code that breaks tape labeling. kes Implement Enabled on update slots. -- 2.39.5