[rrd-users] Re: Bug? : RRDs perl module is very picky about trailing white spaces

2005-08-29 Thread Andreas Maus
On Fri, Aug 26, 2005 at 07:45:38PM +0200, Tobias Oetiker wrote:
Hi Tobias.
> > But this doesn't work with the errors generated by the COMMENT statement :/
> 
> it would be interesting to see a script proofing that since the
> code for parsing strings is the same in COMMENT and AREA, which in
> turn is the reason for COMMENT being picky about : in the first
> place which it was not in 1.0.x
O.K. this is the function:

[... snipp ...]
sub graph_load_linux()
{ 
  my $host=shift;
  my $i=0;
  my $RealImgWidth=0;
  my $RealImgHeight=0;
  my @avg=("5 min","30 min","2 hour","1 day");

  for ($i=0;$i<@Times;$i++)
  { 
my $Time=$Times[$i];


(undef,$RealImgWidth,$RealImgHeight)=RRDs::graph($ImageDir."/".$host."-load-".$Time.".png","--imgformat","PNG","--start","-1$Time","--lower","0",
"--width",$ImgWidth,"--height",$ImgHeight,

"DEF:load1=$DataDir"."/".$host."/load.rrd:load1:AVERAGE","DEF:load5=".$DataDir."/".$host."/load.rrd:load5:AVERAGE",
"DEF:load15=$DataDir"."/".$host."/load.rrd:load15:AVERAGE",
"DEF:usercpu=$DataDir"."/".$host."/cpu.rrd:user:AVERAGE",

"DEF:systemcpu=$DataDir"."/".$host."/cpu.rrd:system:AVERAGE","DEF:nicecpu=$DataDir"."/".$host."/cpu.rrd:nice:AVERAGE",

"DEF:idlecpu=$DataDir"."/".$host."/cpu.rrd:idle:AVERAGE","CDEF:up=systemcpu,usercpu,nicecpu,+,+",

"CDEF:lw=up,idlecpu,+","CDEF:cpu=up,lw,/,100,*","CDEF:cpu10=cpu,10,LE,load15,UNKN,IF",
"CDEF:cpu20=cpu,10,GT,cpu,20,LE,*,load15,UNKN,IF",

"CDEF:cpu30=cpu,20,GT,cpu,30,LE,*,load15,UNKN,IF","CDEF:cpu40=cpu,30,GT,cpu,40,LE,*,load15,UNKN,IF",

"CDEF:cpu50=cpu,40,GT,cpu,50,LE,*,load15,UNKN,IF","CDEF:cpu60=cpu,50,GT,cpu,60,LE,*,load15,UNKN,IF",

"CDEF:cpu70=cpu,60,GT,cpu,70,LE,*,load15,UNKN,IF","CDEF:cpu80=cpu,70,GT,cpu,80,LE,*,load15,UNKN,IF",

"CDEF:cpu90=cpu,80,GT,cpu,90,LE,*,load15,UNKN,IF","CDEF:cpu100=cpu,90,GT,cpu,100,LE,*,load15,UNKN,IF",
"COMMENT:CPU Utilization (%)\\n",
"AREA:cpu10#0043ff: 
0%-10%","AREA:cpu20#01b2f6:10%-20%","AREA:cpu30#02fcf2:20%-30%","AREA:cpu40#04ff01:30%-40%",
"AREA:cpu50#cbfe22:40%-50%",
"COMMENT: Minimum","GPRINT:cpu:MIN:%3.2lf%%","COMMENT:Maximum\: 
","GPRINT:cpu:MAX:%3.2lf%%\\n",

"AREA:cpu60#f6fd2a:50%-60%","AREA:cpu70#f7e526:60%-70%","AREA:cpu80#f9a71b:70%-80%",
"AREA:cpu90#fb7113:80%-90%","AREA:cpu100#fe2406:90%-100%",
"COMMENT:Average\\: ","GPRINT:cpu:AVERAGE:%3.2lf%%\\n",
"COMMENT:\\n",
"COMMENT:Load average\\n",
"LINE1:load1#af06bf:1 minute ",
"COMMENT:Minimum: ",
"GPRINT:load1:MIN:%3.2lf","COMMENT:Maximum: ","GPRINT:load1:MAX:%3.2lf\\n",
"LINE1:load5#ef0cd1:5 minutes ","COMMENT:   
Average: ",
"GPRINT:load1:AVERAGE:%3.2lf\\n",
"LINE1:load15#00:15 minutes\\n",
"HRULE:0#00");

if (RRDs::error)
{ 
  printf("Error:%s\n",RRDs::error);
} else
{ 
  printf("Load average on %s - last %s (%s 
average)",$host,$Time,$avg[$i]);
  printf("\n",$WWWImageDir."/".$host."-load-".$Time.".png",$RealImgWidth,$RealImgHeight,$host,$Time,$avg[$i]);
}
printf("\n");
  }
}
[... snipp ...]

