Go to All Forums

Custom Powershell plugin will not register : connection could not be established

Hi all

I've recently tried to create my first customer plugin using a Powershell script. However, I just cannot get the plugin to register.

The PluginRegisterLog.log file shows the plugin being picked up and displays the JSON output from the script OK. The next statement in the log file is :

"04/11/2016 09:49:52  Script output for SyncVehicleData is {"message":"Connection could not be established","availability":"0","data":{}}"

A colleague has created 2 very similar plugins which have registered OK and work within Site24x7 without issue. My plugin is almost a carbon copy of the others - just different data returned.

I logged a support ticket last week (##258260##) but the only response I've had so far is "I have forwarded yo request to my developmenet team, will get back to you with an update shortly" on 25/10.

The JSON output is

04/11/2016 09:49:52   Script Output  {"version" : "1" , "data" : {"CheckDescription":Intranet to Web - Vehicles,"BacklogInMinutes":0,"TotalBacklogItems":0}, "heartbeat" : "True", "displayname" :
"Sync Check (Vehicle Data)"}

Does any one have any idea what the error message means : "Connection could not be established". Connection to what? I'd be grateful for any tips.

Thanks

Sonja

Like (1) Reply
Replies (4)

Hi Sonja,

Sorry for the inconvenience caused. From the script output, we found that the JSON is invalid, wherein the double quotes is missing for the string value "Intranet to Web - Vehicles". 

Please add double quotes for the string values in the script and execute it locally. Check if the script output has a valid JSON format using https://www.site24x7.com/tools/json-formatter.html. Once that is done, restart the Site24x7PluginAgent service from services.msc. This will register the plugin and collect data.


We have handled these types of errors in the latest version of the agent. Please upgrade to the latest version.
Like (0) Reply

Thanks so much for the reply, Muralikrishnan.

I added double quotes as suggested and the JSON is now valid (). However, I still get the same error message, even after restarting the Plugin Agent. Please find below the log file output from the point of restarting the agent.

As you can see, I still get the message 'Connection could not be established'. Any further tips would be appreciated - thanks!


08/11/2016 09:07:25 PLUGIN REGISTER LOGGING STOPED

08/11/2016 09:07:25  DataCollection RegisterPlugin ......System.Threading.ThreadAbortException: Thread was being aborted.
   at System.Threading.Thread.SleepInternal(Int32 millisecondsTimeout)
   at Site24x7PluginAgent.DataCollection.RegisterPlugin()

08/11/2016 09:07:27 PLUGIN REGISTER LOGGING STARTED

08/11/2016 09:07:27  GetPlugiDetailsElement Monitor Name:SyncVehicleData
08/11/2016 09:07:27  status:2
08/11/2016 09:07:27  GetPlugiDetailsElement Monitor Name:SyncVehicleData
08/11/2016 09:07:27  status:2

08/11/2016 09:07:27 Register Plugin SyncVehicleData

08/11/2016 09:07:27   Script Output  {"version" : "1" , "data" : {"CheckDescription":"Intranet to Web - Vehicles","O
ldestEvent":2016-11-08T09:03:12.630,"BacklogInMinutes":4,"TotalBacklogItems":65
3}, "heartbeat" : "True", "displayname" : "Sync Check (Vehicle Data)"}

08/11/2016 09:07:27  Script output for SyncVehicleData is {"message":"Connection could not be established","availability":"0","data":{}}
08/11/2016 09:07:27  Util GetFileNameReg FileName is C:\Program Files (x86)\Site24x7\WinAgent\monitoring\bin\PluginRegister\SyncVehicleData.txt
08/11/2016 09:07:27  Util writeToFileReg Successfully written to C:\Program Files (x86)\Site24x7\WinAgent\monitoring\bin\PluginRegister\SyncVehicleData.txt
08/11/2016 09:07:27  Util writeToFileReg {"message":"Connection could not be established","availability":"0","data":{}}

Like (0) Reply

Hi Sonja,

The script output has invalid JSON, the double quotes is missing for value "2016-11-08T09:03:12.630" please refer the image attached. Please confirm the script output using JSON validator https://www.site24x7.com/tools/json-formatter.html and restart the Site24x7PluginAgent using services.msc. It will register and collect the data.

In plugins we support only string and numeric data.


Attachments
json_invalid.png
Size: 65.43 KB
Like (0) Reply

Thanks again. I did validate the JSON several times but not the version I sent to you last time (with the date time string).

Depending on the output from my plugin script, that setting is occasionally null and is excluded from the output. That actually resulted in valid JSON, hence my confusion!

I have now put double quotes around pretty much everything and my plugin has now installed correctly.

Thank you so much for your time and help.

Like (0) Reply

Was this post helpful?