[mrtg] Re: MRTG losing Bytes in Octet string

David Landgren david at landgren.net
Thu May 27 10:19:38 MEST 2004


Rene Buechler wrote:

> 
> 
> 
> 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 found,
> 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;

David

> Had someone allready this problem?
> 
> Regards Rene Buechler
> 
> 
> 
> 
> 
> 
> 
> ******************* 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
> 


-- 
Commercial OS breeds commerce, whereas free OS breeds freedom,
the only thing more dangerous and confusing than commerce.
                   -- Michael R. Jinks, redhat-list, circa 1997

--
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