$DataDir is /home/www/systems

Running this (perl) script (as CGI) produces:

Error:Garbage ': ' after command: COMMENT:Maximum:

Well, I could live without colons ;) 

Hope that helps ...

Andreas.

-- 
Dipl.-Ing. Andreas Maus science+computing ag
System Administration   Hagellocher Weg 71-75
mail: [EMAIL PROTECTED]   72070 Tuebingen, Germany
tel.: +49 7071 9457 456 www.science-computing.de

-- Binary/unsupported file stripped by Ecartis --
-- Err : No filename to use for decode, file stripped.
-- Type: application/pgp-signature


--
Unsubscribe mailto:[EMAIL PROTECTED]
Helpmailto:[EMAIL PROTECTED]
Archive http://lists.ee.ethz.ch/rrd-users
WebAdminhttp://lists.ee.ethz.ch/lsg2.cgi


[rrd-users] Re: Bug? : RRDs perl module is very picky about trailing white spaces

2005-08-29 Thread Alex van den Bogaerdt
[snip]
> "COMMENT:CPU Utilization (%)\\n",
[snip]
> "COMMENT: Minimum","GPRINT:cpu:MIN:%3.2lf%%","COMMENT:Maximum\: 
> ","GPRINT:cpu:MAX:%3.2lf%%\\n",
[snip]

You enter "\\n" and rrdtool gets to see "\n"
You enter "\:" and rrdtool gets to see ":"

Notice the pattern?

> "COMMENT:Average\\: ","GPRINT:cpu:AVERAGE:%3.2lf%%\\n",

You enter "\\:" and rrdtool gets to see "\:".  RRDtool will
not complain about that comment line.  It has seen an escape
character and knows not to interpret that colon.


> Error:Garbage ': ' after command: COMMENT:Maximum:

Slightly confusing: the command is "COMMENT:Maximum" and that colon is
not from your script line but from english text.  In other words, rrdtool
accepted until "maximum" and complained about every token that followed,
including its token separator ":".  You gave it a token separator of ":"
and a token of " ".

> Well, I could live without colons ;) 

Not necessary.  Just escape colons like every other "special" char.
Your operating system and/or your script parser may eat some escape
characters (yours does) in which case you need to escape an escape char.

HTH
Alex

--
Unsubscribe mailto:[EMAIL PROTECTED]
Helpmailto:[EMAIL PROTECTED]
Archive http://lists.ee.ethz.ch/rrd-users
WebAdminhttp://lists.ee.ethz.ch/lsg2.cgi


[rrd-users] How to RRDgraph differences over time (derivates)

2005-08-29 Thread Søren Schrøder
Greetings rrd-users

I have been using RRDtool for years, for mutiple tasks, and every time I
invented a new need for wierd graphing in RRDtool, it seemed there
always was a way to do it. But this time the man pages doesn't give me a
hint on how to do it, so I try the list.

Data:

