[mrtg] Re: MRTG losing Bytes in Octet string

Rene Buechler rene.buechler at zurich.com
Fri May 28 10:03:36 MEST 2004

I spent some time with the perl debugger. I was able to find inside the
mrtg module the array (@ ret and @final)
where the octet string is stored. I've found that when inside the octet
string is a hex value of  0x0a or 0x0d, this
byte is allready lost. In this case I'm shure that the problem happens in
the mrtg itself. I was not able to find out
in which mrtg module the octet string will be posted to check the coctet
counter which is sent directly from the
FC/9000 before it will be manipulated or changed from any mrtg module.

Regards Rene

> Hi
> I'm using MRTG 2.10.13 on a Windows NT workstation.
> I'm scanning on our Ficon Directors FC/9000 (CNT) the Rx- and TxFrames to
> check the utilisation of each FC-Port.
> These Directors will give me back a 64-Bit counter value as an octet
> string.
> To convert this octet string I'm using the option ConversionCode and a
> small perl script.
> Now I have seen, that some values from the counters are wrong. I've
> that when inside an octet string is a Hex Byte with 0x0a or 0x0d these
> bytes gets lost. In this case, MRTG will handover to my subroutine only
> seven Bytes instead of 8 Bytes. I made a lot of tests and testet each hex
> code from 00 ... FF. Every hex code is ok except the two ones with Hex
> codes 0x0a and 0x0d which gets lost.

Hmm, I smell newline munging. Unix represents newlines with the single
character \x0d but DOS (Windows) uses \x0d\x0a. This is why (among other
reasons) we have ASCII and Binary transfers in FTP: it lets the programs
munge the newlines correctly so that text files get displayed correctly.
Of course, when you are dealing with binary data you don't want that to
happen. I suspect this is what is happening to you.

In your Perl script, make sure you do a binmode on your output handle,
before it prints anything, e.g.:

binmode STDOUT;
print $counter;


******************* PLEASE NOTE *******************
This message, along with any attachments, may be confidential or legally
privileged.  It is intended only for the named person(s), who is/are the
only authorized recipients. If this message has reached you in error,
kindly destroy it without review and notify the sender immediately. Thank
you for your help.

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