Forum Discussion

Kiyoshi_Egawa's avatar
9 months ago

invalid Output format - root element of output JSON should be "data"

What does means the below message on the following setting ?

[MSG] [WARN] [collector-task-thread-collector.batchscript-batchscript-28-1::collector.batchscript:Task:4218:XXX.XXX.XXX.XXX:batchscript:SAP Cloud Connector Memory Status::18] [BatchScriptSlaveTask._prepareOutput:155] invalid Output format - root element of output JSON should be "data", CONTEXT=

The output is 

{"physicalKB":{"total":16469532,"CloudConnector":959296,"others":6477020,"free":9033216},"virtualKB":{"total":41635356,"CloudConnector":4639480,"others":5910204,"free":31085672},"cloudConnectorHeapKB":{"total":4128768,"used":209168,"free":3919600},"version":1}

  • Hey, something I recently ran into! Your data is not formatted correctly:

    BatchScript Data Collection | LogicMonitor

    Your error is complaining about the fact that your output does not conform to the following format:

    {
    data: {
    instance1: {
    values: {
    "key1": value11,
    "key2": value12
    }
    },
    instance2: {
    values: {
    "key1": value21,
    "key2": value22
    }
    }
    }
    }

    At least, I’m about 90% certain that’s what it’s complaining about.

  • What LogicModule/DataSource is this from? Something built into LM or something you coded yourself?

  • I was worng to use BatchScript and Script. It worked by Script not BatchScript.

    Thanks,

    Kiyoshi

  • Anonymous's avatar
    Anonymous

    It would seem this probably needs to be a multi-instance datasource using ##WILDVALUE## in the key to pull the data out. That way you don’t have to transform the output and you don’t have to hard code the “cloudConnectorHeapKB” into a datapoint. It will also make it so that you can have just the one datapoint for “free”.

  • Yep -- you aren’t able to use BatchScripts for _non-multi-instance datasources_. Found that out the hard way after one of my users was having this same problem. Forgot that was part of it, also.