REST
The REST output module turns your system into a web server that hosts values in a variety of machine-readable formats, including JSON and XML.
The URL to read is http://servername/api.
This is a service module - meaning that rather than writing data to another system, it opens a server to make that data available to systems that might want to read the information.
Parameter | Default | Meaning |
---|---|---|
port | The port number to host the web server on. |
Notes
It is important to note that if you have multiple output modules that require a web server, they will share a single server with the port number specified by the last module in your configuration file.
For example, if you wanted both Prometheus output on port 90 and REST output on port 9002 (in that order), your Prometheus endpoint would be available on port 9002 rather than 90.
Example
[ { "method": "rest", "port": 82 } ]
The above example would make your data available via REST API on port 82
Parameters
The data is available in several formats, which you can specify using the format parameter in your REST call.
Formats include xml, json, csv and txt.
There are also a couple of variant formats, which provide subtle changes to the file format. For example, csvh and txth include a header row that isn't on the normal CSV and TXT formats.
You can also access some variants on the normal XML and JSON layouts by adding a number to their format name. The basic json format provides data as a list of arrays, while json2 provides it as a list of objects. The basic xml provides data with uniquely-named tags, while xml2 provides data in 'v' tags and attributes giving the point name.
Other Modules
Return to the list of output modules.