Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
bockfot2000
Below is a patch to make the script working with a PostgreSQL backend, and a quick-fix for instances where query returns 0E0:
+ my $dsn = "DBI:Pg:database=$sqlDB;host=localhost";
+ $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;";
- my @job_stats = sql_exec();
+ my $sth = $dbh->prepare($sql_query);
+ my $rv = $sth->execute() or die "Error executing query: '$sql_query': $DBI::errstr\n";
+ if ($rv fetchrow_array();
+ $errors = $job_stats[0];
+ $count = $job_stats[1];
+ $jobid = $job_stats[2];
+ $joblog = $job_stats[3];
+ }
+ my $dsn = "DBI:Pg:database=$sqlDB;host=localhost";
+ $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;";
- my @job_stats = sql_exec();
+ my $sth = $dbh->prepare($sql_query);
+ my $rv = $sth->execute() or die "Error executing query: '$sql_query': $DBI::errstr\n";
+ if ($rv fetchrow_array();
+ $errors = $job_stats[0];
+ $count = $job_stats[1];
+ $jobid = $job_stats[2];
+ $joblog = $job_stats[3];
+ }