What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

PRTG python sensor "No module named 'requests'

Votes:

0

I get the following error when executing a python advanced sensor

06/03/2020 10:00:56 Script Output (UTF8 Encoding): Traceback (most recent call last):[CR][LF]  File "C:\Program Files (x86)\PRTG Network Monitor\custom sensors\python\HourLongRunningThreads.py", line 7, in <module>[CR][LF]    from requests import Session[CR][LF]ImportError: No module named 'requests'[CR][LF]

Is there a way to just print the desired json isntead of using the paepy module to create it? I just need a simple channel that returns 1 value

prtg version 19.2.50.2842+ python 3.7

python python-script-advanced-sensor script

Created on Mar 6, 2020 10:54:29 AM

Last change on Mar 6, 2020 4:29:34 PM by  Birk Guttmann [Paessler Support]



Best Answer

Accepted Answer

Votes:

0

Hello there.

As of PRTG version 22.1.74 it is possible to install/add modules to PRTG's python. If my script needs the requests module for example, I can do so by heading to C:\Program Files (x86)\PRTG Network Monitor\python\ (PRTG's install path) and issuing:

python.exe -m pip install requests

Afterwards requests can be used in scripts. This has to be done on a per-probe basis.

Best regards,
Luciano Lingnau, Paessler Team

Created on Feb 23, 2022 8:40:39 AM by  Luciano Lingnau [Paessler]

Last change on Feb 23, 2022 9:16:06 AM by  Luciano Lingnau [Paessler]



3 Replies

Votes:

0

I was able to download the requests module but my script needs a module that's not in python 3.4 so I created a batch script that reads the output of the python script instead.

Created on Mar 9, 2020 3:08:23 PM



Accepted Answer

Votes:

0

Hello there.

As of PRTG version 22.1.74 it is possible to install/add modules to PRTG's python. If my script needs the requests module for example, I can do so by heading to C:\Program Files (x86)\PRTG Network Monitor\python\ (PRTG's install path) and issuing:

python.exe -m pip install requests

Afterwards requests can be used in scripts. This has to be done on a per-probe basis.

Best regards,
Luciano Lingnau, Paessler Team

Created on Feb 23, 2022 8:40:39 AM by  Luciano Lingnau [Paessler]

Last change on Feb 23, 2022 9:16:06 AM by  Luciano Lingnau [Paessler]



Votes:

0

For the benefit of anyone who finds this thread in future, be aware that you need to be logged into Windows as THE "Administrator" account to install the required modules. Being logged in as AN administrator is insufficient.

Oh, and you also need to be on a release later than 22.2.77.2204:

PRTG Version 22.2.77.2204 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.


- Greig.

Created on Sep 6, 2022 5:14:29 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.