etingof / pysnmp

Python SNMP library
http://snmplabs.com/pysnmp/
BSD 2-Clause "Simplified" License
580 stars 200 forks source link

Help with solving repeat compile search on custom MIBs #391

Open johnmurtari opened 3 years ago

johnmurtari commented 3 years ago

Folks, I like this package, sorry to the developer is in bad health. Very close to using it on a project, it requires custom MIBs and it's just too slow... I think I'm missing something obvious....

I really like the package. I've spent days reviewing documentation, posts on Google. I think I understand what to do, tried several different things, but can't make headway. I'm downloaded the files for 2.6 and am running on RedHat 6.9, python 2.6. I've tried to simplify the issue below:

     If I use snmpget.py  to retrieve a standard SNMPv2-MIB, the request completes very quickly:

$:~/jm1/python$ time snmpget.py -v 2c -c public 1.2.3.4 SNMPv2-MIB::sysDescr.0 SNMPv2-MIB::sysDescr.0 = DisplayString: BIG-IP Virtual Edition : Linux 3.10.0-862.14.4.el7.ve.x86_64 : BIG-IP software release 15.1.0.5, build 0.51.8

real 0m0.439s user 0m0.411s sys 0m0.026s

   When used to retrieve a vendor specific MIB, it is quite slow, about 10 times slower...

$:~/jm1/python$ time snmpget.py -v 2c -c public 1.2.3.4 F5-BIGIP-SYSTEM-MIB::sysStatClientPktsIn.0 F5-BIGIP-SYSTEM-MIB::sysStatClientPktsIn.0 = Counter64: 162

real 0m5.622s user 0m5.576s sys 0m0.032s

   In both cases, I also get quite a few 'compiler' message lines, and if I don't have ply available the request fails in both cases.   I don't understand why it still wants the compiler?

    I need to load unique MIBS for F5 equipment.  I believe I have compiled them properly using mibdump.py and they are located here:
mibdump.py --rebuild --mib-source /home/oam/jm1/python/f5_mibs F5-BIGIP-COMMON-MIB F5-BIGIP-LOCAL-MIB F5-BIGIP-SYSTEM-MIB

$:~/jm1/python$  find . -name "F5-*.py*" -ls
  2467   76 -rw-------   1 oam      oam         77022 Jan 12 19:30 ./pysnmp/smi/mibs/F5-BIGIP-COMMON-MIB.py
  2471  864 -rw-------   1 oam      oam        881102 Jan 12 19:25 ./pysnmp/smi/mibs/F5-BIGIP-SYSTEM-MIB.py
  2469 1388 -rw-------   1 oam      oam       1418351 Jan 12 19:30 ./pysnmp/smi/mibs/F5-BIGIP-LOCAL-MIB.py
  2472  440 -rw-rw-r--   1 oam      oam        449902 Jan 12 19:25 ./pysnmp/smi/mibs/F5-BIGIP-SYSTEM-MIB.pyc
  2468   36 -rw-rw-r--   1 oam      oam         36575 Jan 12 19:30 ./pysnmp/smi/mibs/F5-BIGIP-COMMON-MIB.pyc
  2470  676 -rw-rw-r--   1 oam      oam        690780 Jan 12 19:30 ./pysnmp/smi/mibs/F5-BIGIP-LOCAL-MIB.pyc
  2474   76 -rw-------   1 oam      oam         77022 Jan 12 19:30 ./f5_py_mibs/F5-BIGIP-COMMON-MIB.py
  2478  864 -rw-------   1 oam      oam        881102 Jan 12 19:25 ./f5_py_mibs/F5-BIGIP-SYSTEM-MIB.py
  2476 1388 -rw-------   1 oam      oam       1418351 Jan 12 19:30 ./f5_py_mibs/F5-BIGIP-LOCAL-MIB.py
  2479  440 -rw-rw-r--   1 oam      oam        449902 Jan 12 19:25 ./f5_py_mibs/F5-BIGIP-SYSTEM-MIB.pyc
  2475   36 -rw-rw-r--   1 oam      oam         36575 Jan 12 19:30 ./f5_py_mibs/F5-BIGIP-COMMON-MIB.pyc
  2477  676 -rw-rw-r--   1 oam      oam        690780 Jan 12 19:30 ./f5_py_mibs/F5-BIGIP-LOCAL-MIB.pyc
  2480   76 -rw-------   1 oam      oam         77022 Jan 12 20:14 ./pysnmp_mibs/F5-BIGIP-COMMON-MIB.py
  2484  864 -rw-------   1 oam      oam        881102 Jan 12 20:14 ./pysnmp_mibs/F5-BIGIP-SYSTEM-MIB.py
  2482 1388 -rw-------   1 oam      oam       1418351 Jan 12 20:14 ./pysnmp_mibs/F5-BIGIP-LOCAL-MIB.py
  2485  440 -rw-rw-r--   1 oam      oam        449902 Jan 12 20:14 ./pysnmp_mibs/F5-BIGIP-SYSTEM-MIB.pyc
  2481   36 -rw-rw-r--   1 oam      oam         36575 Jan 12 20:14 ./pysnmp_mibs/F5-BIGIP-COMMON-MIB.pyc
  2483  676 -rw-rw-r--   1 oam      oam        690780 Jan 12 20:14 ./pysnmp_mibs/F5-BIGIP-LOCAL-MIB.pyc

$:~/jm1/python$ ls -l ~/.pysnmp/mibs
total 3480
-rw------- 1 oam oam   77022 Jan 14 15:37 F5-BIGIP-COMMON-MIB.py
-rw-rw-r-- 1 oam oam   36575 Jan 14 15:37 F5-BIGIP-COMMON-MIB.pyc
-rw------- 1 oam oam 1418351 Jan 14 15:37 F5-BIGIP-LOCAL-MIB.py
-rw-rw-r-- 1 oam oam  690780 Jan 14 15:37 F5-BIGIP-LOCAL-MIB.pyc
-rw------- 1 oam oam  881102 Jan 14 15:37 F5-BIGIP-SYSTEM-MIB.py
-rw-rw-r-- 1 oam oam  449902 Jan 14 15:37 F5-BIGIP-SYSTEM-MIB.pyc
 I feel I'm just missing something obvious!  Thanks for any help.

Best regards!

John

lextm commented 2 months ago

Recent releases have dropped Python 2.x support, so no investigation will be done unless the environment is upgraded to a supported Python version, 3.8+ right now.

Besides, you might read GitHub Markdown guide to learn more about code formatting. The current formatting is problematic and not easy to understand what you wrote.