Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

;pyasn1.type.error.ValueConstraintError: 3747938579 #357

Open
sugat009 opened this issue Apr 30, 2020 · 4 comments
Open

;pyasn1.type.error.ValueConstraintError: 3747938579 #357

sugat009 opened this issue Apr 30, 2020 · 4 comments

Comments

@sugat009
Copy link

Hi,
I was trying to get storage data from the machines in my network using PySNMP using the following script.

from pysnmp.hlapi import nextCmd, SnmpEngine, CommunityData, ContextData, ObjectType, ObjectIdentity, UdpTransportTarget
import pandas as pd

host_name = "XXXXXXXXXX"
community_string = "XXXXXXXXXXX"

storage_oid_map = {
    'hrStorageIndex': '1.3.6.1.2.1.25.2.3.1.1',
    'hrStorageType': '1.3.6.1.2.1.25.2.3.1.2',
    'hrStorageDescr': '1.3.6.1.2.1.25.2.3.1.3',
    'hrStorageAllocationUnits': '1.3.6.1.2.1.25.2.3.1.4',
    'hrStorageSize': '1.3.6.1.2.1.25.2.3.1.5',
    'hrStorageUsed': '1.3.6.1.2.1.25.2.3.1.6',
    'hrStorageAllocationFailures': '1.3.6.1.2.1.25.2.3.1.7'
}


def get_name(oid_map, oid, offset):
    try:
        trunc_oid = oid[:offset]
        return next((key for key, val in oid_map.items() if val == trunc_oid), None)
    except BaseException as e:
        print('Error while getting name of oid: %s' % e)
        raise e


