Prometheus Exporter for Carriota Field API metrics
August 25, 2018
- adapted season length to show correct season progress
July 14, 2018
April 4, 2018
- minor bugfixes
April 3, 2018
- initial version published
What does it do?
The following images are from my field_exporter dashboard. The top looks like this:
The next section contains season history data and data summaries of all my nodes:
Nuriel Shem-Tov has a great installer which deploys, among other things, IOTA IRI, IOTA PM, Grafana, Prometheus, IOTA Prometheus Exporter, Field and this Exporter. Please visit his docs if your intent is to get the whole stack up and running as easily as possible: IRI-Playbook
IOTA Partners also has a copy+paste installation playbook that is also great. Check out both and decide which one is right for you.
- Node JS: version >= 8.0 (due to async await use)
- Prometheus: Here is a great guide
- Grafana: version >= 5.0
git clone https://github.com/DaveRingelnatz/field_exporter.git cd field_exporter npm install
Rename config-template.js to config.js (if field_exporter is already installed -> copy config.js to config.js.backup so you still can access your current settings). You need to configure the following values to use field_exporter in
- field_node_public_id (example entry: "field_node_public_id: 'yourpublicidhere',")
- field_nodes_multiple_ids (example config: "field_nodes_public_ids_array: ['publicId1','publicId2'],")
The exporter is configured to run on port
9337 so as to comply with the list of export default ports
Once installed and working you have to edit the Prometheus config file -
/etc/prometheus/prometheus.yml and add a section like the below:
# field_exporter section - job_name: 'field_exporter' scrape_interval: 30s static_configs: - targets: ['localhost:9337']
Please don't set the scrape_interval below
30s value because this value already implies about ~3000 request per day to the carriota field APIs.
You need to restart the Prometheus service
sudo service prometheus restart (or
sudo systemctl restart prometheus) after adding an exporter.
Run the field_exporter
Within install dir type
Note: field_exporter is only running as long as bash is open. As soon as you disconnect the field_exporter will be killed. Use "screen -S field_exporter" to start new screen, type command there and detach by pressing "CTRL + A + D". Then you can disconnect SSH session (use "screen -r" to reattach to the session if you are connected by ssh again).
Test if all works fine by navigating to http://localhost:9337/metrics. If you get back data, field_exporter is running.
Once the above is done, the metrics will be available to be consumed in a Grafana dashboard which must be added (see folder
dashboards). Chose Prometheus as data source.
docker build . -t field-exporter:latest
Run example: mount the configuration file from the host, and expose the metrics port:
docker run -v ./config.js:/app/config.js:ro -p 9337:9337 --name field_exporter field-exporter:latest