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 paepy package and other python packages

Votes:

0

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.

advanced-sensor exe-script-advanced-sensor linux prtg python ssh

Created on Dec 5, 2017 9:30:04 AM



9 Replies

Accepted Answer

Votes:

0

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.

Created on Dec 5, 2017 9:55:25 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

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?

Created on Dec 5, 2017 10:02:05 AM



Votes:

0

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.

Created on Dec 5, 2017 8:25:55 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

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

Created on Dec 7, 2017 10:32:11 AM



Votes:

0

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://kb.paessler.com/en/topic/76570-custom-parameters-in-python-script

Best regards.

Created on Dec 7, 2017 2:45:03 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

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.

Created on Dec 18, 2017 12:41:33 PM

Last change on Dec 18, 2017 2:49:43 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Hi there,

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

host=%host,linuxuser=%linuxuser



Best regards.

Created on Dec 18, 2017 2:50:41 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Thanks!

Created on Dec 19, 2017 5:18:40 PM



Votes:

1

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.

Created on Dec 18, 2018 2:29:36 PM




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.