X.RRD countaining one dataset, N (absolute), logged every 5 minutes.

It could be number of active users on a system.

I would like to do a rrd_graph where i plot the DIFFERENCE between last
logged data, and the data logged, say 10 minutes ago. This derivate
could be used to detect unnormal changes in population (if I loose 1
users in 10 minutes on a populatin of 20 users, it probably because
somthing went wrong (or the important soccergame in TV started)

I imagine something like (in pseudo code): Nmark = ( N(now) -
N(now-10minutes) ) / N(now) * 100

and in the above example: Nmark=(19-20)/19*100 = -5.26%

At the moment I do this by keeping a state of the "10 min ago" value on
the data-collector, and then pass it to the rrd as a second dataset, but
this is in my book redundant data, as it already exists in the rrd, and
it not very flexible either, if I would like to look at 5 minutes and 30
minutes changes too.

Any ideas on howto ?

Kind regards

-- 
Søren Schrøder
cybercity.dk


--
Unsubscribe mailto:[EMAIL PROTECTED]
Helpmailto:[EMAIL PROTECTED]
Archive http://lists.ee.ethz.ch/rrd-users
WebAdminhttp://lists.ee.ethz.ch/lsg2.cgi


[rrd-users] Re: Bug? : RRDs perl module is very picky about trailing white spaces

2005-08-29 Thread Andreas Maus
On Mon, Aug 29, 2005 at 11:33:52AM +0200, Alex van den Bogaerdt wrote:
Hi Alex.
> 
> You enter "\\n" and rrdtool gets to see "\n"
> You enter "\:" and rrdtool gets to see ":"
> 
> Notice the pattern?
> 
> > "COMMENT:Average\\: ","GPRINT:cpu:AVERAGE:%3.2lf%%\\n",
>
> You enter "\\:" and rrdtool gets to see "\:".  RRDtool will
> not complain about that comment line.  It has seen an escape
> character and knows not to interpret that colon.
DOH!
You are right!

> 
> > Error:Garbage ': ' after command: COMMENT:Maximum:
> 
> Slightly confusing: the command is "COMMENT:Maximum" and that colon is
> not from your script line but from english text.  In other words, rrdtool
> accepted until "maximum" and complained about every token that followed,
> including its token separator ":".  You gave it a token separator of ":"
> and a token of " ".
Yes. That is the part that confuses me. It think it should care about the
the first colon in the COMMENT statement because it separates the statement
from text and don't care about colons after that first one. Or at least
this was the behavior in rrdtool 1.0.x

> > Well, I could live without colons ;) 
> 
> Not necessary.  Just escape colons like every other "special" char.
> Your operating system and/or your script parser may eat some escape
> characters (yours does) in which case you need to escape an escape char.
Yes. If I escape the collons with \ and escape the escape character it works.

Escaping all relevant colons (and escaping the escape character) is not to much 
work ...

Thanks a lot!

Andreas.

-- 
Dipl.-Ing. Andreas Maus science+computing ag
System Administration   Hagellocher Weg 71-75
mail: [EMAIL PROTECTED]   72070 Tuebingen, Germany
tel.: +49 7071 9457 456 www.science-computing.de

-- Binary/unsupported file stripped by Ecartis --
-- Err : No filename to use for decode, file stripped.
-- Type: application/pgp-signature


--
Unsubscribe mailto:[EMAIL PROTECTED]
Helpmailto:[EMAIL PROTECTED]
Archive http://lists.ee.ethz.ch/rrd-users
WebAdminhttp://lists.ee.ethz.ch/lsg2.cgi


[rrd-users] Re: Bug? : RRDs perl module is very picky about trailing white spaces

2005-08-29 Thread Tobias Oetiker
Today Andreas Maus wrote:
> >
> > Slightly confusing: the command is "COMMENT:Maximum" and that colon is
> > not from your script line but from english text.  In other words, rrdtool
> > accepted until "maximum" and complained about every token that followed,
> > including its token separator ":".  You gave it a token separator of ":"
> > and a token of " ".
> Yes. That is the part that confuses me. It think it should care about the
> the first colon in the COMMENT statement because it separates the statement
> from text and don't care about colons after that first one. Or at least
> this was the behavior in rrdtool 1.0.x

