Thanks Craig,

After an array learning curve,  I've come up with the following line that works.

$opts_DEF[] = str_replace(output,output_max,$opts_DEF[output]) . ":reduce=MAX";

Since the data I'm looking for has already been called in with the
rrdtool_get_def function call, this gives me the line I want without
the extra overhead.  I've added the extra CDEF lines and GPRINT to get
something that I'm pretty sure will work.  For testing I put some
hooks in to send the output to a file, and I get the expected rrdtool
call....  Problem is... It needs the features of rrdtool-1.2.   I can
send a copy of the file if wanted...

On another note, one of my pet-peeves on the traffic graphs has been
the way bandwidth is represented.  I find myself counting zero's way
too much.  I've shamelessly adapted some code I've found in the PHP
Manual.  It's suppose to work with PHP 4.3.0 or higher.

I've added the following lines....

        $speed_notation = array(" bps", " Kbps", " Mbps", " Gpbs", " Tbps");
        $in_bandwidth = round($data["bandwidthin"]/pow(1000, ($i =
floor(log($data["bandwidthin"], 1000)))), 2) . $speed_notation[$i];
        $out_bandwidth = round($data["bandwidthout"]/pow(1000, ($i =
floor(log($data["bandwidthout"], 1000)))), 2) . $speed_notation[$i];

and changed the Comment lines to be....

        "COMMENT:'Inbound Bandwidth: $in_bandwidth'",
and   "COMMENT:'Outbound Bandwidth: $out_bandwidth\\n'",

This changes the bandwidth displayed into a more readable format.

Thanks....

Rob Royan






On 11/6/05, Craig Small <[EMAIL PROTECTED]> wrote:
> On Thu, Nov 03, 2005 at 10:30:23PM -0400, Rob Royan wrote:
> > DEF:indataMaxbytes=interface-663-0.rrd:data:AVERAGE:reduce=MAX
> Right, let's keep that in mind.
>
> > $opts_DEF = rrdtool_get_def($data,array("input"));
> > This would translate to:
> > DEF:indataMaxbytes=interface-663-0.rrd:data:AVERAGE
> "input" is the name of the RRDTool interface value.  It looks like yours
> is called indataMaxbytes so you would change that to
>  $opts_DEF = rrdtool_get_def($data,array("indataMaxbytes"));
>
> $opts_DEF now is an associative array of one row, looking like:
>   "indataMaxbytes" => 
> "DEF:indataMaxbytes=/opt/jffnms/rrd/interface-663-0.rrd:data:AVERAGE"
>
> So we're close, but you need the reduce.  I'm not sure of the best way,
> but you could do.
>   $opts_DEF['indataMaxbytes'] .= ':reduce=MAX';
>
>  - Craig
> --
> Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
> Eye-Net Consulting http://www.enc.com.au/   MIEE         Debian developer
> csmall at : enc.com.au                      ieee.org           debian.org
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> jffnms-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jffnms-users
>


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
jffnms-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jffnms-users

Reply via email to