Greetings list,
My device returns an octet string for a query. To convert this hex value to an
integer I'm trying a ConversionCode subroutine which I've gleaned from this
list's archives. But every time the error is returned: "Illegal hexadecimal
digit".
Could it be that I need to strip off unnecessary characters passed by SNMP?
When I GET any of several similar OIDs, the returned result is always prefixed
by the bytes "04 05", followed by five more octets of hex data. Here's the
value returned from the OID representing an HTTP proxy cache's "Total amount of
object data transfered to browsers in Kbytes":
40.05.D6.DC.20.DE.0D
And the value for proxyStatsObjCacheDirectFetchedData ("Amount of object data
fetched from direct source in Kbytes").
04.05.51.D5.02.28.14
Do these bytes (04 05) simply indicate that what follows is hex? Does MRTG
strip this before passing it to the subroutine?
Here is a snip of the config file:
ConversionCode: hextoint.pl
Target[IPnumber_tput]:
1.3.6.1.4.1.23.2.66.2.2.6.0&1.3.6.1.4.1.23.2.66.2.2.7.0:[EMAIL
PROTECTED]|hextoint
Here is my perl code:
sub hextoint {
my $value = shift;
return hex ($value);
}
In troubleshooting, I've had the subroutine write $VALUE to a file both before
and (comma-separated) after processing. I get output like:
*:–*,0
F»+ ,15
I've never dealt with PERL before. I'm relying on PERL reference web sites and
mail list archives for everything. I love a challenge : > Next I'll want to
do math on the returned integer values. Seriously.
Anything you can offer to educate me would be greatly appreciated.
Thanks,
Dan Lynch, CISSP
Information Technology Analyst
County of Placer
Auburn, CA
--
Unsubscribe mailto:[EMAIL PROTECTED]
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