Últimos Cambios |
||
Blog personal: El hilo del laberinto |
Última Actualización: 23 de Noviembre de 1.998 - Lunes
Resent-Date: Fri, 20 Nov 1998 14:36:49 +0100 (MET) Old-Return-Path: <jcea@argo.es> Message-ID: <36557578.FA4953E8@argo.es> Date: Fri, 20 Nov 1998 12:58:16 -0100 From: Jesús Cea Avión <jcea@argo.es> Organization: Argo Redes y Servicios Telematicos, S.A. To: Lista MRTG <mrtg@list.ee.ethz.ch> Subject: [MRTG] Rounding or truncating?
Since MRTG saves the rate bytes per second in the log file, and uses only integer values, how are decimals managed?. The fractions are rounded or truncated?.
Since I use MRTG for accounting purposes, if it uses truncation, you can have, worst case, the following "deficits":
5 minutes average 30 minutes average 120 minutes average 24 hours average |
Intrinsic
7 bps 40 bps 24 bps 88 bps |
Inherited
- 7 bps 82 bps 352 bps |
Total
7 bps 82 bps 352 bps 4312 bps |
(50 hours) (12.5 days) !! (50 days) !! (732 days) !! |
I'm not familiar enough with perl to answer this question reading the source code. I'm using MRTG 2.1. The behaviour has changed?. Must I upgrade?.
-- Jesus Cea Avion _/_/ _/_/_/ _/_/_/ jcea@argo.es http://www.argo.es/~jcea/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/_/_/_/ PGP Key Available at KeyServ _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -- * To unsubscribe from the mrtg mailing list, send a message with the subject: unsubscribe to mrtg-request@list.ee.ethz.ch * The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg
Resent-Date: Fri, 20 Nov 1998 21:41:40 +0100 (MET) Message-ID: <3655DE63.B3B143AA@argo.es> Date: Fri, 20 Nov 1998 20:25:55 -0100 From: Jesús Cea Avión /lt;jcea@argo.es> Organization: Argo Redes y Servicios Telematicos, S.A. To: Lista MRTGSubject: Re: [MRTG] Rounding or truncating? References: <36557578.FA4953E8@argo.es>
> Since MRTG saves the rate bytes per second in the log file, and uses
> only integer values, how are decimals managed?. The fractions are
> rounded or truncated?.
I've studied "rateup.c" from MRTG 2.1 and the answer is: it truncates!!.
Here you have a patch to rounding. It's not checked and must be applied to MRTG 2.1. Not the most current version, you know :-)
The patch is not perfect because MRTG should keep the truncated "last read", not the real "last read". For example:
Time between samples: 300 seconds (5 minutes)
Current
412108 1105330 2005854 2541658 3011190 |
Last
0 412108 1105330 2005854 2541658 |
Real Bps
1373.6933 2310.74 3001.7466 1786.0133 1565.1066 |
Reported
1373 2310 3001 1786 1565 |
Reported Bps (1)
1374 2311 3002 1786 1565 |
Reported Bps (2)
1373 2311 3002 1786 1565 |
Bytes Missed | 690 | -210 | 90 (3) |
Real Counter
450 890 1190 1658 |
Value stored
300 600 900 1500 |
The graph for the current MRTG would be:
450, 440 (850-450), 300 (1190-890), 468 (1658-1190)Dividing by 300
1, 1, 1, 1Using the "multiple of the sample-time", the graph would be:
1, 1, 1, 2That is, the bytes missed in each sample are accumulated. So, they are not lost. Only "delayed".
The problem with such a patch is that "last sample" is stored in the log as a string, not as a number. So, if we want to modify it we must add a routine to do so, like the "diff()" routine.
We can't either to modify the MRTG perl because it has no time references.
Any idea?. Are these patches applicable to current MRTG release?.
The following patch is (1), not (2):
--- rateup.c.old Fri Nov 20 17:58:39 1998 +++ rateup.c Fri Nov 20 18:36:04 1998 @@ -135,7 +135,7 @@ outmax = max(outmax,history[n].outmax);\ if (now < history[n].time && n < histvalid) n++; \ } while(now < history[n].time && n < histvalid) ; \ - inr /= avc; outr /= avc; now += steptime; + inr=(inr+avc/2)/avc; outr=(outr+avc/2)/avc; now += steptime; @@ -660,8 +660,8 @@ inrate = diff(in,last.in); outrate = diff(out,last.out); } else { - inrate = diff(in,last.in) / period; - outrate = diff(out,last.out) / period; + inrate = (diff(in,last.in)+period/2) / period; + outrate = (diff(out,last.out)+period/2) / period; } } if (inrate < 0 || inrate > abs_max) inrate = history[0].in;-- Jesus Cea Avion _/_/ _/_/_/ _/_/_/ jcea@argo.es http://www.argo.es/~jcea/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/_/_/_/ PGP Key Available at KeyServ _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -- * To unsubscribe from the mrtg mailing list, send a message with the subject: unsubscribe to mrtg-request@list.ee.ethz.ch * The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg
Más información sobre los OpenBadges
Donación BitCoin: 19niBN42ac2pqDQFx6GJZxry2JQSFvwAfS