[mrtg] Re: Rateup under OBSD3.3/sparc64 problems

Corey Smith csmith at bonddesk.com
Mon Jun 16 15:33:01 MEST 2003


I believe there are a few problems with rateup and 64-bit environments. 
When I was trying to get mrtg/rrdtool to work on a FreeBSD/Sparc64
environment, I was having similar problems.

NOTE TO TOBIAS: Are these changes generic enough to incorporate into the
source tree for mrtg and rrdtool?  FreeBSD/x86 and FreeBSD/Sparc64 have
been using this patch for several months.

Try applying these patches I created (which are part of the ports
collection under FreeBSD).

<MRTGPATCH>
--- src/rateup.c.orig   Sat Apr 12 15:41:20 2003
+++ src/rateup.c        Mon Jun  2 10:42:04 2003
@@ -62,7 +62,7 @@
 #ifdef __MINGW32_VERSION
 #define LLD "%I64d"
 #else
-#define LLD "%lld"
+#define LLD "%qd"
 #endif
  
 /* WATCOM C/C++ 10.6 under Win95/NT */
@@ -840,12 +840,14 @@ char *file;
     struct HISTORY *hist;
     long long rd[5];
     time_t cur;
+    long lasttime;
  
     if ((fi = fopen(file,"r")) != NULL) {
-       if (fscanf(fi,"%ld %s %s\n",(long int
*)&last.time,&last.in[0],&last.out[0]) != 3){
+       if (fscanf(fi,"%ld %s %s\n",&lasttime,&last.in[0],&last.out[0])
!= 3){
            fprintf(stderr,"Read Error: File %s lin 1\n",file);
           retcode = 1;
        }
+       last.time = lasttime;
         cur = last.time;
        x = histvalid=0;
        hist = history;
</MRTGPATCH>

<RRDTOOLPATCH>
--- src/parsetime.c.orig        Fri Oct 11 14:39:46 2002
+++ src/parsetime.c     Mon Feb 10 20:47:18 2003
@@ -660,6 +660,7 @@
 {
     long mday=0, wday, mon, year = ptv->tm.tm_year;
     int tlen;
+    time_t montime;
  
     switch (sc_tokid) {
     case YESTERDAY:
@@ -713,7 +714,8 @@
            tlen = strlen(sc_token);
            mon = atol(sc_token);
             if (mon > 10*356*24*60*60) {
-               ptv->tm=*localtime(&mon);
+               montime = mon;
+               ptv->tm=*localtime(&montime);
                token();
                break;
            }
</RRDTOOLPATCH>

Please let me know if this works for you...

-Corey

On Mon, 2003-06-16 at 05:52, Boris Meyer wrote:
> Hello there!
> 
> I'm writing to this list, because intensive searching in google and
> mailing-lists gave me no answer to my problem.
> 
> I'm using mrtg under OpenBSD3.3/sparc64 (Netra X1 Box) and rateup won't
> work as it should (looks like). I used the same config-file under an
> other box without problems.
> 
> I got this problem under the mrtg-version of the current ports-tree
> (2.9.12a) and the self-compiled actual version (2.9.29). The compiler:
> 
> # gcc -v
> Reading specs from /usr/lib/gcc-lib/sparc64-unknown-openbsd3.3/2.95.3/specs
> gcc version 2.95.3 20010125 (prerelease, propolice)
> 
> The problem:
> ------------
> 
> If I start mrtg, I'll get the following error-msgs:
> 
> bash-2.05b# mrtg /etc/mrtg.cfg
> Rateup ERROR: /usr/local/bin/rateup found 213.180.174.249_10's log file
> was corrupt
>           or not in sorted order:
> time: 1055755651.Rateup WARNING: /usr/local/bin/rateup could not read
> the primary log file for 213.180.174.249_10
> Rateup ERROR: /usr/local/bin/rateup found 213.180.174.249_10's log file
> was corrupt
>           or not in sorted order:
> time: 1055755644.Rateup WARNING: /usr/local/bin/rateup The backup log
> file for 213.180.174.249_10 was invalid as well
> 2003-06-16 11:27:38 -- WARNING: rateup died from Signal 0
>  with Exit Value 1 when doing router '213.180.174.249_10'
>  Signal was 0, Returncode was 1
> 
> It's not a permission-problem, I'm starting the whole thing under root -
> file/dir-permissions are okay. I read somewhere about a similar problem,
> but there was no answer available anywhere.
> 
> Here the mrtg.cfg (without comments):
> 
> WorkDir: /var/www/htdocs/tempdir
> Options[_]: growright
> 
> Target[213.180.174.249_10]: 10:username at 213.180.174.249:
> SetEnv[213.180.174.249_10]: MRTG_INT_IP="212.90.192.131"
> MRTG_INT_DESCR="poe0"
> MaxBytes[213.180.174.249_10]: 64000
> Title[213.180.174.249_10]: Traffic Analysis for subcult.ch (ExtIF)
> PageTop[213.180.174.249_10]: <H1>Traffic Analysis for subcult.ch
> (ExtIF)</H1>
>  <TABLE>
>    <TR><TD>System:</TD>     <TD>subcult.ch</TD></TR>
>    <TR><TD>Description:</TD><TD>poe0  </TD></TR>
>    <TR><TD>ifType:</TD>     <TD>pppOE</TD></TR>
>    <TR><TD>Max Speed:</TD>  <TD>512.0 kbits/s</TD></TR>
>    <TR><TD>Ip:</TD>         <TD>213.180.174.249</TD></TR>
>  </TABLE>
> 
> It's a bug in mrtg openbsd/sparc64 or does anybody have an idea, how I
> may fix this problem? 
> 
> Thank you + Greetings,
> Boris Meyer
> 
> 
> --
> Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
> Archive     http://www.ee.ethz.ch/~slist/mrtg
> FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
> WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi
> 

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list