Hello,

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 }]}
print(json.dumps(channel))
XML: Structural error in xml file, 1 open items. -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231)

Article Comments

Attention: This article is a record of a conversation with the Paessler support team. The information in this conversation is not updated to preserve the historical record. As a result, some of the information or recommendations in this conversation might be out of date.

Hello,

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.


Jan, 2023 - Permalink

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


Jan, 2023 - Permalink