How do I insert multiple measurements when using the exec input plugin?

I am attempting to pull information from my UPS into InfluxDB. I can get various points of data using upsc <upsname> on the command line. This returns about 30-35 lines of data.

The examples I’ve found to build a custom plugin for telegraf uses the exec plugin, but it looks like this requires each individual command to return a single line of data.

How can I structure my plugin (written in python, if it matters) to return data for 35 different datapoints using the exec plugin?

In the plugin example provided by Influx, their command outputs a single echo’d line:

'example,tag1=a,tag2=b i=42i,j=43i,k=44i'

I need this sort of thing, but for each of these entries:

battery.charge: 100
battery.runtime: 2622
battery.voltage: 26.3
battery.voltage.nominal: 24.0

I would want to use various echo lines like this:

'ups,ups=ups1 battery.charge=100'
'ups,ups=ups1 battery.runtime=2662'
'ups,ups=ups1 battery.voltage=26.3'
'ups,ups=ups1 battery.nominal=24.0'

None of the examples I’ve found return more than a single line of data when using this exec plugin. Do I need an individual script for each data point or can I return multiple data points from a single script?

Hi Dear,

I am also facing the similar issue, i can see output in the telegraf plugin but showing only single field.

Please advise how to resolve this.

regards,

Manishh