[mrtg] Problem with conversion code routine.

Neil Jowsey n.jowsey at leeds.ac.uk
Tue Mar 8 11:07:22 MET 2005


Hello, 

I was wondering if anyone can help me with a problem on graphing the Rx
and Tx packets from a Fibre Channel switch using the inbuilt conversion
code function?

I can sucessfully graph the data by calling SNMPget from an MRTG file,
but this is CPU intensive so I want to make it more efficient so I'm now
trying with the conversion code facility. I need to do some conversion
as the 64 bit counter OIDs return Hex characters, not integers, when
queried by MRTG.

The problem I am getting is that the Tx and Rx graphs are the same (Rx
is incorrectly being plotted the same as Tx). Is far as I understand the
conversion code should be called twice (once for each OID). As a specify
two different OIDs in the MRTG config file it could be a side effect of
my PERL code (I'm no PERL programmer).

Has anyone seen this before or can see what I'm doing wrong. I'm a bit
stuck with this one :-(

I'm using MRTG 2.11.1 on a Windows XP workstation.

Neil

The .cfg looks like this:
----------------------------------
Htmldir: D:\www\mrtg2
ImageDir: D:\www\mrtg2\images
LogDir: D:\www\mrtg2\logs

ConversionCode: convert64.pl

EnableIPv6: no
RunAsDaemon: yes

Include: .\test1.cfg
------------------------------------


The OID Target line is like this
------------------------------------
Target[FC-SW3.port01]:
.1.3.6.1.4.1.289.2.1.1.2.3.1.1.68.2&.1.3.6.1.4.1.289.2.1.1.2.3.1.1.67.2:
XXXXXXXXX at yy.yy.yy.yy::8:::2|convert64 * 4 
------------------------------------

The convert64.pl file is like this (not pretty but it does the
conversion).

-------------------------------
sub convert64 {

open (STDERR, ">error.txt");
my $a=shift;
my $b = "";
my $c = "";
my $n=length $a;
my @d;

$c=$a;

#print $a,"\n";

for( my $counter = 1; $counter <= $n; $counter++)
{
  $d[$counter]=chop($c);
}

$c = "";

for(my $counter=$n; $counter >= 1; $counter--) 
{
#   printf '%x ',ord($d[$counter]);
  $b=join("",$b,sprintf '%02x',ord($d[$counter]));
}

#print $a,"\n";
#print $n,"\n";
#print $b,"\n";
#print hex ($b), "\n";
return hex ($b);
}
-----------------------------


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