I keep getting this error when trying to run a XML Custom EXE/Script Sensor:
"XML: The returned XML file does not match the expected schema. (code: PE233) -- JSON: The returned JSON file does not match the expected structure (Invalid JSON.). (code: PE231)"
My Script :
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser $exp_last_replication_file = Get-ChildItem '\\TEST\c$\TEST\REPLICATION_LOG' | Where {$_.LastWriteTime} | select -last 1 $exp_last_replication_file_name= $exp_last_replication_file.Name $exp_last_replication_file_name_noext = $exp_last_replication_file_name.split(".")[0] $exp_last_replication_date = $exp_last_replication_file_name_noext.split("_")[0] $exp_last_replication_hour = $exp_last_replication_file_name_noext.split("_")[1] $exp_last_replication_status = $exp_last_replication_file_name_noext.split("_")[2] $exp_last_replication_diff = [System.Math]::Round(((Get-Date) - ($exp_last_replication_file.LastWriteTime)).TotalMinutes, 0) if($exp_last_replication_status -eq "OK"){$ext_last_replication_status_nb = 0} else{$ext_last_replication_status_nb = 1} $imp_last_replication_file = Get-ChildItem '\\TEST-BACKUP\c$\TEST\REPLICATION_LOG' | Where {$_.LastWriteTime} | select -last 1 $imp_last_replication_file_name= $imp_last_replication_file.Name $imp_last_replication_file_name_noext = $imp_last_replication_file_name.split(".")[0] $imp_last_replication_date = $imp_last_replication_file_name_noext.split("_")[0] $imp_last_replication_hour = $imp_last_replication_file_name_noext.split("_")[1] $imp_last_replication_status = $imp_last_replication_file_name_noext.split("_")[2] $imp_last_replication_diff = [System.Math]::Round(((Get-Date) - ($imp_last_replication_file.LastWriteTime)).TotalMinutes, 0) if($imp_last_replication_status -eq "OK"){$imp_last_replication_status_nb = 0} else{$imp_last_replication_status_nb = 1} Write-Host "<?xml version=`"1.0' encoding=`'Windows-1252' ?><prtg><result><channel>1. TEST Replication Error - Export</channel><value>$ext_last_replication_status_nb</value></result><result><channel>2. FR-IOPS Last time Replication - Export</channel><value>$exp_last_replication_diff</value></result><result><channel>3. TEST Replication Error - Import</channel><value>$imp_last_replication_status_nb</value></result><result><channel>4. TEST Last time Replication - Import</channel><value>$imp_last_replication_diff</value></result><text>TEST Replication check sensor</text></prtg>"
Add comment