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

Python sqlite code prtg




What is the problem with following code?

import sqlite3
import json

def sl():
    conn = sqlite3.connect('cidb.db')
    cur = conn.cursor()
    cur.execute("SELECT cisdb FROM sw1;")
    one_result = cur.fetchone()
    st = int(one_result[0])
    return st
cis = sl()

channel = {}
channel["prtg"] = {"result":[{"channel" : "Status","value" : cis }]}
XML: Structural error in xml file, 1 open items. -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231)

json prtg python sensor

Created on Jan 3, 2023 8:57:09 PM

Last change on Jan 4, 2023 5:32:01 AM by  Sven Roggenhofer [Paessler Technical Support]

2 Replies

Accepted Answer




For analysis, please open the sensor's "Settings" tab and enable the "Store Result" option.

After the next sensor scan, the result logs are written to "C:\ProgramData\Paessler\PRTG Network Monitor\Logs\sensors" on the respective probe. One of the files contains the JSON written by the sensor. Probably there is an error when the script runs, preventing the full JSON being written.

Created on Jan 4, 2023 1:51:33 PM by  Arne Seifert [Paessler Support]



Hello, I realised my mistake, I should have write the db files full path Thanks

Created on Jan 4, 2023 9:00:59 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.