[rrd-users] Problem with custom PHP script - peak traffic

Ingo Flaschberger if at xip.at
Thu Oct 8 22:03:17 CEST 2009


Dear Drake,

do you have bits or bytes in the rrd?

if you want bits, but account bytes (octets) the you need to multiply with 
8.

Kind regards,
 	ingo flaschberger

geschaeftsleitung
____________________________________
crossip communications gmbh
A-1020 Wien, Sebastian Kneipp Gasse 1
Tel: +43-1-7261522-0
Fax: +43-1-726 15 22-111
www.crossip.net
_______________________________________________________________________________
crossip communications gmbh
Sitz der Gesellschaft: 1020 Wien, Oesterreich
Firmenbuchgericht: Handelsgericht Wien, FN 269698 s

Umsatzsteueridentifikationsnummer (UID): ATU62080367

Diese Nachricht ist fuer die crossip communications gmbh rechtsunverbindlich
und ausschliesslich fuer den/die oben bezeichneten Adressaten bestimmt und
enthaelt moeglicherweise vertrauliche Informationen. Sollten Sie nicht der
oben bezeichnete Adressat sein oder diese Nachricht irrtuemlich erhalten
haben, ersuchen wir Sie, diese Nachricht nicht weiterzugeben, zu kopieren
oder im Vertrauen darauf zu handeln, sondern den Absender zu verstaendigen
und diese Nachricht samt allfaelliger Anlagen sofort zu loeschen.
Vielen Dank.

This message is not legally binding upon crossip communications gbmbh and
is intended only for use by the named addressee and may contain privileged
and/or confidential information. If you are not the named addressee, you
should not disseminate, copy, or take any action in reliance on it. If you
have received this message in error, please immediately notify the sender
and delete this message and any attachment.
Thank you.
On Thu, 8 Oct 2009, drrake wrote:

>
> Hello,
>
> I'm having a problem with getting script to work correctly. I'm trying to
> fetch data from a few .rrd files, sum their values and get peak value of
> outgoing traffic. Unfortunately the value I get is much lower than it should
> be (I'm comparing with a cacti summary graph of the graphs from the same
> .rrd files).
> What am I doing wrong? Below is the code:
>
> $_SOURCES[] = "a.rrd";
> $_SOURCES[] = "b.rrd";
> ...
>
> $source=0;
> foreach ($_SOURCES as $s)
> {
>        unset($out);
>        unset($_TMPTABLE);
>
>        exec("rrdtool fetch $s AVERAGE", $out);
>
>        foreach ($out as $line)
>        {
>                $l=explode(" ", $line);
>                $l = preg_replace('/(nan)|(NaN)/', '0.0000000000e+00', $l);
>                if (preg_match("/^[0-9]/", $l[0]))
>                {
>                        $t = $l[0];
>
>                        $_TMPTABLE[$t]=floatval($l[2]);
>                        $_TMPTABLE[$t] = $_TMPTABLE[$t] * 8;
>                }
>        }
>
>        foreach ($_TMPTABLE as $time => $val)
>        {
>                if (preg_match("/^[0-9]/", $val))
>                {
>                        $_OUTTABLE[$time]= $_OUTTABLE[$time] + $val;
>                }
>        }
> }
>
> $peak=0;
> $peak_time=0
>
> foreach ($_OUTTABLE as $time => $val)
> {
>        if ($val >= $peak)
>        {
>                $peak=$val;
>                $peak_time=$time;
>        }
> }
>
>
> Thanks in advance for any helpful tips.
> -- 
> View this message in context: http://n2.nabble.com/Problem-with-custom-PHP-script-peak-traffic-tp3790452p3790452.html
> Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
>
> _______________________________________________
> 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