]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Manual updates.
authorKern Sibbald <kern@sibbald.com>
Wed, 6 Sep 2006 18:40:39 +0000 (18:40 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 6 Sep 2006 18:40:39 +0000 (18:40 +0000)
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

16 files changed:
bacula/ReleaseNotes
bacula/examples/Write-DVD-with-UDF.txt [new file with mode: 0644]
bacula/examples/backup [deleted file]
bacula/examples/client-backup [new file with mode: 0755]
bacula/examples/nagios.txt [deleted file]
bacula/examples/nagios/check_bacula_pools.sh [new file with mode: 0644]
bacula/examples/nagios/nagios.txt [new file with mode: 0644]
bacula/examples/nagios/nagios_plugin_check_bacula.tgz [new file with mode: 0644]
bacula/examples/nagios_plugin_check_bacula.tgz [deleted file]
bacula/kernstodo
bacula/projects
bacula/src/stored/dev.c
bacula/src/version.h
bacula/src/win32/filed/winservice.cpp
bacula/src/win32/installer/Makefile
bacula/technotes-1.39

index 35cd4cdd39670a74ab1e272d4dad6ac6efa51873..157dbbb0e16dc5755392b3fe71006476bfd5b0e9 100644 (file)
@@ -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 (file)
index 0000000..17aaf63
--- /dev/null
@@ -0,0 +1,75 @@
+From stephan.ebelt@net-linx.com Fri Apr  7 21:01:24 2006
+From: Stephan Ebelt <stephan.ebelt@net-linx.com>
+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/backup
deleted file mode 100755 (executable)
index e488b6f..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-#
-#  A small script to start a Backup job from any Client machine
-#
-# You may need to add a full path and possibly the console.conf location
-#
-# Assume we are in the binary directory
-#
-JOB="NightlySave"
-#
-./console -c console.conf <<END_OF_DATA
-run ${JOB}
-y
-quit
-END_OF_DATA
diff --git a/bacula/examples/client-backup b/bacula/examples/client-backup
new file mode 100755 (executable)
index 0000000..e488b6f
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+#  A small script to start a Backup job from any Client machine
+#
+# You may need to add a full path and possibly the console.conf location
+#
+# Assume we are in the binary directory
+#
+JOB="NightlySave"
+#
+./console -c console.conf <<END_OF_DATA
+run ${JOB}
+y
+quit
+END_OF_DATA
diff --git a/bacula/examples/nagios.txt b/bacula/examples/nagios.txt
deleted file mode 100644 (file)
index 03af140..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-Subject: RE: [Bacula-users] monitoring bacula with Nagios
-From: "Julian Hein" <jhein@netways.de>
-To: <bacula-users@lists.sourceforge.net>
-
-Hi,
-
-> Anyway: I would really like to write such a check_bacula 
-> plugin. I just 
-> don't know what I need to implement to achive a successful 
-> authentication. And maybe to get some infos out. Like current 
-> number of 
-> jobs, runtime or so.
-
-We are checking bacula with Nagios in two ways: First we check all servers if the neccessary services are running, like the fd on all bacula clients (windows & linux), directors, sd, etc. And the second check is to look in baculas mysql database if there is a successful job for every host within the last 24 hours:
-
-
-1. Check if the fd is running
-=============================
-
-Services:
----------
-
-# bacula-fd linux
-check_command                   check_spezial_procs_by_ssh!2:!1:!bacula-fd
-
-# bacula-sd
-check_command                   check_spezial_procs_by_ssh!2:!1:!bacula-sd
-
-# bacula-dir
-check_command                   check_spezial_procs_by_ssh!2:!1:!bacula-dir
-
-# bacula-fd windows
-check_command                   check_nt_service!bacula
-
-Commands:
----------
-
-# check for services by name with ssh
-define command {
-  command_name  check_spezial_procs_by_ssh
-  command_line  $USER1$/check_by_ssh -t 60 -H $HOSTADDRESS$ -C "/opt/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -C $ARG3$"
-}
-
-# check for the bacula-fd on windows with nsclient
-define command {
-  command_name  check_nt_service
-  command_line  $USER1$/check_nt -H $HOSTADDRESS$ -p portno. -s password -v SERVICESTATE -l $ARG1$
-}
-
-2. Is there a successful job in the database
-============================================
-
-Services:
----------
-
-# bacula jobs
-check_command    check_bacula_by_ssh!27!1!1
-
-Commands:
----------
-The name of our backup jobs have to match the hostname in Nagios. So we can check on the backup server, for a job called $HOSTNAME$:
-
-define command {
-  command_name    check_bacula_by_ssh
-  command_line    $USER1$/check_by_ssh  -t 60 -H my.backup.server -C "/opt/nagios/libexec/check_bacula.pl -H $ARG1$ -w $
-ARG2$ -c $ARG3$ -j $HOSTNAME$"
-}
-
-check_bacula.pl:
-----------------
-
-#!/usr/bin/perl -w
-use strict;
-use POSIX;
-use File::Basename;
-use DBI;
-use Getopt::Long;
-use vars qw(
-       $opt_help
-           $opt_job
-           $opt_critical
-           $opt_warning
-           $opt_hours
-           $opt_usage
-           $opt_version
-           $out
-           $sql
-           $date_start
-           $date_stop
-           $state
-           $count
-           );
-           
-sub print_help();
-sub print_usage();
-sub get_now();
-sub get_date;
-
-my $progname = basename($0);
-
-my %ERRORS = (  'UNKNOWN'       =>      '-1',
-                'OK'            =>      '0',
-                'WARNING'       =>      '1',
-                'CRITICAL'      =>      '2');
-
-Getopt::Long::Configure('bundling');
-GetOptions
-        (
-        "c=s"   =>      \$opt_critical, "critical=s"    =>      \$opt_critical,
-        "w=s"   =>      \$opt_warning,  "warning=s"     =>      \$opt_warning,
-        "H=s"   =>      \$opt_hours,    "hours=s"       =>      \$opt_hours,
-        "j=s"   =>      \$opt_job,      "job=s"         =>      \$opt_job,
-        "h"     =>      \$opt_help,     "help"          =>      \$opt_help,
-                                        "usage"         =>      \$opt_usage,
-        "V"     =>      \$opt_version,  "version"       =>      \$opt_version
-        ) || die "Try '$progname --help' for more information.\n";
-
-sub print_help() {
-print "\n";
-print "PRINT HELP...\n";
-print "\n";
-}
-
-sub print_usage() {
- print "PRINT USAGE...\n";
- print "\n";
-}
-
-sub get_now() {
- my $now  = defined $_[0] ? $_[0] : time;
- my $out = strftime("%Y-%m-%d %X", localtime($now));
- return($out);
-}
-
-sub get_date {
- my $day = shift;
- my $now  = defined $_[0] ? $_[0] : time;
- my $new = $now - ((60*60*1) * $day);
- my $out = strftime("%Y-%m-%d %X", localtime($new));
- return ($out);
-}
-
-if ($opt_help) {
- print_help();
- exit $ERRORS{'UNKNOWN'};
-}
-
-if ($opt_usage) {
- print_usage();
- exit $ERRORS{'UNKNOWN'};
-}
-
-if ($opt_version) {
- print "$progname 0.0.1\n";
- exit $ERRORS{'UNKNOWN'};
-}
-
-
-if ($opt_job && $opt_warning && $opt_critical) {
- my $dsn = "DBI:mysql:database=bacula;host=localhost";
- my $dbh = DBI->connect( $dsn,'root','' ) or die "Error connecting to: '$dsn': $DBI::errstr\n";
- if ($opt_hours)
- {
-  $date_stop = get_date($opt_hours);
- }
-  else
-  {
-   $date_stop = '1970-01-01 01:00:00';
-  }
- $date_start = get_now();
- $sql = "SELECT count(*) as 'count' from Job where (Name='$opt_job') and (JobStatus='T') and (EndTime <> '') and ((EndTime <= '$date_start') and (EndTime >= '$date_stop'));";
-
- my $sth = $dbh->prepare($sql) or die "Error preparing statemment",$dbh->errstr;
- $sth->execute;
- while (my @row = $sth->fetchrow_array()) {
-  ($count) = @row;
- }
-$state = 'OK';
-if ($count<$opt_warning) { $state='WARNING' }
-if ($count<$opt_critical) { $state='CRITICAL' }
-
-print "Bacula $state: Found $count successfull jobs\n";
-exit $ERRORS{$state};
- $dbh->disconnect();
-}
- else {
-  print_usage();
- }
-
-Well, this script is not really finished, but it works for us. Maybe it is helpful for you. If somebody makes enhancements, I would be happy to recieve a copy.
-
-cu,
-Julian
-
--- 
-Julian Hein                   NETWAYS GmbH
-Managing Director             Deutschherrnstr. 47a
-Fon.0911/92885-0              D-90429 Nürnberg
-Fax.0911/92885-31                                        
-jhein@netways.de              www.netways.de     
-
diff --git a/bacula/examples/nagios/check_bacula_pools.sh b/bacula/examples/nagios/check_bacula_pools.sh
new file mode 100644 (file)
index 0000000..946f83e
--- /dev/null
@@ -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 <pool> -M <media-type> -w <warning threshold> -c <critical threshold> [-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/nagios.txt b/bacula/examples/nagios/nagios.txt
new file mode 100644 (file)
index 0000000..03af140
--- /dev/null
@@ -0,0 +1,205 @@
+Subject: RE: [Bacula-users] monitoring bacula with Nagios
+From: "Julian Hein" <jhein@netways.de>
+To: <bacula-users@lists.sourceforge.net>
+
+Hi,
+
+> Anyway: I would really like to write such a check_bacula 
+> plugin. I just 
+> don't know what I need to implement to achive a successful 
+> authentication. And maybe to get some infos out. Like current 
+> number of 
+> jobs, runtime or so.
+
+We are checking bacula with Nagios in two ways: First we check all servers if the neccessary services are running, like the fd on all bacula clients (windows & linux), directors, sd, etc. And the second check is to look in baculas mysql database if there is a successful job for every host within the last 24 hours:
+
+
+1. Check if the fd is running
+=============================
+
+Services:
+---------
+
+# bacula-fd linux
+check_command                   check_spezial_procs_by_ssh!2:!1:!bacula-fd
+
+# bacula-sd
+check_command                   check_spezial_procs_by_ssh!2:!1:!bacula-sd
+
+# bacula-dir
+check_command                   check_spezial_procs_by_ssh!2:!1:!bacula-dir
+
+# bacula-fd windows
+check_command                   check_nt_service!bacula
+
+Commands:
+---------
+
+# check for services by name with ssh
+define command {
+  command_name  check_spezial_procs_by_ssh
+  command_line  $USER1$/check_by_ssh -t 60 -H $HOSTADDRESS$ -C "/opt/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -C $ARG3$"
+}
+
+# check for the bacula-fd on windows with nsclient
+define command {
+  command_name  check_nt_service
+  command_line  $USER1$/check_nt -H $HOSTADDRESS$ -p portno. -s password -v SERVICESTATE -l $ARG1$
+}
+
+2. Is there a successful job in the database
+============================================
+
+Services:
+---------
+
+# bacula jobs
+check_command    check_bacula_by_ssh!27!1!1
+
+Commands:
+---------
+The name of our backup jobs have to match the hostname in Nagios. So we can check on the backup server, for a job called $HOSTNAME$:
+
+define command {
+  command_name    check_bacula_by_ssh
+  command_line    $USER1$/check_by_ssh  -t 60 -H my.backup.server -C "/opt/nagios/libexec/check_bacula.pl -H $ARG1$ -w $
+ARG2$ -c $ARG3$ -j $HOSTNAME$"
+}
+
+check_bacula.pl:
+----------------
+
+#!/usr/bin/perl -w
+use strict;
+use POSIX;
+use File::Basename;
+use DBI;
+use Getopt::Long;
+use vars qw(
+       $opt_help
+           $opt_job
+           $opt_critical
+           $opt_warning
+           $opt_hours
+           $opt_usage
+           $opt_version
+           $out
+           $sql
+           $date_start
+           $date_stop
+           $state
+           $count
+           );
+           
+sub print_help();
+sub print_usage();
+sub get_now();
+sub get_date;
+
+my $progname = basename($0);
+
+my %ERRORS = (  'UNKNOWN'       =>      '-1',
+                'OK'            =>      '0',
+                'WARNING'       =>      '1',
+                'CRITICAL'      =>      '2');
+
+Getopt::Long::Configure('bundling');
+GetOptions
+        (
+        "c=s"   =>      \$opt_critical, "critical=s"    =>      \$opt_critical,
+        "w=s"   =>      \$opt_warning,  "warning=s"     =>      \$opt_warning,
+        "H=s"   =>      \$opt_hours,    "hours=s"       =>      \$opt_hours,
+        "j=s"   =>      \$opt_job,      "job=s"         =>      \$opt_job,
+        "h"     =>      \$opt_help,     "help"          =>      \$opt_help,
+                                        "usage"         =>      \$opt_usage,
+        "V"     =>      \$opt_version,  "version"       =>      \$opt_version
+        ) || die "Try '$progname --help' for more information.\n";
+
+sub print_help() {
+print "\n";
+print "PRINT HELP...\n";
+print "\n";
+}
+
+sub print_usage() {
+ print "PRINT USAGE...\n";
+ print "\n";
+}
+
+sub get_now() {
+ my $now  = defined $_[0] ? $_[0] : time;
+ my $out = strftime("%Y-%m-%d %X", localtime($now));
+ return($out);
+}
+
+sub get_date {
+ my $day = shift;
+ my $now  = defined $_[0] ? $_[0] : time;
+ my $new = $now - ((60*60*1) * $day);
+ my $out = strftime("%Y-%m-%d %X", localtime($new));
+ return ($out);
+}
+
+if ($opt_help) {
+ print_help();
+ exit $ERRORS{'UNKNOWN'};
+}
+
+if ($opt_usage) {
+ print_usage();
+ exit $ERRORS{'UNKNOWN'};
+}
+
+if ($opt_version) {
+ print "$progname 0.0.1\n";
+ exit $ERRORS{'UNKNOWN'};
+}
+
+
+if ($opt_job && $opt_warning && $opt_critical) {
+ my $dsn = "DBI:mysql:database=bacula;host=localhost";
+ my $dbh = DBI->connect( $dsn,'root','' ) or die "Error connecting to: '$dsn': $DBI::errstr\n";
+ if ($opt_hours)
+ {
+  $date_stop = get_date($opt_hours);
+ }
+  else
+  {
+   $date_stop = '1970-01-01 01:00:00';
+  }
+ $date_start = get_now();
+ $sql = "SELECT count(*) as 'count' from Job where (Name='$opt_job') and (JobStatus='T') and (EndTime <> '') and ((EndTime <= '$date_start') and (EndTime >= '$date_stop'));";
+
+ my $sth = $dbh->prepare($sql) or die "Error preparing statemment",$dbh->errstr;
+ $sth->execute;
+ while (my @row = $sth->fetchrow_array()) {
+  ($count) = @row;
+ }
+$state = 'OK';
+if ($count<$opt_warning) { $state='WARNING' }
+if ($count<$opt_critical) { $state='CRITICAL' }
+
+print "Bacula $state: Found $count successfull jobs\n";
+exit $ERRORS{$state};
+ $dbh->disconnect();
+}
+ else {
+  print_usage();
+ }
+
+Well, this script is not really finished, but it works for us. Maybe it is helpful for you. If somebody makes enhancements, I would be happy to recieve a copy.
+
+cu,
+Julian
+
+-- 
+Julian Hein                   NETWAYS GmbH
+Managing Director             Deutschherrnstr. 47a
+Fon.0911/92885-0              D-90429 Nürnberg
+Fax.0911/92885-31                                        
+jhein@netways.de              www.netways.de     
+
diff --git a/bacula/examples/nagios/nagios_plugin_check_bacula.tgz b/bacula/examples/nagios/nagios_plugin_check_bacula.tgz
new file mode 100644 (file)
index 0000000..d9aaa62
Binary files /dev/null and b/bacula/examples/nagios/nagios_plugin_check_bacula.tgz differ
diff --git a/bacula/examples/nagios_plugin_check_bacula.tgz b/bacula/examples/nagios_plugin_check_bacula.tgz
deleted file mode 100644 (file)
index d9aaa62..0000000
Binary files a/bacula/examples/nagios_plugin_check_bacula.tgz and /dev/null differ
index ca5f74a2d78e72dedb940e2b0582f6c5ad1cdeea..0758a854dd53f7fc6cc542449400e64f29d26b60 100644 (file)
@@ -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.
-
index 69b1a556d82f80c09071903ade0225966276d2ee..76c0e48a7647daf1df43c8cf21cc345601464427 100644 (file)
@@ -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 <mark.bergman@uphs.upenn.edu>
+  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 <mark.bergman@uphs.upenn.edu>
+  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 <jesper@krogh.cc>
+  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".
index 2ba6fa455f48a577a46c29c7f47166cfd7898246..e3bcda034e90392629ae7f0a6722f6a39ea1c9f1 100644 (file)
@@ -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;
       }
index ef3500c71c921819089fa4797e9e5f43823c8ab3..5f68f53358384c7a720f1e5a46fa53ab95eebea0 100644 (file)
@@ -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 */
index f386abc89d815f2d49e6fcde3424ffb1debc747a..ed5054f4f3f5d812f556865ce19b1f3161a49388 100644 (file)
@@ -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) {
index dbfba40c82ecb8638eba152b2d3ba2e52cb54d6d..74636fcaa6ba3d024fdf17488c946f2dbfd81a15 100644 (file)
@@ -97,7 +97,7 @@ SCRIPTS := \
 
 .PHONY: all clean installer
 
-all:
+all:           $(INSTALL_EXE)
 
 installer:     $(INSTALL_EXE)
 
index 5018864e336025e9783dc02c169ce1d6065334d3..9780ec87ad6d1174c1f88803e26e862c3cf24629 100644 (file)
@@ -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.