[rrd-users] RRD and PHP Date not working

Steve Shipway s.shipway at auckland.ac.nz
Thu Aug 30 03:32:57 CEST 2012


Looks like the $dateoutput is not getting the escaped colons, so RRDTool gets a command string without the colons escapes and thinks they are command modifiers...  Maybe try single quoting the $date->format string rather than double quoting?

In perl, something like 
  $dateoutput ~= s/:/\\:/g ;
would fix it.  Not sure about PHP.

Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.shipway at auckland.ac.nz
Ph: +64 9 373 7599 ext 86487


________________________________________
From: rrd-users-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch [rrd-users-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch] on behalf of Berny Stapleton [berny at technology.net.au]
Sent: Thursday, 30 August 2012 5:10 a.m.
To: rrd-users at lists.oetiker.ch
Subject: [rrd-users] RRD and PHP Date not working

Hi there,

I'm using RRDTool 1.3.8 with php-pecl-rrd on CentOS 6.

I'm trying to put a comment onto a graph, and it doesn't like the
colon. I've looked through the list archives and I'm not coming up
with the right answer or syntax to make this work...

So I've got this:

$date = new DateTime("now", new DateTimeZone('Europe/Dublin'));
$dateoutput = $date->format("d M Y G\\:i\\:s");
"COMMENT:Created on $dateoutput",

I've tried \\ and \ and nothing seems to get me over this hump,  I'm
still getting " 'Exception' with message 'I don't understand ':25:49'
in command: 'COMMENT:Created on 29 Aug 2012 17:25:49'"

So, what I've seen in the list is that appending :strftime works, but
this seems to exist only under perl and not pecl-rrd; well, maybe I've
got it wrong, but when I tried it I got:

"'I don't understand ':35:08:strftime' in command: 'COMMENT:Created on
29 Aug 2012 16:35:08:strftime'"

Does anyone know how to get around this in PHP?

Thanks,

Berny

_______________________________________________
rrd-users mailing list
rrd-users at lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users



More information about the rrd-users mailing list