Feature #1788

mod_rrdtool should init db if file is empty

Added by glen about 6 years ago. Updated over 5 years ago.

Status:FixedStart date:
Priority:NormalDue date:
Assignee:glen% Done:

100%

Category:mod_rrdtool
Target version:1.4.23
Missing in 1.5.x:

Description

for purpose of setting initial permissions from rpm package, there's such file installed to system:

-rw-r----- 1 lighttpd stats 0 2008-10-07 13:14 /var/lib/lighttpd/lighttpd.rrd

lighty won't run rrdtool create on this file, so the file stays empty. and when rrdtool graph is ran such error is output

ERROR: reading the cookie off /var/lib/lighttpd/lighttpd.rrd failed

suggestion: make lighttpd run rrdtool create when .rrd file is empty (st.st_size == 0).

tested and it would work:

# ls -l lighttpd.rrd
-rw-r----- 1 lighttpd stats 0 2008-10-07 13:14 lighttpd.rrd
# > lighttpd.rrd
# rrdtool create lighttpd.rrd --step 60  DS:InOctets:ABSOLUTE:600:U:U  DS:OutOctets:ABSOLUTE:600:U:U  DS:Requests:ABSOLUTE:600:U:U  RRA:AVERAGE:0.5:1:600  RRA:AVERAGE:0.5:6:700  RRA:AVERAGE:0.5:24:775  RRA:AVERAGE:0.5:288:797  RRA:MAX:0.5:1:600  RRA:MAX:0.5:6:700  RRA:MAX:0.5:24:775  RRA:MAX:0.5:288:797  RRA:MIN:0.5:1:600  RRA:MIN:0.5:6:700  RRA:MIN:0.5:24:775  RRA:MIN:0.5:288:797
# ls -l lighttpd.rrd
-rw-r----- 1 lighttpd stats 212040 2008-10-07 13:16 lighttpd.rrd

lighttpd-mod_rrdtool-emptyfile.patch Magnifier - proposed patch (2.91 KB) glen, 2008-10-07 10:34

Associated revisions

Revision 2418
Added by glen over 5 years ago

- Create rrd file for empty rrdfile in mod_rrdtool (#1788)

Revision 2457
Added by stbuehler over 5 years ago

merge: Create rrd file for empty rrdfile in mod_rrdtool (#1788)

Revision 2686
Added by stbuehler about 5 years ago

mod_rrdtool: fix creating file if it doesn't exist (#1788)

History

#1 Updated by stbuehler about 6 years ago

I don't see why there should be an empty file. Either create it with rrdtool or give lighty write permissions to the directory? (/var/lib/lighttpd looks like it should be writable by lighty)

And the next one probably wants "rrdtool create" for size == 2 ("\r\n") too...

#2 Updated by glen about 6 years ago

  • Status changed from New to Assigned

#3 Updated by glen about 6 years ago

reason: i want lighttpd:stats being ownership. if lighttpd creates the file, it would be lighttpd:lighttpd.

0 byte file with lighttpd:stats cames from rpm package as rpm install is run as root, which has possibility to change ownership, which lighttpd doesn't.

#4 Updated by icy almost 6 years ago

  • Target version changed from 1.4.21 to 1.4.22
  • Patch available set to No

#5 Updated by stbuehler over 5 years ago

  • Target version changed from 1.4.22 to 1.4.23

#6 Updated by glen over 5 years ago

  • Patch available changed from No to Yes

#7 Updated by glen over 5 years ago

  • Status changed from Assigned to Fixed
  • % Done changed from 0 to 100

applied in r2418

Also available in: Atom