Hello Guys
maybe it is impossible or at least i have no clue how to solve this myself :)
I am trying to load a config file in yaml style (which works). However in the yaml file are some constants which i want to get "translated" by Net::SNMP.
I tried it with an has before which worked a treat
my $snmpConf = (
'.1.3.6.1.4.1.1918.2.13.10.30.80.1.110.2' => { type => INTEGER
+ , 'value' => '1' },
);
This is the line in the yaml file
.1.3.6.1.4.1.1918.2.13.10.30.80.1.110.2:
type: INTEGER
value: "1"
Reading the values via the oid by snmpget is no problem at all.
However afaik Net::SNMP translates the bareword INTEGER into an integer value... right?
But when i now want to set an variable via snmp it needs to know the type and then it seems like it doesn't get translated to the value anymore.
foreach $oid ( keys $snmpConf) {
$snmp_session->set_request (-varbindlist => [$oid, $snmpConf->{$oid}{t
+ype}, $snmpConf->{$oid}{value}]);
....
Results in
ERROR: The ASN.1 type "OCTET_STRING" is unknown
So my question is, how can i, if at all, treat $snmpConf->{$oid}{type} like an Constant so it gets translated to the integer value?
tia :)
Mike
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.