New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Custom Parameters in Python Script

Votes:

0

Your Vote:

Up

Down

Hello,

I'm currently evaluating PRTG and I started writing some Python scripts for scanning Log-Files.

It basically worked, but i want to enter an Addiotional Parameter in the Sensor's Settings:

LogFilePath='C:/Temp/'

which i want to use in Python via

data = json.loads(sys.argv[1]) path = data['LogFilePath']

I'm rather new to python, coming from .net/ WPF and I believe I'm somehow wrong with the syntax.

I would truely appreciate a hint in the right direction.

Thanks! Nikolaus

custom-sensor parameters python

Created on Nov 8, 2017 4:59:05 PM by  nikolaus80 (0) 1



2 Replies

Accepted Answer

Votes:

0

Your Vote:

Up

Down

Hi there,

The Python parameters are passed to the script via the "params"-Parameter. This will look like this:

Data['params'].asString := 'myParam=myValue’;

To split them into an array you can use the following sample code:

data = json.loads(sys.argv[1])
prtg_perams = data['params’]

perams = dict(x.split('=') for x in prtg_perams.split(','))

The parameters will be available in the "prtg_perams"-array.

Best regards.

Created on Nov 9, 2017 3:02:56 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thank You!

Created on Nov 10, 2017 3:40:17 PM by  nikolaus80 (0) 1



Please log in or register to enter your reply.


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.