RRD 1.2.12 & Date/Time problem
Brought to you by:
edehont
The comments at the top of each set of graphs contain
code to inject the current date and time. Something
needs to be escaped for RRDTools v-1.2.12 and perhaps
the entire 1.2.x suite.
I've had to comment each of these lines:
'COMMENT:Graph Created on '.localtime(time).'\r',
Without them being commented I get this on the
generated web page:
Garbage ':46:59 2006\r' after command: COMMENT:Graph
Created on Fri Jan 13 13:46:59 2006\r
I'm using dnsgraph 0.9.
Logged In: NO
for rrdtool 1.2
comment all time comment lines in dnsreport.pl out
like:
# 'COMMENT:Graph Created on '.localtime(time).'\r',
and it works
Logged In: NO
I am using rrdtool-1.2.15 and I am also not seeing my graphs
being generated.
arbage ':30:02 2006\r' after command: COMMENT:Graph Created
on Sat Aug 19 20:30:02 2006\r
That is what shows up in my index.html file.
Logged In: NO
Apparently with rrdtool 1.2.x you have to escape all colons
within COMMENT arguments.
http://lists.ee.ethz.ch/rrd-users/msg10634.html
(useful text from the message, in case the link goes away)
<quote>
Hi Miachael.
> Hi all, using RRD Tool and Routers 2 to display my graphs.
> I get the following error "RRD Error: Garbage ':46:00 AM\r'
> after command: COMMENT:11/18/2005 7:46:00 AM\r" on all of
my targets.
> I searched the WEB and have not found anything, has anyone
seen this before?
Which version of rrdtool do you use?
I guess you are using rrdtool 1.2.x?.
In version 1.2.x you _have to_ esacpe _all_ colons.
See the NEWS file and look in the section called
"Incompatibilities":
[... snipp ...]
* Colons in COMMENT arguments to rrdtool graph must be
escaped with a backslash
[... snipp ...]
</quote>
Logged In: NO
Add
--
my $time = localtime;
$time =~ s/\:/\\:/g;
--
somewhere in dnsreport.pl
Change the 3 lines
'COMMENT:Graph Created on '.localtime(time).'\r',
to
'COMMENT:Graph Created on '.$time.'\r',
Works with RRDTool 1.2.15
Why use a command to remove a colon you created a line earlier? I think it's nicer to generate a timestring with escaped colons to begin with:
'my $time = strftime("%a %b %e %H\\:%M\\:%S %Y", localtime);'
%a is your local abbr. of the day name,%b the abbreviated name of the month, %e the day of the month.
This solution also gives you a starting point for internationalization, should you want to.
--
Greetings,
Eric de Hont