Home Directory

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

bockfot2000

Reviews(1)
bybockfot2000, March 17, 2014
2 of 2 people found this review helpful
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];
+ }