I just did this:
sub get_oids{
my($starting_oid , $new_oid , $unique_oid , $result , $crap);
my($ip , $name , $port , $type);
$starting_oid = $_[0];
$new_oid = $starting_oid ;
# while(Net::SNMP::oid_context_match($starting_oid,$new_oid)){
while(Net::SNMP::oid_base_match($starting_oid,$new_oid)){
$result = $session->get_next_request(($new_oid));
return unless (defined $result);
($new_oid , $crap) = %$result;
# if (Net::SNMP::oid_context_match($starting_oid,$new_oid))
+{
if (Net::SNMP::oid_base_match($starting_oid,$new_oid)){
$unique_oid = $new_oid;
$unique_oid =~ s/$starting_oid//g;
$ip = (Convert_IP(Get_SNMP_Info("$oid_root".".4"."$unique_
+oid")));
$name = (Get_SNMP_Info("$oid_root".".6"."$unique_oid"));
$port = (Get_SNMP_Info("$oid_root".".7"."$unique_oid"));
$type = (Get_SNMP_Info("$oid_root".".8"."$unique_oid"));
@todo=(@todo,$ip);
write;
get_oids($new_oid);
}
}
#Format the report
format STDOUT =
@<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<
+<<<<<< @<<<<<<<<<<<<<<<<<<<<<
$ip,$name,$port,$type
.
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|