Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
svarco
bysvarco, January 7, 2014
On our bacula Version
Version: 5.0.0 (26 January 2010)
in the mysql Database each line of the log messages is stored in a new row. This leads to confusion with the sql_query in check_bacula.pl, as it is joined with the Log table of the bacula database, resulting in returning a wrong number of successful jobs.
Here is the patch file we created:
check_bacula.patch
--------------------------------------------------
***************
*** 181,187 ****
}
$date_start = get_now();
! $sql_query = "SELECT SUM(JobErrors) AS 'errors', COUNT(*) AS 'count', Job.JobId, Job.JobStatus, Log.LogText FROM Job LEFT JOIN Log on Job.JobId = Log.JobId WHERE (Name='$opt_job') AND (JobStatus='T') AND (EndTime '') AND ((EndTime = '$date_stop'));";
my @job_stats = sql_exec();
$errors = $job_stats[0];
$count = $job_stats[1];
--- 181,205 ----
}
$date_start = get_now();
! $sql_query = "
! SELECT
! SUM(JobErrors) AS 'errors',
! COUNT(*) AS 'count',
! j.JobId,
! j.JobStatus,
! l.LogText
! FROM
! Job j LEFT JOIN Log l on j.JobId = l.JobId and l.LogId = (
! select max(logid)
! from bacula.Log l2
! where l2.jobid = j.jobid
! )
! WHERE
! (Name='$opt_job')
! AND (JobStatus='T')
! AND (EndTime '')
! AND (EndTime = '$date_stop'); ";
my @job_stats = sql_exec();
$errors = $job_stats[0];
$count = $job_stats[1];
--------------------------------------------------
Version: 5.0.0 (26 January 2010)
in the mysql Database each line of the log messages is stored in a new row. This leads to confusion with the sql_query in check_bacula.pl, as it is joined with the Log table of the bacula database, resulting in returning a wrong number of successful jobs.
Here is the patch file we created:
check_bacula.patch
--------------------------------------------------
***************
*** 181,187 ****
}
$date_start = get_now();
! $sql_query = "SELECT SUM(JobErrors) AS 'errors', COUNT(*) AS 'count', Job.JobId, Job.JobStatus, Log.LogText FROM Job LEFT JOIN Log on Job.JobId = Log.JobId WHERE (Name='$opt_job') AND (JobStatus='T') AND (EndTime '') AND ((EndTime = '$date_stop'));";
my @job_stats = sql_exec();
$errors = $job_stats[0];
$count = $job_stats[1];
--- 181,205 ----
}
$date_start = get_now();
! $sql_query = "
! SELECT
! SUM(JobErrors) AS 'errors',
! COUNT(*) AS 'count',
! j.JobId,
! j.JobStatus,
! l.LogText
! FROM
! Job j LEFT JOIN Log l on j.JobId = l.JobId and l.LogId = (
! select max(logid)
! from bacula.Log l2
! where l2.jobid = j.jobid
! )
! WHERE
! (Name='$opt_job')
! AND (JobStatus='T')
! AND (EndTime '')
! AND (EndTime = '$date_stop'); ";
my @job_stats = sql_exec();
$errors = $job_stats[0];
$count = $job_stats[1];
--------------------------------------------------