oliveiraped / Reportula

Reportula is a php based web program that provides you a summarized output stats of Bacula Backups jobs, clients, volumes and director that have already run. It obtains its information from your catalog database. This is a fairly high level bacula management tool. Here are a few points that one user made concerning this important tool. It is web-based so can be accessed from anywhere. It packs a phenomenal amount of information into a single web-page – that I credit as being very good design! Features Display last jobs status Display volumes usage by pool Full supported MySQL, PostgreSQL databases. Show Jobs which executed with errors last day, week, month Show a condition of your Volumes Show terminated Jobs Search Jobs on several conditions The detailed information on Pools, Volumes, Storages and Clients Search options List the files stored on job Acl Supports and Login users support Integration with Active Directory or Ldap servers
http://www.reportula.org
GNU General Public License v3.0
25 stars 9 forks source link

BaculaStats:collect "division by zero" error #1

Closed singler closed 10 years ago

singler commented 10 years ago

On small database, when (max(starttime) - min(starttime)) is less than 1 hour, hoursbytes collection fails with:

[Illuminate\Database\QueryException]                                         
  SQLSTATE[22012]: Division by zero: 7 ERROR:  division by zero (SQL: select   
  (sum(jobbytes)/date_part('hour',  (max(starttime) - min(starttime)))) AS ho  
  ursbytes from "job" where "starttime" >= 2014-03-27 18:29 and "endtime" <=   
  2014-03-28 18:29)

because date_part returns zero, and then query tries to divide by zero.

sample data:

select max(starttime) - min(starttime) from job where starttime >= '2014-03-27 18:29' and endtime <= '2014-03-28 18:29'

"00:00:11"

select date_part('hour',max(starttime) - min(starttime)) from job where starttime >= '2014-03-27 18:29' and endtime <= '2014-03-28 18:29'

0