Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
adalle
byadalle, July 15, 2015
I have this working well with Postgres. A couple minor changes from the previous suggested changes:
$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 IS NOT NULL) AND ((EndTime >= '$date_stop')) GROUP BY Job.JobId, Job.JobStatus, Log.LogText;";
(EndTime >= as opposed to =)
When there isn't a match, you don't get an array of 0's or nulls, but just an empty array.
So I check for that:
if ($#job_stats == -1)
{
@job_stats = (0,0,0,0)
}
This is the easiest fix; the rest of the code expects that array to exist, so I just set it to zeroes.
$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 IS NOT NULL) AND ((EndTime >= '$date_stop')) GROUP BY Job.JobId, Job.JobStatus, Log.LogText;";
(EndTime >= as opposed to =)
When there isn't a match, you don't get an array of 0's or nulls, but just an empty array.
So I check for that:
if ($#job_stats == -1)
{
@job_stats = (0,0,0,0)
}
This is the easiest fix; the rest of the code expects that array to exist, so I just set it to zeroes.