Hi to all!

How i can use the paepy package found on the sensor_exaple.py in my python script to return a json?, or i can build a XML on my script and send that to the PRTG.

I use lxml package to build the XML so i need to know if it's possible to install any packages for the python on the prtg server and the paramiko package to open a remote SSH conection to the host to execute a linux command.

I don't now either if the paepy can do all this work by itself.


Article Comments

Hi there,

PRTG uses its own Python runtime ("C:\Program Files (x86)\PRTG Network Monitor\Python34"). Please make sure that you add all needed modules in the appropriate subfolder ("..\Python34\Lib\site-packages\") in order to enable PRTG to load them. Paepy is only used to create readable JSON Output for PRTG but it can not create/initiate SSH Connections.

Best regards.


Dec, 2017 - Permalink

Hi Dariusz,

Wasn't expecting such a quick reply. Thanks for that, so can i install the paepy package in my local machine to create the json output? o i can stick with my XML output and prtg will read it?


Dec, 2017 - Permalink

Hi there,

We do our best to answer as fast as possible, but thanks for the appreciation. :)

It hardly depends on your preferences and what is better readable/writable for you. If you prefer XML, then stick to XML. You can find the correct syntax for both in your webinterface under "Setup > PRTG API > Custom Sensors".

Best regards.


Dec, 2017 - Permalink

Thanks i think will stick to the XML output. As you say paepy only is used to create a readable json output, but how can you 'send' the PRTG device info and credentials to the python script to create a ssh connection to the device. if you can throw some light at me i'll appreciate that. I see the

Setup > PRTG API > Custom Sensors > COMMAND LINE PARAMETERS but can i add that to my python script and will work? or i need a specific package


Dec, 2017 - Permalink

Hi there,

This is possible by adding the "Python Script" Sensor within PRTG and filling the parameters field. Afterwards you have to parse the parameters within the script as explained on the following site:
https://helpdesk.paessler.com/en/support/solutions/articles/76570-custom-parameters-in-python-script

Best regards.


Dec, 2017 - Permalink

Hi Dariusz,

Thanks, im new to all this. So to send the %host %linuxuser and %linuxpassword i just need to write them in the additional parameters field and thats enough?

then add to my script the:

Data['params'].asString := 'host=%host'
data = json.loads(sys.argv[1])
prtg_perams = data['params']

If you can help me will be appreciated.


Dec, 2017 - Permalink

Hi there,

Almost. :)
You have to divide the parameters by a comma:

host=%host,linuxuser=%linuxuser



Best regards.


Dec, 2017 - Permalink

Thanks!


Dec, 2017 - Permalink

So my take is that if you have any requirement to do more than the most basic Python script, you probably need to use your own python environment. Python 3.4 is quite out of date now ( we are at 3.7 today ) and the requirement to manually place your modules into a specific folder is quite out of sync with standard modern procedures for package management.

The best thing IMO is to take the single paepy module from the Paessler 34 environment and place that into your standard python environment. Sensor scripts will have to be created as a general EXE rather than a PYTHON sensor but there will be complete freedom to leverage the latest python version, modules and packaging tools.


Dec, 2018 - Permalink