After updating to PRTG 20.1.55 all my Python Script Advanced sensors are in the Down status. What is causing this issue?
After updating to PRTG 20.1.55, my Python Script Advanced sensors are down
Votes:
0
4 Replies
Votes:
1
This article applies as of PRTG 20.1.55
Python library update and Python Script Advanced sensors
PRTG 20.1.55 includes a new Python distribution because of the end-of-life announcement for Python 3.4. The new Python distribution includes a new prtg library and new cryptography libraries.
New /prtg/ library
We replaced the existing paepy library with the new prtg library. The new property names that were used to create a result set now adhere to the custom advanced sensor nomenclature of PRTG. The new libraries also support the full custom advanced set.
To make sure that your Python Script Advanced sensors continue to work properly, please review the updated Python Script Advanced sensor example and adjust your Python scripts accordingly.
You can find the example sensor_example.py in the \python subfolder of the PRTG program directory under:
%programfiles(x86)%\PRTG Network Monitor\Custom Sensors\python
or
%programfiles%\PRTG Network Monitor\Custom Sensors\python
New cryptography libraries
We also replaced the cryptography libraries. PRTG Python now ships with cryptography and PyCryptodome. This is because the previously used libraries are no longer maintained. In addition, the integrated Python now also ships with pip and setuptools preinstalled. This change eases the integration of other packages.
Most important changes
Old version | New version | |
---|---|---|
Importing pae libs | from paepy.ChannelDefinition import CustomSensorResult | from prtg.sensor.result import CustomSensorResult from prtg.sensor.units import ValueUnit |
Properties for channel definition changed | result.add_channel(channel_name= "Response Time", unit= "TimeResponse", value="4711") | csr.add_channel(name="Response Time", value=4711, unit=ValueUnit.TIMERESPONSE) |
For more information, see the full change log for Python 3.7:
Votes:
0
Hi,
Thanks for the detail in this explanation, I think that will help me. Do you publish the prtg module you use at all? It would be really useful to be able to run the same scripts on my dev machine before trying to run the scripts on the PRTG server.
I can see there is a prtg module published to PyPi for pip installation: https://pypi.org/project/prtg/. However, this module does not support the functionality you outline above.
Cheers, Andy
Votes:
0
Hello,
the two PRTG modules are part of the Python integration in PRTG. In order to import other modules, please open "C:\Program Files (x86)\PRTG Network Monitor\python\Scripts" and run "fix-python-tools.bat".
If the project you linked relies on the old PRTG Python integration, it will however not work.
Votes:
Add comment