You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a feature request to optionally ignore NoSuchInstance in Session._check_exception when more than one oids are queried via get(*oids). Minor changes are also needed in Session._convert to be able to handle this.
Why??
I am using the Session directly and I have been told that this is not the way snimpy is designed... so feel free to close this as invalid - I just thought I 'd ask...
What I need to do is query all the metrics of specific interface (I know the ifIndex) without fetching the whole ifTable. I am constructing all the OIDs and passing them directly to Session.get()
The problem is that different vendors support different OIDs! or they sometimes think is a good idea to randomly skip some... This causes get() to raise an exception while checking pysnmp's errorIndication.
Workaround
At the moment I am replacing the methods _check_exception and _convert. On the first I only remove the check for NoSuchInstance and on the second I add 2 lines:
...
if isinstance(value, cl):
return fn(value)
# ... check for no instance ...
if isinstance(value, rfc1905.NoSuchInstance):
return "NoSuchInstance"
# back to the original code
self._check_exception(value)
I think that would be a nice feature to have (disabled by default) that we can enable via Session.set_relax_no_instance(True) or something similar.
Please let me know if there an easier/other way of doing the same query with snimpy without working directly with pysnmp (I really like your Session :) ) and sorry for abusing snimpy again...
Andreas
The text was updated successfully, but these errors were encountered:
urban-1
changed the title
Ignore NoSuchInstance in Session._check_exception
Ignore NoSuchInstance in Session._check_exception (multiple OIDs get())
Mar 8, 2016
When using the high-level API, you can create a manager with none=True to get the behaviour you expect. Of course, this is of no use for you as you want to GET several OID at once.
We can add a similar argument to the Session it's tiny enough to not bother me that much.
Hi all,
This is a feature request to optionally ignore
NoSuchInstance
inSession._check_exception
when more than one oids are queried viaget(*oids)
. Minor changes are also needed inSession._convert
to be able to handle this.Why??
I am using the
Session
directly and I have been told that this is not the waysnimpy
is designed... so feel free to close this as invalid - I just thought I 'd ask...What I need to do is query all the metrics of specific interface (I know the
ifIndex
) without fetching the wholeifTable
. I am constructing all the OIDs and passing them directly toSession.get()
The problem is that different vendors support different OIDs! or they sometimes think is a good idea to randomly skip some... This causes
get()
to raise an exception while checkingpysnmp
'serrorIndication
.Workaround
At the moment I am replacing the methods
_check_exception
and_convert
. On the first I only remove the check forNoSuchInstance
and on the second I add 2 lines:The output for a Cisco I test here:
I think that would be a nice feature to have (disabled by default) that we can enable via
Session.set_relax_no_instance(True)
or something similar.Please let me know if there an easier/other way of doing the same query with
snimpy
without working directly withpysnmp
(I really like yourSession
:) ) and sorry for abusingsnimpy
again...Andreas
The text was updated successfully, but these errors were encountered: