Please try to fill out as much of the information below as you can. Thank you!
Which version contains the bug?
1.2.0
Describe the bug
Hello :)
After upgrading to Ubuntu 24.04 which comes with python3.12 the script stopped working.
First error message was
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pysnmp/smi/builder.py", line 18, in PY_MAGIC_NUMBER = importlib.util.MAGIC_NUMBER ^^^^^^^^^^^^^^ AttributeError: module 'importlib' has no attribute 'util' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pysnmp/smi/builder.py", line 23, in raise ImportError() ImportError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/nagios/plugins/check_hwgroup.py", line 25, in from pysnmp.entity.rfc3413.oneliner import cmdgen File "/usr/lib/python3/dist-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 10, in from pysnmp.hlapi.asyncore import * File "/usr/lib/python3/dist-packages/pysnmp/hlapi/init.py", line 9, in from pysnmp.smi.rfc1902 import * File "/usr/lib/python3/dist-packages/pysnmp/smi/rfc1902.py", line 10, in from pysnmp.smi.builder import ZipMibSource File "/usr/lib/python3/dist-packages/pysnmp/smi/builder.py", line 26, in import imp ModuleNotFoundError: No module named 'imp'
I then created a venv and installed the requirements and pysnmp in the most recent version
/opt/check_hwgroup# ./bin/pip freeze
certifi==2026.5.20
charset-normalizer==3.4.7
idna==3.17
nagiosplugin==1.3.3
ply==3.11
pyasn1==0.6.3
pyasyncore==1.0.4
pycryptodomex==3.23.0
pysnmp==7.1.27
pysnmp-pyasn1==1.1.3
pysnmp-pysmi==1.1.12
pysnmplib==5.0.24
requests==2.34.2
urllib3==2.7.0
This makes the script return
Error: Please call .create() to construct UdpTransportTarget object
I then tried downgrading pysnmp to a version < 5
# ./bin/pip install "pysnmp<5"
Collecting pysnmp<5
Downloading pysnmp-4.4.12-py2.py3-none-any.whl.metadata (1.8 kB)
Collecting pysmi (from pysnmp<5)
Downloading pysmi-2.0.0-py3-none-any.whl.metadata (3.9 kB)
Requirement already satisfied: pycryptodomex in ./lib/python3.12/site-packages (from pysnmp<5) (3.23.0)
Requirement already satisfied: pyasn1>=0.2.3 in ./lib/python3.12/site-packages (from pysnmp<5) (0.6.3)
Collecting Jinja2>=3.1.3 (from pysmi->pysnmp<5)
Downloading jinja2-3.1.6-py3-none-any.whl.metadata (2.9 kB)
Collecting lark>=1.1.9 (from pysmi->pysnmp<5)
Downloading lark-1.3.1-py3-none-any.whl.metadata (1.8 kB)
Requirement already satisfied: requests>=2.26.0 in ./lib/python3.12/site-packages (from pysmi->pysnmp<5) (2.34.2)
Collecting MarkupSafe>=2.0 (from Jinja2>=3.1.3->pysmi->pysnmp<5)
Downloading markupsafe-3.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (2.7 kB)
Requirement already satisfied: charset_normalizer<4,>=2 in ./lib/python3.12/site-packages (from requests>=2.26.0->pysmi->pysnmp<5) (3.4.7)
Requirement already satisfied: idna<4,>=2.5 in ./lib/python3.12/site-packages (from requests>=2.26.0->pysmi->pysnmp<5) (3.17)
Requirement already satisfied: urllib3<3,>=1.26 in ./lib/python3.12/site-packages (from requests>=2.26.0->pysmi->pysnmp<5) (2.7.0)
Requirement already satisfied: certifi>=2023.5.7 in ./lib/python3.12/site-packages (from requests>=2.26.0->pysmi->pysnmp<5) (2026.5.20)
Downloading pysnmp-4.4.12-py2.py3-none-any.whl (296 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 296.5/296.5 kB 816.1 kB/s eta 0:00:00
Downloading pysmi-2.0.0-py3-none-any.whl (87 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.2/87.2 kB 954.2 kB/s eta 0:00:00
Downloading jinja2-3.1.6-py3-none-any.whl (134 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.9/134.9 kB 2.1 MB/s eta 0:00:00
Downloading lark-1.3.1-py3-none-any.whl (113 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 113.2/113.2 kB 1.6 MB/s eta 0:00:00
Downloading markupsafe-3.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (22 kB)
Installing collected packages: MarkupSafe, lark, Jinja2, pysmi, pysnmp
Attempting uninstall: pysnmp
Found existing installation: pysnmp 7.1.27
Uninstalling pysnmp-7.1.27:
Successfully uninstalled pysnmp-7.1.27
Successfully installed Jinja2-3.1.6 MarkupSafe-3.0.3 lark-1.3.1 pysmi-2.0.0 pysnmp-4.4.12
root@icinga2-ihk-si:/opt/check_hwgroup# ./bin/pip install "pysnmp"
Requirement already satisfied: pysnmp in ./lib/python3.12/site-packages (4.4.12)
Requirement already satisfied: pysmi in ./lib/python3.12/site-packages (from pysnmp) (2.0.0)
Requirement already satisfied: pycryptodomex in ./lib/python3.12/site-packages (from pysnmp) (3.23.0)
Requirement already satisfied: pyasn1>=0.2.3 in ./lib/python3.12/site-packages (from pysnmp) (0.6.3)
Requirement already satisfied: Jinja2>=3.1.3 in ./lib/python3.12/site-packages (from pysmi->pysnmp) (3.1.6)
Requirement already satisfied: lark>=1.1.9 in ./lib/python3.12/site-packages (from pysmi->pysnmp) (1.3.1)
Requirement already satisfied: requests>=2.26.0 in ./lib/python3.12/site-packages (from pysmi->pysnmp) (2.34.2)
Requirement already satisfied: MarkupSafe>=2.0 in ./lib/python3.12/site-packages (from Jinja2>=3.1.3->pysmi->pysnmp) (3.0.3)
Requirement already satisfied: charset_normalizer<4,>=2 in ./lib/python3.12/site-packages (from requests>=2.26.0->pysmi->pysnmp) (3.4.7)
Requirement already satisfied: idna<4,>=2.5 in ./lib/python3.12/site-packages (from requests>=2.26.0->pysmi->pysnmp) (3.17)
Requirement already satisfied: urllib3<3,>=1.26 in ./lib/python3.12/site-packages (from requests>=2.26.0->pysmi->pysnmp) (2.7.0)
Requirement already satisfied: certifi>=2023.5.7 in ./lib/python3.12/site-packages (from requests>=2.26.0->pysmi->pysnmp) (2026.5.20)
root@icinga2-ihk-si:/opt/check_hwgroup# ./bin/pip freeze
certifi==2026.5.20
charset-normalizer==3.4.7
idna==3.17
Jinja2==3.1.6
lark==1.3.1
MarkupSafe==3.0.3
nagiosplugin==1.3.3
ply==3.11
pyasn1==0.6.3
pyasyncore==1.0.4
pycryptodomex==3.23.0
pysmi==2.0.0
pysnmp==4.4.12
pysnmp-pyasn1==1.1.3
pysnmp-pysmi==1.1.12
pysnmplib==5.0.24
requests==2.34.2
urllib3==2.7.0
but this leads to the same traceback like the first one.
Doing a upgrade of all required modules ./bin/pip install nagiosplugin pysnmplib pyasyncore --upgrade produces
Traceback (most recent call last): File "/usr/lib/nagios/plugins/check_hwgroup.py", line 25, in from
pysnmp.entity.rfc3413.oneliner import cmdgen ModuleNotFoundError: No module named 'pysnmp.entity.rfc3413.oneliner'
And changeing that line to import cmdgen only and installing the cmdgen module doesn't work either, the traceback remains
Traceback (most recent call last): File "/usr/lib/nagios/plugins/check_hwgroup.py", line 26, in import cmdgen ModuleNotFoundError: No module named 'cmdgen'
Could you have a look at it?
How to recreate the bug?
Upgrade from Ubuntu 22.04 to Ubuntu 24.04.
Please try to fill out as much of the information below as you can. Thank you!
Which version contains the bug?
1.2.0
Describe the bug
Hello :)
After upgrading to Ubuntu 24.04 which comes with python3.12 the script stopped working.
First error message was
I then created a venv and installed the requirements and
pysnmpin the most recent versionThis makes the script return
I then tried downgrading pysnmp to a version < 5
but this leads to the same traceback like the first one.
Doing a upgrade of all required modules
./bin/pip install nagiosplugin pysnmplib pyasyncore --upgradeproducesAnd changeing that line to
import cmdgenonly and installing thecmdgenmodule doesn't work either, the traceback remainsCould you have a look at it?
How to recreate the bug?
Upgrade from Ubuntu 22.04 to Ubuntu 24.04.