[mrtg] Problem with conversion code

Neil Jowsey n.jowsey at leeds.ac.uk
Fri Aug 13 16:23:38 MEST 2004


Hello, 

I seem to be having problems with calling a ConversionCode routine, I'm
getting the same value returned (and therefore plotted) for both Rx and
Tx values as if I was using the same OID twice, which I am not. This
only started to happen when I used a Perl conversion subroutine to
convert a 64 bit number, returned as octets, into a decimal number. In
the instructions it says the routine should be called twice, once for
each OID. I'm obviously making a mistake somewhere but can't see it at
the moment.

Can anyone see where I'm going wrong?

Cheers

Neil


Here's a snippet of a log file...

1092405295 201852320405 201852320405
1092405295 22004 22004 22004 22004
1092404995 16922 16922 16922 16922
1092404700 282 282 16922 16922

Here's the target line:
Target[FC-SW3.port00]:
.1.3.6.1.4.1.289.2.1.1.2.3.1.1.68.1&.1.3.6.1.4.1.289.2.1.1.2.3.1.1.67.1:
xxxxxx at xx.xx.xx.xx|convert64 

Here's my Perl conversion subroutine, I'm no Perl Programmer :-)

sub convert64 {

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

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

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

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



--
*************************************************************
 Neil Jowsey, Systems Storage Co-ordinator _________         
 Information Systems Services             |         |        
 The Computer Block, The University ___  _|__\___\_ |_  ___  
 of Leeds. Leeds, LS2 9JT.         /   \(_)         (_)/   \ 
 Tel. +44 113 343 5687 Fax. 5411   |`-'|o|  _______  |o|`-'| 
 ICQ: 29610685                     |   |/| (_______) |\|   | 
 N.Jowsey at leeds.ac.uk              |___|--\_________/--|___| 
           http://www.personal.leeds.ac.uk/~eclnj/           
*************************************************************
    Karma police, I've given all I can; it's not enough.     
    I've given all I can; but we're still on the payroll...  
 
 

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