Go to All Forums

Linux shell script plugin with JSON output

Is it possible to create a shell plugin that outputs JSON?  I've attempted to do this but it does not seem to work as expected.  If I alter the script to output the data with | separators then it seems to work but I'd rather use JSON if possible.

A sample of the output I'm generating is as follows

getSite24x7PluginData.sh
{
"data": {
"searchDuration":1.935},
"plugin_version": 1,
"heartbeat_required": "true",
"units": {
"searchDuration":"seconds"}
}

Thanks

Reply 1
Replies (3)

Re: Linux shell script plugin with JSON output

Hi,

Please change the script accordingly to get the output as follows:

{
"searchDuration":1.935,
"plugin_version": 1,
"heartbeat_required": "true",
"units": {
"searchDuration":"seconds"}
}

 

Let us know if this helps. For any further queries, please reply back in this thread.

Happy Monitoring!

Reply 1

Re: Re: Linux shell script plugin with JSON output

Great thanks, that works!

I modeled my output on the PowerShell example which outputs this... so perhaps that example is wrong?

{
"data": {
"CPU": 81,
"Memory": 85,
"name": "Process"
},
"validation output": {
"Result": "**************Plugin output is valid**************"
},
"plugin_version": 1,
"heartbeat_required": "true",
"units": {
"CPU": "%",
"Memory": "%"
},
"displayname": "Process Monitor"
}


 

Reply 0

Re: Linux shell script plugin with JSON output

There seems to be some inconsistency in the expected plugin output between Windows and Linux installations.

www.site24x7.com/help/admin/adding-a-monitor/plugins/windows-custom-plugins.html

The first section specifying the output just has values at the top level of the JSON object.

The examples for Windows all seem to include a "data" array with the values inside that array.  In my testing it seems that the examples work and if I change them to exclude the data array then they no longer work.

The opposite is the case for Linux plugins (i.e. including the "data" array causes them to fail).

Am I missing something?

Reply 0