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!
Article Comments
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
Jun, 2020 - Permalink
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.
Jun, 2020 - Permalink