We use Paessler’s “PRTG” monitoring and reporting software for keeping tabs on everything here.
We’ve increasingly started writing scripts in Python to serve as “sensors”, feeding data into PRTG, but we’ve hit a couple of road-blocks on the way.
ModuleNotFoundError: No module named ‘requests’
If you encounter this error, or any similar ones reporting “no module named…”, the fix is simple:
- First it’s critical that you’re logged in as THE Windows “Administrator”. Logging in as a user who’s a member of the Administrator’s group is insufficient:
- Change directory to where python.exe lives:
CD "C:\Program Files (x86)\PRTG Network Monitor\python\"
- Install the required module. In this example it's 'requests':
.\python.exe -m pip install requests
That should be all you need ... with one more potential pitfall: PRTG needs to be running on a release later than 220.127.116.114:
PRTG Version 18.104.22.1684 broke compatibility with pip.exe install (to install Python packages). With this PRTG release we have removed support for this command to prevent unexpected errors. As of now the only supported way of installing a Python package to use Python Script Advanced sensor is python.exe -m pip install. Please also see our Knowledge Base article for more information about Python installation: https://kb.paessler.com/en/topic/90686.
References / Credits
5th November 2022. This is the initial publication.