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 Library Documentation?

Votes:

1

Hi,

I've successfully created a test Python script for PRTG however I faced a few problems along the way. The documentation in the KB (https://www.paessler.com/manuals/prtg/custom_sensors) seems to be focused on everything other than Python.

Specifically, I'm looking for information about the functions in the PRTG Python library. The example script located within the PRTG installation imports two functions (prtg.sensor.result.CustomSensorResult and prtg.sensor.units.ValueUnit) but are there more? Does documentation exist for the two functions mentioned?

Using CustomSensorResult.add_primary_channel(), I wanted to define a "CustomUnit" but I don't know the syntax. The KB article linked above lists the XML equivalent but nothing for Python.

Any help would be greatly appreciated.

Thanks!

custom-sensor python python-script-advanced-sensor

Created on Jun 5, 2020 8:49:05 AM



Best Answer

Accepted Answer

Votes:

2

Hi,

I did some digging and found documentation exists within the PRTG .py files in the installation directory: %Program Files (x86)%\PRTG Network Monitor\python\Lib\site-packages\prtg

To answer my specific question regarding CustomUnits, I found this: @param unit: The sensor value's unit. If the unit is not a known PRTG unit, the unit is set to CUSTOM and the custom unit is set to the string in unit. Default is CUSTOM with custom unit set to '#'. @type unit: ValueUnit or str I also realised after posting, the value of "unit" is only read on the first scan. I was able to define the value in the PRTG management interface afterwards.

Thanks

Created on Jun 8, 2020 6:23:33 AM



2 Replies

Votes:

0

Hi there,

we have no documentation from more functions build in our Python library. However, we have an guide how to import modules in python scripts which will access you to write modules or import existing one to receive more function.

Created on Jun 8, 2020 6:01:46 AM by  Moritz Heller [Paessler Support]



Accepted Answer

Votes:

2

Hi,

I did some digging and found documentation exists within the PRTG .py files in the installation directory: %Program Files (x86)%\PRTG Network Monitor\python\Lib\site-packages\prtg

To answer my specific question regarding CustomUnits, I found this: @param unit: The sensor value's unit. If the unit is not a known PRTG unit, the unit is set to CUSTOM and the custom unit is set to the string in unit. Default is CUSTOM with custom unit set to '#'. @type unit: ValueUnit or str I also realised after posting, the value of "unit" is only read on the first scan. I was able to define the value in the PRTG management interface afterwards.

Thanks

Created on Jun 8, 2020 6:23:33 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.