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

Directory Tree

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
97978
Files:
FileDescription
check_bacula_lastbackup.plcheck_bacula_lastbackup.pl
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
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;
}