Anyone can tell me why this json does not get recognized as valid?
Last mgs:
lastmsg":"#Y2 @#O233 @#O231[Invalid JSON.]
Full sensor log:
3/23/2023 3:28:08 PM Script File: huawei_backup_power.py 3/23/2023 3:28:08 PM Script Parameters: {"tlsexplicit_pop3":"","fastcount":"0","esxpassword":"","hostv6":"","blockedsens":"","secretaccesskeyid":"","tlsexplicit_default":"","isexesensor":"0","scriptplaceholder3":"","windowsloginpassword":"","privatekey":"","secret":"","resttoken":"","reboot":"45007.6443106829","pop3password":"","pythonscript":"huawei_backup_power.py","scriptplaceholder1":"","tlsexplicit_port":"","inerror":"1","scriptplaceholder4":"","smspassword":"","params":"","host":"*****","mailpassword":"","tlsexplicit_ftp":"","timeout":"59","elevationpass":"","momopersistent":"","notonpod":"0","linuxloginpassword":"","smtppassword2":"","smtppassword":"","lastuptime":"0","writeresult":"1","socksproxypass":"","prtg_linuxpassword":"","tlsexplicit_imap":"","sshelevationpass":"","uptimecount":"0","canlinux":"0","proxypassword":"","proxypass":"","mutexname":"","snmpencpass":"","authuserpwd":"","scriptplaceholder5":"","usednstime":"0","restpassword":"","httppassword":"","addomainpass":"","authtoken":"","oauthrefreshtoken":"","evapassword":"","oauthtoken":"","snmpcommv1":"","sensorid":"35509","ipversion":"0","xmlhttppassword":"","tlsexplicit_smtp":"","scriptplaceholder2":"","password":"","snmpcommv2":"","snmpauthpass":"","awssk":"","dbpassword":"","pingdompassword":"","usewindowsauthentication":"0","prtg_windowspassword":"","simulate":"0","lastmsg":"#Y2 @#O233 @#O231[Invalid JSON.]","imappassword":"","ftppassword":""} 3/23/2023 3:28:08 PM Script Parameters (escaped): {\"tlsexplicit_pop3\":\"\",\"fastcount\":\"0\",\"esxpassword\":\"\",\"hostv6\":\"\",\"blockedsens\":\"\",\"secretaccesskeyid\":\"\",\"tlsexplicit_default\":\"\",\"isexesensor\":\"0\",\"scriptplaceholder3\":\"\",\"windowsloginpassword\":\"\",\"privatekey\":\"\",\"secret\":\"\",\"resttoken\":\"\",\"reboot\":\"45007.6443106829\",\"pop3password\":\"\",\"pythonscript\":\"huawei_backup_power.py\",\"scriptplaceholder1\":\"\",\"tlsexplicit_port\":\"\",\"inerror\":\"1\",\"scriptplaceholder4\":\"\",\"smspassword\":\"\",\"params\":\"\",\"host\":\"*****\",\"mailpassword\":\"\",\"tlsexplicit_ftp\":\"\",\"timeout\":\"59\",\"elevationpass\":\"\",\"momopersistent\":\"\",\"notonpod\":\"0\",\"linuxloginpassword\":\"\",\"smtppassword2\":\"\",\"smtppassword\":\"\",\"lastuptime\":\"0\",\"writeresult\":\"1\",\"socksproxypass\":\"\",\"prtg_linuxpassword\":\"\",\"tlsexplicit_imap\":\"\",\"sshelevationpass\":\"\",\"uptimecount\":\"0\",\"canlinux\":\"0\",\"proxypassword\":\"\",\"proxypass\":\"\",\"mutexname\":\"\",\"snmpencpass\":\"\",\"authuserpwd\":\"\",\"scriptplaceholder5\":\"\",\"usednstime\":\"0\",\"restpassword\":\"\",\"httppassword\":\"\",\"addomainpass\":\"\",\"authtoken\":\"\",\"oauthrefreshtoken\":\"\",\"evapassword\":\"\",\"oauthtoken\":\"\",\"snmpcommv1\":\"\",\"sensorid\":\"35509\",\"ipversion\":\"0\",\"xmlhttppassword\":\"\",\"tlsexplicit_smtp\":\"\",\"scriptplaceholder2\":\"\",\"password\":\"\",\"snmpcommv2\":\"\",\"snmpauthpass\":\"\",\"awssk\":\"\",\"dbpassword\":\"\",\"pingdompassword\":\"\",\"usewindowsauthentication\":\"0\",\"prtg_windowspassword\":\"\",\"simulate\":\"0\",\"lastmsg\":\"#Y2 @#O233 @#O231[Invalid JSON.]\",\"imappassword\":\"\",\"ftppassword\":\"\"} 3/23/2023 3:28:08 PM Script Path: C:\Program Files (x86)\PRTG Network Monitor\custom sensors\python\huawei_backup_power.py 3/23/2023 3:28:08 PM Command Line: "C:\Program Files (x86)\PRTG Network Monitor\python\python.exe" -E "C:\Program Files (x86)\PRTG Network Monitor\custom sensors\python\huawei_backup_power.py" "{\"tlsexplicit_pop3\":\"\",\"fastcount\":\"0\",\"esxpassword\":\"\",\"hostv6\":\"\",\"blockedsens\":\"\",\"secretaccesskeyid\":\"\",\"tlsexplicit_default\":\"\",\"isexesensor\":\"0\",\"scriptplaceholder3\":\"\",\"windowsloginpassword\":\"\",\"privatekey\":\"\",\"secret\":\"\",\"resttoken\":\"\",\"reboot\":\"45007.6443106829\",\"pop3password\":\"\",\"pythonscript\":\"huawei_backup_power.py\",\"scriptplaceholder1\":\"\",\"tlsexplicit_port\":\"\",\"inerror\":\"1\",\"scriptplaceholder4\":\"\",\"smspassword\":\"\",\"params\":\"\",\"host\":\"****\",\"mailpassword\":\"\",\"tlsexplicit_ftp\":\"\",\"timeout\":\"59\",\"elevationpass\":\"\",\"momopersistent\":\"\",\"notonpod\":\"0\",\"linuxloginpassword\":\"\",\"smtppassword2\":\"\",\"smtppassword\":\"\",\"lastuptime\":\"0\",\"writeresult\":\"1\",\"socksproxypass\":\"\",\"prtg_linuxpassword\":\"\",\"tlsexplicit_imap\":\"\",\"sshelevationpass\":\"\",\"uptimecount\":\"0\",\"canlinux\":\"0\",\"proxypassword\":\"\",\"proxypass\":\"\",\"mutexname\":\"\",\"snmpencpass\":\"\",\"authuserpwd\":\"\",\"scriptplaceholder5\":\"\",\"usednstime\":\"0\",\"restpassword\":\"\",\"httppassword\":\"\",\"addomainpass\":\"\",\"authtoken\":\"\",\"oauthrefreshtoken\":\"\",\"evapassword\":\"\",\"oauthtoken\":\"\",\"snmpcommv1\":\"\",\"sensorid\":\"35509\",\"ipversion\":\"0\",\"xmlhttppassword\":\"\",\"tlsexplicit_smtp\":\"\",\"scriptplaceholder2\":\"\",\"password\":\"\",\"snmpcommv2\":\"\",\"snmpauthpass\":\"\",\"awssk\":\"\",\"dbpassword\":\"\",\"pingdompassword\":\"\",\"usewindowsauthentication\":\"0\",\"prtg_windowspassword\":\"\",\"simulate\":\"0\",\"lastmsg\":\"#Y2 @#O233 @#O231[Invalid JSON.]\",\"imappassword\":\"\",\"ftppassword\":\"\"}" 3/23/2023 3:28:08 PM Script Output (OEMCP Encoding): {'prtg': {'result': [{'Channel': 'Controller A', 'ValueLookup': 'oid.huawei-dorado-500-api.bbu.healthstatus', 'Value': '1'}, {'Channel': 'Controller B', 'ValueLookup': 'oid.huawei-dorado-500-api.bbu.healthstatus', 'Value': '1'}], 'text': 'Everything is ok'}}[CR][LF] 3/23/2023 3:28:08 PM Exit Code: 0 3/23/2023 3:28:08 PM RawStream Size: 260 3/23/2023 3:28:08 PM OutputStream Size: 260 3/23/2023 3:28:08 PM Script Output (UTF8 Encoding): {'prtg': {'result': [{'Channel': 'Controller A', 'ValueLookup': 'oid.huawei-dorado-500-api.bbu.healthstatus', 'Value': '1'}, {'Channel': 'Controller B', 'ValueLookup': 'oid.huawei-dorado-500-api.bbu.healthstatus', 'Value': '1'}], 'text': 'Everything is ok'}}[CR][LF]
Just the json output:
3/23/2023 3:28:08 PM Script Output (OEMCP Encoding): {'prtg': {'result': [{'Channel': 'Controller A', 'ValueLookup': 'oid.huawei-dorado-500-api.bbu.healthstatus', 'Value': '1'}, {'Channel': 'Controller B', 'ValueLookup': 'oid.huawei-dorado-500-api.bbu.healthstatus', 'Value': '1'}], 'text': 'Everything is ok'}}[CR][LF]
3/23/2023 3:28:08 PM Exit Code: 0
3/23/2023 3:28:08 PM RawStream Size: 260
3/23/2023 3:28:08 PM OutputStream Size: 260
3/23/2023 3:28:08 PM Script Output (UTF8 Encoding): {'prtg': {'result': [{'Channel': 'Controller A', 'ValueLookup': 'oid.huawei-dorado-500-api.bbu.healthstatus', 'Value': '1'}, {'Channel': 'Controller B', 'ValueLookup': 'oid.huawei-dorado-500-api.bbu.healthstatus', 'Value': '1'}], 'text': 'Everything is ok'}}[CR][LF]
Lookup file:
<xml version="1.0" encoding="UTF-8"?> <ValueLookup id="oid.huawei-dorado-500-api.bbu.healthstatus" desiredValue="1" undefinedState="olsWarning"> <Lookups> <SingleInt state="Unknown" value="0"> Unknown </SingleInt> <SingleInt state="Ok" value="1"> Normal </SingleInt> <SingleInt state="Error" value="2"> Faulty </SingleInt> <SingleInt state="Warning" value="3"> About to fail </SingleInt> <SingleInt state="Warning" value="12"> Low battery </SingleInt> </Lookups> </ValueLookup>
Add comment