Home Directory Plugins Backup and Recovery Bacula check_bacula_lastbackup.pl

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_bacula_lastbackup.pl

Rating
3 votes
Favoured:
0
Current Version
1.0
Last Release Date
2010-05-03
Compatible With
  • Nagios 3.x
Owner
Hits
93922
Files:
FileDescription
check_bacula_lastbackup.plcheck_bacula_lastbackup.pl

Help Support Ethan Galstad's New Project:

Help Support Ethan

A Message From The Founder...

As the founder of Nagios, I'm asking for your help in a cause that's dear to my heart.

I'm launching a new project to help better the world by providing the information, ideas, and inspiration that I believe can improve the lives of people everywhere.

I know you're busy managing networks, but I would appreciate it if you would consider liking my Facebook page and showing your support for the content and messages I produce by sharing them with your friends and family.

You can learn more about my project by visiting ethangalstad.me/nagios. Thank you for your time. I wish you all the best in your endeavors, whatever they may be.

- Ethan

Checks the age of the last successfull backup of a given client and (optional) of a given level.
Reviews (3)
byAposwolf, December 22, 2017
It works! But somehow in my system not every successful backup is listed via list jobname. I edited the plugin to use status client, for directly connecting to the fd of the client and it's status. Therefore you also have to convert the date. Following changes where made (just copy line to line:

open (JOBLIST,"echo 'status client=$client' | $bconsoleCommand |");

my $latestBackupAge=-1;

while() {
my($line) = $_;
#print $line;
# split into columns (and remove whitespaces)
my ($_dummy,$_jobId,$_level,$_jobFiles,$_jobBytes,$_jobBytesMetric,$_jobStatus,$_finishedDate,$_finishedTime,$_client)=split(/\s+/,$line);
if ( $_jobBytes eq "0" ) {
($_dummy,$_jobId,$_level,$_jobFiles,$_jobBytes,$_jobStatus,$_finishedDate,$_finishedTime,$_client)=split(/\s+/,$line);
}
$_finishedDate =~ s/Dez/Dec/;
$_finishedDate =~ s/Mrz/Mar/;
$_finishedDate =~ s/Okt/Oct/;
$_finishedDate =~ s/Mai/May/;

my $_startTime = "$_finishedDate-$_finishedTime";
if ( $_jobStatus ne "OK" ) {
next; # only jobs which terminated correctly
}
if ( $_client ne "backup_$client" ) {
next; # only jobs for this client
}
if (!( $level eq "*" || $_level eq $level )) {
next; # only jobs for the reqired level (or any if $level="*")
}
my $in_fmt = '%d-%b-%y-%H:%M';
my $out_fmt = '%Y-%m-%d %H:%M:%S';
my $date = Time::Piece->strptime($_startTime, $in_fmt);
my $_startTime = $date->strftime($out_fmt);
my ($_y,$_m,$_d,$_H,$_M,$_S);

($_y,$_m,$_d,$_H,$_M,$_S) = ( $_startTime=~/^(\d{4})\-(\d{2})\-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/ );

if (! $_y ) {
next; # require valid startTime
}

my $_startTimeAsUnixtime=timelocal($_S, $_M, $_H, $_d, $_m-1, $_y);
byShodan, February 28, 2013
I had to modify lines 74 and 75 adding a line that makes the 'while' loop to bail out if the line does not begin with '|'.

while() {
next unless /^\|/;

For some reason, the script worked fine if invoked by cli, but gave the following error if invoked inside Nagios:

**ePN /usr/lib/nagios/plugins/check_bacula_lastbackup.pl: Use of uninitialized value _jobStatus in string ne at (eval 1) line 80, JOBLIST line 1..
byalfred, June 26, 2011
hello,
thanks for that plugin.

i raised the warninglevels on weekends


my $weekday=`date +\%u`;
if ($weekday == 7 || $weekday == 1) {
$warningAge=72;
$criticalAge=96;
}