Thread: [Py-RRDTool-Users] New line weirdness
Status: Beta
Brought to you by:
perky
From: Mark K. <mr...@eu...> - 2004-08-27 13:30:27
Attachments:
test.gif
|
I have a section of code that calls py-rrdtool as follows. rrdtool.graph('test.gif','--start=-1days','--title="Demo Graph"', 'DEF:rtt=/var/log/nagios/rrd/172.17.2.1_PING.rrd:RTT:AVERAGE', 'DEF:max=/var/log/nagios/rrd/172.17.2.1_PING.rrd:RTT:MAX', 'COMMENT:"\n maximum average current\n"', 'GPRINT:max:MAX:%7.2lf%ss', 'GPRINT:rtt:AVERAGE:%7.2lf%ss', 'GPRINT:rtt:LAST:%7.2lf%ss') The data was gathered from calls to ping and seems to work fine. However when I view the image that is created the text under the graph is wrong. There the \n from the COMMENT above should be I see A character which looks like a V above a T I have attached an example of a graph that shows the problem. Thank you. MArk |
From: <al...@al...> - 2004-08-27 15:12:52
|
Le Vendredi 27 Ao=FBt 2004 15:30, Mark Kilmartin a =E9crit : > I have a section of code that calls py-rrdtool as follows. > > rrdtool.graph('test.gif','--start=3D-1days','--title=3D"Demo Graph"', > 'DEF:rtt=3D/var/log/nagios/rrd/172.17.2.1_PING.rrd:RTT:AVERAGE', > 'DEF:max=3D/var/log/nagios/rrd/172.17.2.1_PING.rrd:RTT:MAX', > 'COMMENT:"\n maximum average current\n"', > 'GPRINT:max:MAX:%7.2lf%ss', > 'GPRINT:rtt:AVERAGE:%7.2lf%ss', > 'GPRINT:rtt:LAST:%7.2lf%ss') > > The data was gathered from calls to ping and seems to work fine. > > However when I view the image that is created the text under the graph > is wrong. > There the \n from the COMMENT above should be I see A character which > looks like a V above a T > I have attached an example of a graph that shows the problem. > > Thank you. > MArk My first guess without testing (I don't graph from pyhon), is that the \n= are=20 interpreted by Python.=20 Try using \\n inside your strings, or using raw strings : r'COMMENT:"\n maximum average current\n"' (note the r before the first quote).=20 Hope this helps. --=20 Allergy |
From: Mark K. <mr...@eu...> - 2004-08-27 15:22:20
|
On Fri, 2004-08-27 at 16:12, al...@al... wrote: > Le Vendredi 27 Ao=FBt 2004 15:30, Mark Kilmartin a =E9crit : > > I have a section of code that calls py-rrdtool as follows. > > > > rrdtool.graph('test.gif','--start=3D-1days','--title=3D"Demo Graph"', > > 'DEF:rtt=3D/var/log/nagios/rrd/172.17.2.1_PING.rrd:RTT:AVERAGE', > > 'DEF:max=3D/var/log/nagios/rrd/172.17.2.1_PING.rrd:RTT:MAX', > > 'COMMENT:"\n maximum average current\n"', > > 'GPRINT:max:MAX:%7.2lf%ss', > > 'GPRINT:rtt:AVERAGE:%7.2lf%ss', > > 'GPRINT:rtt:LAST:%7.2lf%ss') > > > > The data was gathered from calls to ping and seems to work fine. > > > > However when I view the image that is created the text under the graph > > is wrong. > > There the \n from the COMMENT above should be I see A character which > > looks like a V above a T > > I have attached an example of a graph that shows the problem. > > > > Thank you. > > MArk Thanks for the response > My first guess without testing (I don't graph from pyhon), is that the \n= are=20 > interpreted by Python.=20 > Try using \\n inside your strings, or using raw strings : Tried this and it simply appears as \\n on the graph. > r'COMMENT:"\n maximum average current\n"' > (note the r before the first quote).=20 This makes no difference. MArk >=20 > Hope this helps. |
From: <hy...@gm...> - 2004-08-27 18:22:45
|
On Fri, 27 Aug 2004 14:30:22 +0100, Mark Kilmartin <mr...@eu...> wrote: > I have a section of code that calls py-rrdtool as follows. > > rrdtool.graph('test.gif','--start=-1days','--title="Demo Graph"', > 'DEF:rtt=/var/log/nagios/rrd/172.17.2.1_PING.rrd:RTT:AVERAGE', > 'DEF:max=/var/log/nagios/rrd/172.17.2.1_PING.rrd:RTT:MAX', > 'COMMENT:"\n maximum average current\n"', > 'GPRINT:max:MAX:%7.2lf%ss', > 'GPRINT:rtt:AVERAGE:%7.2lf%ss', > 'GPRINT:rtt:LAST:%7.2lf%ss') > > The data was gathered from calls to ping and seems to work fine. > > However when I view the image that is created the text under the graph > is wrong. > There the \n from the COMMENT above should be I see A character which > looks like a V above a T > I have attached an example of a graph that shows the problem. > You can put newline character on the end of comments only. So, r'COMMENT:\n', r'COMMENT: maximum average current\n', may help. Hye-Shik |
From: Mark K. <mr...@eu...> - 2004-08-30 07:52:21
|
Excellent that worked for me. Thank you. MArk On Fri, 2004-08-27 at 19:22, hy...@gm... wrote: > On Fri, 27 Aug 2004 14:30:22 +0100, Mark Kilmartin <mr...@eu...>= wrote: > > I have a section of code that calls py-rrdtool as follows. > >=20 > > rrdtool.graph('test.gif','--start=3D-1days','--title=3D"Demo Graph"', > > 'DEF:rtt=3D/var/log/nagios/rrd/172.17.2.1_PING.rrd:RTT:AVERAGE', > > 'DEF:max=3D/var/log/nagios/rrd/172.17.2.1_PING.rrd:RTT:MAX', > > 'COMMENT:"\n maximum average current\n"', > > 'GPRINT:max:MAX:%7.2lf%ss', > > 'GPRINT:rtt:AVERAGE:%7.2lf%ss', > > 'GPRINT:rtt:LAST:%7.2lf%ss') > >=20 > > The data was gathered from calls to ping and seems to work fine. > >=20 > > However when I view the image that is created the text under the graph > > is wrong. > > There the \n from the COMMENT above should be I see A character which > > looks like a V above a T > > I have attached an example of a graph that shows the problem. > >=20 >=20 > You can put newline character on the end of comments only. So, >=20 > r'COMMENT:\n', > r'COMMENT: maximum average current\n', >=20 > may help. >=20 >=20 > Hye-Shik |