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

Custom Sensor Python Advanced

Votes:

0

Hi friends.

I'm trying to create a Custom Sensor Python but, everytime that I edit the default script structure, I got a ERROR:

XML: Structural error in xml file, 1 open items. -- JSON: O JSON retornado não corresponde à estrutura esperada (Invalid JSON.). (código: PE231

What am I doing wrong?

Here my script:

  1. -*- coding: utf-8 -*-

import sys import json from paepy.ChannelDefinition import CustomSensorResult

error = 0 log_bkp_pi = open('

SAP-PI-APP01
Sybase
bin
falha_dbfull.log', 'r').read()

def test(): if "1" in log_bkp_pi: error = 1 return error else: error = 2 return error

result = CustomSensorResult("OK")

result.add_channel(channel_name="Backup FULL", unit="Count", value=test(), is_float=False, primary_channel=True, is_limit_mode=True, limit_max_error=2, limit_error_msg="Backup Fail")

print(result.get_json_result())

Details: Line- log_bkp_pi = open('

SAP-PI-APP01
Sybase
bin
falha_dbfull.log', 'r').read() This line I'm reading a log backup that contains 1 or 0.

Could you help me whit this problem?

custom custom-sensor prtg python

Created on Jan 16, 2017 7:35:07 PM



1 Reply

Votes:

0

Please enable write result to disk within the sensor settings and open up a new ticket with
Tech Support. Don't forget to attach the log files, they're located under: C:\Program Data\Paessler\PRTG Network Monitor\Logs (Sensors)

Created on Jan 17, 2017 1:29:37 PM by  Stephan Linke [Paessler Support]

Last change on Jan 17, 2017 1:29:57 PM by  Stephan Linke [Paessler Support]




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.