Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
Checks the age of the last successfull backup of a given client and (optional) of a given level.
Current Version
1.0
Last Release Date
2010-05-03
Owner
Michael Wyraz
Compatible With
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);
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..
hello, thanks for that plugin. i raised the warninglevels on weekends my $weekday=`date +%u`; if ($weekday == 7 || $weekday == 1) { $warningAge=72; $criticalAge=96; }
You must be logged in to submit a review.
To:
From:
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!