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

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