Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
acc39e6a
Commit
acc39e6a
authored
Mar 13, 2002
by
Robert Ricci
Browse files
Add a getFields() function like the one (actually, nearly identical to
the one) in snmpit_cisco.pm
parent
17a0b74e
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/snmpit_intel.pm
View file @
acc39e6a
...
...
@@ -1090,6 +1090,59 @@ sub getStats($) {
}
#
# usage: getFields(self,ports,oids)
# ports: Reference to a list of ports, in any allowable port format
# oids: A list of OIDs to reteive values for
#
# On sucess, returns a two-dimensional list indexed by port,oid
#
sub
getFields
($$$)
{
my
$self
=
shift
;
my
(
$ports
,
$oids
)
=
@_
;
my
@ifindicies
=
map
{
portnum
(
$_
)
=~
/:1\.(\d+)$/
;
$
1
}
@$ports
;
my
@oids
=
@$oids
;
#
# Put together an SNMP::VarList for all the values we want to get
#
my
@vars
=
();
foreach
my
$ifindex
(
@ifindicies
)
{
foreach
my
$oid
(
@oids
)
{
push
@vars
,
["
$oid
","
$ifindex
"];
}
}
#
# If we try to ask for too many things at once, we get back really bogus
# errors. So, we limit ourselves to an arbitrary number that, by
# experimentation, works.
#
my
$maxvars
=
16
;
my
@results
=
();
while
(
@vars
)
{
my
$varList
=
new
SNMP::
VarList
(
splice
(
@vars
,
0
,
$maxvars
));
my
$rv
=
$self
->
{
SESS
}
->
get
(
$varList
);
push
@results
,
@$varList
;
}
#
# Build up the two-dimensional list for returning
#
my
@return
=
();
foreach
my
$i
(
0
..
$#ifindicies
)
{
foreach
my
$j
(
0
..
$#oids
)
{
my
$val
=
shift
@results
;
$return
[
$i
][
$j
]
=
$$val
[
2
];
}
}
return
@return
;
}
#
# Prints out a debugging message, but only if debugging is on. If a level is
# given, the debuglevel must be >= that level for the message to print. If
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment