Comments (5)
If the high cardinality is in the number of rows, you should be able to just walk each column separately.
If you have a manager m
, you can use m.cbQosServicePolicy.proxy.oid
to get the OID.
from snimpy.
Thanks for your answer (and the quick patching for Python 3.7 !).
I know I can walk each column, but I need about 30 of them (Cisco QoS is braindead...) so I will stick to walkmore().
I tried the m.XXX.proxy.oid
, but I can only get the OID of a column, not of the enclosing table. Here is an example. I want the oid of CbQosServicePolicyEntry
, which is 1.3.6.1.4.1.9.9.166.1.1.1.1
, but I can only access one of its column, e.g. o = m.cbQosIfIndex.proxy.oid
, which gives 1.3.6.1.4.1.9.9.166.1.1.1.1.4
, as expected. Is there a way to get the enclosing OID ? See below the MIB excerpt.
The error:
File ".../aj/qos.py", line 69, in collect
ooidxx = m.CbQosServicePolicyEntry.proxy.oid
File ".../venv/lib/python3.7/site-packages/snimpy/manager.py", line 318, in __getattribute__
m, a = self._locate(attribute)
File ".../venv/lib/python3.7/site-packages/snimpy/manager.py", line 313, in _locate
raise AttributeError("{0} is not an attribute".format(attribute))
AttributeError: CbQosServicePolicyEntry is not an attribute
Thanks for your help !
-- The cbQosServicePolicy group
cbQosServicePolicyTable OBJECT-TYPE
SYNTAX SEQUENCE OF CbQosServicePolicyEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"This table describes the logical interfaces/media types
and the policymap that are attached to it."
::= { cbQosServicePolicy 1 }
cbQosServicePolicyEntry OBJECT-TYPE
SYNTAX CbQosServicePolicyEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Each entry in this table describes to which a logical
interface a given policymap is attached. Depending on
the logical interface/media type, some fields may have
meaningful values, and some may not. Please see each
individual descriptions."
INDEX { cbQosPolicyIndex }
::= { cbQosServicePolicyTable 1 }
CbQosServicePolicyEntry ::= SEQUENCE {
cbQosPolicyIndex Unsigned32,
cbQosIfType InterfaceType,
cbQosPolicyDirection TrafficDirection,
cbQosIfIndex InterfaceIndex,
cbQosFrDLCI DlciNumber,
cbQosAtmVPI Unsigned32,
cbQosAtmVCI Unsigned32,
cbQosEntityIndex EntPhysicalIndexOrZero,
cbQosVlanIndex VlanIndex,
cbQosEVC Unsigned32,
cbQosPolicyDiscontinuityTime TimeStamp,
cbQosParentPolicyIndex Unsigned32
}
from snimpy.
You can use m.cbQosServicePolicyTable.proxy.oid
, but for some reason, it returns the first column instead. So, with the mib module, you can mib.get('IF-MIB', 'ifEntry').oid
.
from snimpy.
thx again Vincent! mib.get() works, but for nodes only. cbQosIfIndex
is a node, but the enclosing CbQosServicePolicyEntry
is a table, so I end up with an exception. Anyway, this is not really the idea of snimpy to do such things so I stop annoying you with these details !
def get(mib, name):
"""Get a node by its name.
:param mib: The MIB name to query
:param name: The object name to get from the MIB
:return: the requested MIB node (:class:`Node`)
"""
if not isinstance(mib, bytes):
mib = mib.encode("ascii")
module = _get_module(mib)
if module is None:
raise SMIException("no module named {0}".format(mib))
node = _smi.smiGetNode(module, name.encode("ascii"))
if node == ffi.NULL:
raise SMIException("in {0}, no node named {1}".format(
mib, name))
pnode = _kind2object(node.nodekind)
return pnode(node)
from snimpy.
mea culpa, it just works !
myoid = mib.get('CISCO-CLASS-BASED-QOS-MIB', 'cbQosServicePolicyEntry').oid
#<class 'tuple'>: (1, 3, 6, 1, 4, 1, 9, 9, 166, 1, 1, 1, 1)
You rock, thanks a million !
from snimpy.
Related Issues (20)
- PMPP support? HOT 4
- snimpy/manager.py broken in Python 3.7
- How to get KEEPALIVED-MIB::vrrpSyncGroupState HOT 8
- print(mgr.fgVpnTunEntPhase1Name.items()) produces "snimpy.snmp.SNMPNoSuchInstance: No such instance exists" HOT 3
- BGP4-V2-MIB-JUNIPER, take 2
- Use the native Python ipaddress types HOT 4
- SNMP Community Strings greater than 32 characters crash HOT 2
- Confusing example in documentation HOT 1
- Return the pretty name from a referenced OID HOT 5
- Deprecation warning: snimpy not compatible with upcoming Python 3.10 HOT 2
- use unittest.mock instead of mock HOT 1
- Installation snimpy error on AlmaLinux 8.6 HOT 11
- Add how to add an new MIB path into the documentation HOT 1
- Migrate from unsupported pysnmp to pysnmp-lexstudio
- Publish a new release HOT 1
- testMultipleThreads failed HOT 2
- TestMain::test_loadfile gets stuck in 2038 HOT 4
- [HOW TO] walk over multiple node with manager?
- Occasional stucks with snimpy 1.0.2, working with 1.0.0 HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from snimpy.