def get_storages(host_name, community, timeout_seconds):
    try:
        results = []
        for (errorIndication, errorStatus, errorIndex, varBinds) in \
                nextCmd(SnmpEngine(),
                        CommunityData(community, mpModel=0),
                        UdpTransportTarget(
                            (host_name, 161), timeout=timeout_seconds, retries=3),
                        ContextData(),
                        ObjectType(ObjectIdentity(
                            storage_oid_map['hrStorageIndex'])),
                        ObjectType(ObjectIdentity(
                            storage_oid_map['hrStorageType'])),
                        ObjectType(ObjectIdentity(
                            storage_oid_map['hrStorageDescr'])),
                        ObjectType(ObjectIdentity(
                            storage_oid_map['hrStorageAllocationUnits'])),
                        ObjectType(ObjectIdentity(
                            storage_oid_map['hrStorageSize'])),
                        ObjectType(ObjectIdentity(
                            storage_oid_map['hrStorageUsed'])),
                        ObjectType(ObjectIdentity(
                            storage_oid_map['hrStorageAllocationFailures'])),
                        lexicographicMode=False, lookupMib=False):
            conn = {}
            if errorIndication:
                print(f"Error indication: {errorIndication}")
                break
            elif errorStatus:
                print("error status")
                print('{0} at {1}'.format(errorStatus.prettyPrint(),
                                          errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
                break
            else:
                for varBind in varBinds:
                    key = get_name(
                        storage_oid_map, varBind[0].prettyPrint(), offset=22)
                    val = varBind[1].prettyPrint()
                    conn[key] = val
                results.append(conn)
        if len(results) == 0:
            print('Could not collect storages data')
            raise Exception('Could not collect storages data')
        results_df = pd.DataFrame(results)
        print(results_df)
        results_columns = list(results_df.columns.values)
        DiskSize, DiskUsed, DiskFree, DisK_Usage, RAMSize, RAMUsed, RAMFree, RAM_Usage = 0, 0, 0, 0, 0, 0, 0, 0
        NFS_list = []
        if 'hrStorageType' in results_columns:
            # results_df.replace({'hrStorageType' :storage_oid_map})
            disk_info = results_df.loc[results_df['hrStorageType'].isin(
                ['1.3.6.1.2.1.25.2.1.3', '1.3.6.1.2.1.25.2.1.4'])]
            disk_info = disk_info.fillna(0)
            ram_info = results_df.loc[results_df['hrStorageType'].isin(
                ['1.3.6.1.2.1.25.2.1.2'])]
            ram_info = ram_info.fillna(0)
            nfs_info = results_df.loc[results_df['hrStorageType'].isin(
                ['1.3.6.1.2.1.25.2.1.10'])]
            nfs_info = nfs_info.fillna(0)
            DiskSize, DiskUsed, RAMSize, RAMUsed = 0, 0, 0, 0
            for row in disk_info.itertuples():
                DiskSize += int(row.hrStorageSize) * \
                    int(row.hrStorageAllocationUnits)
                DiskUsed += int(row.hrStorageUsed) * \
                    int(row.hrStorageAllocationUnits)
            DiskFree = DiskSize - DiskUsed
            DisK_Usage = DiskUsed / DiskSize * 100
            for row in ram_info.itertuples():
                RAMSize += int(row.hrStorageSize) * \
                    int(row.hrStorageAllocationUnits)
                RAMUsed += int(row.hrStorageUsed) * \
                    int(row.hrStorageAllocationUnits)
            RAMFree = RAMSize - RAMUsed
            RAM_Usage = RAMUsed / RAMSize * 100
            for row in nfs_info.itertuples():
                NFS_list.append({'Size': int(row.hrStorageSize) * int(row.hrStorageAllocationUnits),
                                 'Description': str(row.hrStorageDescr), 'Used': row.hrStorageUsed})
        # Checking if RAM size is valid or not:
        if RAMSize == 0:
            print('Could not get mandatory field RAM size')
            raise Exception('Could not get mandatory field RAM size')
        return {"Disk": {"Size": DiskSize, "Used": DiskUsed, "Free": DiskFree, "Used(%)": DisK_Usage},
                "RAM": {"Size": RAMSize, "Used": RAMUsed, "Free": RAMFree, "Used(%)": RAM_Usage},
                "NFS": NFS_list}
    except BaseException as e:
        print('Error while getting storage details : %s' % e)
        raise e
try:
    print(get_storages(host_name, community_string, 5))
except Exception as e:
    print(e)

This script was executing normally for a few machines but for some I got the following error:

poll error: Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 32, in call
self._testValue(value, idx)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 222, in _testValue
raise error.ValueConstraintError(value)
;pyasn1.type.error.ValueConstraintError: 3747938579
;
During handling of the above exception, another exception occurred:

;Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 32, in call
self._testValue(value, idx)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 497, in _testValue
constraint(value, idx)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 36, in call
'%s failed at: %r' % (self, sys.exc_info()[1])
;pyasn1.type.error.ValueConstraintError: <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)
;
During handling of the above exception, another exception occurred:

;Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 242, in init
self.subtypeSpec(value)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 36, in call
'%s failed at: %r' % (self, sys.exc_info()[1])
;pyasn1.type.error.ValueConstraintError: <ConstraintsIntersection object at 0x7f270e71eeb8 consts <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647>> failed at: ValueConstraintError('<ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)',)
;
During handling of the above exception, another exception occurred:

;Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 46, in runDispatcher
use_poll=True, map=self.__sockMap, count=1)
; File "/usr/lib64/python3.6/asyncore.py", line 207, in loop
poll_fun(timeout, map)
; File "/usr/lib64/python3.6/asyncore.py", line 188, in poll2
readwrite(obj, flags)
; File "/usr/lib64/python3.6/asyncore.py", line 123, in readwrite
obj.handle_error()
; File "/usr/lib64/python3.6/asyncore.py", line 108, in readwrite
obj.handle_read_event()
; File "/usr/lib64/python3.6/asyncore.py", line 423, in handle_read_event
self.handle_read()
; File "/usr/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 163, in handle_read
self._cbFun(self, transportAddress, incomingMessage)
; File "/usr/lib/python3.6/site-packages/pysnmp/carrier/base.py", line 70, in _cbFun
self, transportDomain, transportAddress, incomingMessage
; File "/usr/lib/python3.6/site-packages/pysnmp/entity/engine.py", line 152, in __receiveMessageCbFun
self, transportDomain, transportAddress, wholeMsg
; File "/usr/lib/python3.6/site-packages/pysnmp/proto/rfc3412.py", line 486, in receiveMessage
cachedParams['cbCtx'])
; File "/usr/lib/python3.6/site-packages/pysnmp/entity/rfc3413/cmdgen.py", line 142, in processResponsePdu
PDU = rfc2576.v1ToV2(PDU, origPdu)
; File "/usr/lib/python3.6/site-packages/pysnmp/proto/proxy/rfc2576.py", line 142, in v1ToV2
(oid, __v1ToV2ValueMap[v1Val.tagSet].clone(v1Val))
; File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 349, in clone
return self.class(value, **initilaizers)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/univ.py", line 103, in init
base.AbstractSimpleAsn1Item.init(self, value, **kwargs)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 246, in init
raise exType('%s at %s' % (exValue, self.class.name))
;pyasn1.type.error.ValueConstraintError: <ConstraintsIntersection object at 0x7f270e71eeb8 consts <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647>> failed at: ValueConstraintError('<ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)',) at Integer32

ERROR [2020-04-29 00:05:05] 12018/139803810891520 snmp_data_collector.py snmp_data_collector : Error while poll error: Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 32, in call
self._testValue(value, idx)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 222, in _testValue
raise error.ValueConstraintError(value)
;pyasn1.type.error.ValueConstraintError: 3747938579
;
During handling of the above exception, another exception occurred:

;Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 32, in call
self._testValue(value, idx)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 497, in _testValue
constraint(value, idx)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 36, in call
'%s failed at: %r' % (self, sys.exc_info()[1])
;pyasn1.type.error.ValueConstraintError: <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)
;
During handling of the above exception, another exception occurred:

;Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 242, in init
self.subtypeSpec(value)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 36, in call
'%s failed at: %r' % (self, sys.exc_info()[1])
;pyasn1.type.error.ValueConstraintError: <ConstraintsIntersection object at 0x7f270e71eeb8 consts <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647>> failed at: ValueConstraintError('<ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)',)
;
During handling of the above exception, another exception occurred:

;Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 46, in runDispatcher
use_poll=True, map=self.__sockMap, count=1)
; File "/usr/lib64/python3.6/asyncore.py", line 207, in loop
poll_fun(timeout, map)
; File "/usr/lib64/python3.6/asyncore.py", line 188, in poll2
readwrite(obj, flags)
; File "/usr/lib64/python3.6/asyncore.py", line 123, in readwrite
obj.handle_error()
; File "/usr/lib64/python3.6/asyncore.py", line 108, in readwrite
obj.handle_read_event()
; File "/usr/lib64/python3.6/asyncore.py", line 423, in handle_read_event
self.handle_read()
; File "/usr/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 163, in handle_read
self._cbFun(self, transportAddress, incomingMessage)
; File "/usr/lib/python3.6/site-packages/pysnmp/carrier/base.py", line 70, in _cbFun
self, transportDomain, transportAddress, incomingMessage
; File "/usr/lib/python3.6/site-packages/pysnmp/entity/engine.py", line 152, in __receiveMessageCbFun
self, transportDomain, transportAddress, wholeMsg
; File "/usr/lib/python3.6/site-packages/pysnmp/proto/rfc3412.py", line 486, in receiveMessage
cachedParams['cbCtx'])
; File "/usr/lib/python3.6/site-packages/pysnmp/entity/rfc3413/cmdgen.py", line 142, in processResponsePdu
PDU = rfc2576.v1ToV2(PDU, origPdu)
; File "/usr/lib/python3.6/site-packages/pysnmp/proto/proxy/rfc2576.py", line 142, in v1ToV2
(oid, __v1ToV2ValueMap[v1Val.tagSet].clone(v1Val))
; File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 349, in clone
return self.class(value, **initilaizers)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/univ.py", line 103, in init
base.AbstractSimpleAsn1Item.init(self, value, **kwargs)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 246, in init
raise exType('%s at %s' % (exValue, self.class.name))
;pyasn1.type.error.ValueConstraintError: <ConstraintsIntersection object at 0x7f270e71eeb8 consts <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647>> failed at: ValueConstraintError('<ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)',) at Integer32
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 32, in call
self._testValue(value, idx)
File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 222, in _testValue
raise error.ValueConstraintError(value)
pyasn1.type.error.ValueConstraintError: 3747938579

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 32, in call
self._testValue(value, idx)
File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 497, in _testValue
constraint(value, idx)
File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 36, in call
'%s failed at: %r' % (self, sys.exc_info()[1])
pyasn1.type.error.ValueConstraintError: <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 242, in init
self.subtypeSpec(value)
File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 36, in call
'%s failed at: %r' % (self, sys.exc_info()[1])
pyasn1.type.error.ValueConstraintError: <ConstraintsIntersection object at 0x7f270e71eeb8 consts <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647>> failed at: ValueConstraintError('<ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)',)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 46, in runDispatcher
use_poll=True, map=self.__sockMap, count=1)
File "/usr/lib64/python3.6/asyncore.py", line 207, in loop
poll_fun(timeout, map)
File "/usr/lib64/python3.6/asyncore.py", line 188, in poll2
readwrite(obj, flags)
File "/usr/lib64/python3.6/asyncore.py", line 123, in readwrite
obj.handle_error()
File "/usr/lib64/python3.6/asyncore.py", line 108, in readwrite
obj.handle_read_event()
File "/usr/lib64/python3.6/asyncore.py", line 423, in handle_read_event
self.handle_read()
File "/usr/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 163, in handle_read
self._cbFun(self, transportAddress, incomingMessage)
File "/usr/lib/python3.6/site-packages/pysnmp/carrier/base.py", line 70, in _cbFun
self, transportDomain, transportAddress, incomingMessage
File "/usr/lib/python3.6/site-packages/pysnmp/entity/engine.py", line 152, in __receiveMessageCbFun
self, transportDomain, transportAddress, wholeMsg
File "/usr/lib/python3.6/site-packages/pysnmp/proto/rfc3412.py", line 486, in receiveMessage
cachedParams['cbCtx'])
File "/usr/lib/python3.6/site-packages/pysnmp/entity/rfc3413/cmdgen.py", line 142, in processResponsePdu
PDU = rfc2576.v1ToV2(PDU, origPdu)
File "/usr/lib/python3.6/site-packages/pysnmp/proto/proxy/rfc2576.py", line 142, in v1ToV2
(oid, __v1ToV2ValueMap[v1Val.tagSet].clone(v1Val))
File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 349, in clone
return self.class(value, **initilaizers)
File "/usr/lib/python3.6/site-packages/pyasn1/type/univ.py", line 103, in init
base.AbstractSimpleAsn1Item.init(self, value, **kwargs)
File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 246, in init
raise exType('%s at %s' % (exValue, self.class.name))
pyasn1.type.error.ValueConstraintError: <ConstraintsIntersection object at 0x7f270e71eeb8 consts <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647>> failed at: ValueConstraintError('<ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)',) at Integer32

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/app/ApplicationVersionManager/base/engine/snmp_data_collector.py", line 815, in snmp_data_collector
usage = self.get_storages(host_name, community, timeout_seconds)
File "/app/ApplicationVersionManager/base/engine/snmp_data_collector.py", line 536, in get_storages
raise e
File "/app/ApplicationVersionManager/base/engine/snmp_data_collector.py", line 446, in get_storages
lexicographicMode=False, lookupMib=False):
File "/usr/lib/python3.6/site-packages/pysnmp/hlapi/asyncore/sync/cmdgen.py", line 360, in nextCmd
snmpEngine.transportDispatcher.runDispatcher()
File "/usr/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 50, in runDispatcher
raise PySnmpError('poll error: %s' % ';'.join(format_exception(*exc_info())))
pysnmp.error.PySnmpError: poll error: Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 32, in call
self._testValue(value, idx)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 222, in _testValue
raise error.ValueConstraintError(value)
;pyasn1.type.error.ValueConstraintError: 3747938579
;
During handling of the above exception, another exception occurred:

;Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 32, in call
self._testValue(value, idx)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 497, in _testValue
constraint(value, idx)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 36, in call
'%s failed at: %r' % (self, sys.exc_info()[1])
;pyasn1.type.error.ValueConstraintError: <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)
;
During handling of the above exception, another exception occurred:

;Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 242, in init
self.subtypeSpec(value)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/constraint.py", line 36, in call
'%s failed at: %r' % (self, sys.exc_info()[1])
;pyasn1.type.error.ValueConstraintError: <ConstraintsIntersection object at 0x7f270e71eeb8 consts <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647>> failed at: ValueConstraintError('<ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)',)
;
During handling of the above exception, another exception occurred:

;Traceback (most recent call last):
; File "/usr/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 46, in runDispatcher
use_poll=True, map=self.__sockMap, count=1)
; File "/usr/lib64/python3.6/asyncore.py", line 207, in loop
poll_fun(timeout, map)
; File "/usr/lib64/python3.6/asyncore.py", line 188, in poll2
readwrite(obj, flags)
; File "/usr/lib64/python3.6/asyncore.py", line 123, in readwrite
obj.handle_error()
; File "/usr/lib64/python3.6/asyncore.py", line 108, in readwrite
obj.handle_read_event()
; File "/usr/lib64/python3.6/asyncore.py", line 423, in handle_read_event
self.handle_read()
; File "/usr/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 163, in handle_read
self._cbFun(self, transportAddress, incomingMessage)
; File "/usr/lib/python3.6/site-packages/pysnmp/carrier/base.py", line 70, in _cbFun
self, transportDomain, transportAddress, incomingMessage
; File "/usr/lib/python3.6/site-packages/pysnmp/entity/engine.py", line 152, in __receiveMessageCbFun
self, transportDomain, transportAddress, wholeMsg
; File "/usr/lib/python3.6/site-packages/pysnmp/proto/rfc3412.py", line 486, in receiveMessage
cachedParams['cbCtx'])
; File "/usr/lib/python3.6/site-packages/pysnmp/entity/rfc3413/cmdgen.py", line 142, in processResponsePdu
PDU = rfc2576.v1ToV2(PDU, origPdu)
; File "/usr/lib/python3.6/site-packages/pysnmp/proto/proxy/rfc2576.py", line 142, in v1ToV2
(oid, __v1ToV2ValueMap[v1Val.tagSet].clone(v1Val))
; File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 349, in clone
return self.class(value, **initilaizers)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/univ.py", line 103, in init
base.AbstractSimpleAsn1Item.init(self, value, **kwargs)
; File "/usr/lib/python3.6/site-packages/pyasn1/type/base.py", line 246, in init
raise exType('%s at %s' % (exValue, self.class.name))
;pyasn1.type.error.ValueConstraintError: <ConstraintsIntersection object at 0x7f270e71eeb8 consts <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647>> failed at: ValueConstraintError('<ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)',) at Integer32