yes this is an incompatible change vs 1.0.x as noted in the NEWS
file ... :-) the background is, that now all strings are handled
the same and if we ever decide to add an optional argument to the
COMMENT command we are all set.

cheers
tobi


-- 
 ____   _
/_  __/_  / /  (_) Oetiker @ ISG.EE, ETL F24.2, ETH, CH-8092 Zurich
 / // _ \/ _ \/ /  System Manager, Time Lord, Coder, Designer, Coach
/_/ \.__/_.__/_/   http://people.ee.ethz.ch/oetiker +41(0)44-632-5286

--
Unsubscribe mailto:[EMAIL PROTECTED]
Helpmailto:[EMAIL PROTECTED]
Archive http://lists.ee.ethz.ch/rrd-users
WebAdminhttp://lists.ee.ethz.ch/lsg2.cgi


[rrd-users] Re: Bug? : RRDs perl module is very picky about trailing white spaces

2005-08-29 Thread Alex van den Bogaerdt
On Mon, Aug 29, 2005 at 05:32:59PM +0200, Andreas Maus wrote:

> > accepted until "maximum" and complained about every token that followed,
> > including its token separator ":".  You gave it a token separator of ":"
> > and a token of " ".
> Yes. That is the part that confuses me. It think it should care about the
> the first colon in the COMMENT statement because it separates the statement
> from text and don't care about colons after that first one. Or at least
> this was the behavior in rrdtool 1.0.x

If you wanted to display a colon in COMMENT, you didn't need to escape it
in rrdtool 1.0.x but if you wanted to display a colon in GPRINT, you did.
(but you were allowed to escape a colon in COMMENT as well!)

RRDtool 1.2.x does it differently: you must escape a colon if you want
it to be interpreted as text.  No ifs, buts and thens.

Parsing is now done the same for all of rrdtool_graph which not only makes
it more easy for developers but also for users.

- you do not need to know different rules for different lines.  A colon
  introduces a new field, no matter what type of line you look at
- All colons belonging to text should be made invisible to rrdtool (by
  means of prefixing them with "\"), no matter where this happens.
- should there ever need to be an optional parameter to COMMENT (I can't
  think of one right now, but just assume there is such need) then it is
  easy to change the parser without introducing another incompatibility.
  This means you don't have to alter existing scripts should this happen.

> > Your operating system and/or your script parser may eat some escape
> > characters (yours does) in which case you need to escape an escape char.
> Yes. If I escape the collons with \ and escape the escape character it works.
> 
> Escaping all relevant colons (and escaping the escape character) is not to 
> much work ...

Indeed, especially since you don't have different rules for GPRINT and COMMENT.
You can feed your text through the same function that adds escape characters.

cheers
Alex

--
Unsubscribe mailto:[EMAIL PROTECTED]
Helpmailto:[EMAIL PROTECTED]
Archive http://lists.ee.ethz.ch/rrd-users
WebAdminhttp://lists.ee.ethz.ch/lsg2.cgi


[rrd-users] Apache newbie seeks help setting up RRDCGI

2005-08-29 Thread Izzet Ergas
Hi,
 

I'm trying to get RRDCGI set up and I'm afraid that I'm not doing too
well. I was wondering if anyone can help me out and spell out what
changes I need to make to my httpd.conf file to get Apache to process
HTML with RRDCGI. I should mention that I'm running Apache 2.0 on
Windows 2003.

 

Thanks


--
Unsubscribe mailto:[EMAIL PROTECTED]
Helpmailto:[EMAIL PROTECTED]
Archive http://lists.ee.ethz.ch/rrd-users
WebAdminhttp://lists.ee.ethz.ch/lsg2.cgi