The new rest-extractor plugin works well to pull JSON data out as a Geneos dataview but for those users who have not yet updated or have not had a new license key issued to enable the plugin there is always the original extractor plugin in JSON mode. This mode is much more limited than using the power of JQ in the new plugin, but will get the job done.
The sample XML below duplicates, approximately, the example given in this article earlier this year:
REST Extractor Example - Tesla Powerwall Gateway API
The data comes from webmon on a data channel called PWDATA and wildcards are used to build the column names and row data. The debug option showmenu is very useful for testing but should normally be removed for production use.
<sampler name="Tesla Extractor">
<plugin>
<extractor>
<source>
<samplerDataTransfer>
<name>
<data>PWDATA</data>
</name>
</samplerDataTransfer>
</source>
<views>
<view>
<name>
<data>Aggregates</data>
</name>
<template>
<custom>
<format>
<json>
<method>
<xpath>
<xpath>/object</xpath>
<columns>
<xpath>*[1]</xpath>
<column>
<name>
<static>
<data>meter_name</data>
</static>
</name>
</column>
<column>
<xpath>*</xpath>
<name>
<xpath>
<xpath>name()</xpath>
</xpath>
</name>
</column>
</columns>
<rows>
<row>
<xpath>*</xpath>
<name>
<xpath>
<xpath>name()</xpath>
</xpath>
</name>
<cells>
<cell>
<xpath>*</xpath>
<value>
<xpath>
<xpath>.</xpath>
</xpath>
</value>
</cell>
</cells>
</row>
</rows>
</xpath>
</method>
</json>
</format>
</custom>
</template>
</view>
</views>
</extractor>
</plugin>
<debug>
<setting>showmenu</setting>
</debug>
</sampler>
-
Tags:
- json
- extractor
Comments
0 comments
Please sign in to leave a comment.