What causes this and what are the work-arounds to this "ValueConstraintError"?

@Jasonjiang27
Copy link

same question,who can help resolve this ?

@Rojina99
Copy link

Rojina99 commented Dec 10, 2020

same question,who can help resolve this ?

@Jasonjiang27 Were you able to find any answer to the issue ?

@etingof could you please look into this ?

@iceaway
Copy link

iceaway commented Dec 8, 2021

Not sure this helps, but I got the same kind of error message when I was trying to connect to an agent using SVMPv3, and specified a passphrase that was too short (< 8 chars). Maybe one of the parameters that you use has an incorrect format?

@danielboydston
Copy link

danielboydston commented Feb 16, 2022

It looks like your integer value is too large. The error message indicates the allowed value range is -2147483648 to 2147483647:

;pyasn1.type.error.ValueConstraintError: <ValueRangeConstraint object at 0x7f270e71ee48 consts -2147483648, 2147483647> failed at: ValueConstraintError(3747938579,)

The value being passing in (3747938579) exceeds these limits. This looks to be a value being retrieved by the SNMP query. I haven't deeply analyzed your code to determine exactly where it's occurring, but the value is being constrained to a 32 bit integer.

ValueConstraintError(3747938579,)',) at Integer32

I'm not sure where or why these data type constraints are being introduced, but hopefully this can will help you get to a resolution.

I ran into a similar issue using pynsmp and had a ValueConstraintError on a string that exceeded 32 characters. To solve my problem, I just restricted my string to the first 32 characters. This didn't negatively impact what I was trying to accomplish, so it worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants