Company
Date Published
Author
Community
Word count
891
Language
English
Hacker News points
None

Summary

Telegraf, an open-source monitoring system, is used to collect data from IoT devices such as energy meters. The author of the article had no prior experience with Telegraf but was able to onboard a Docker instance of Telegraf and start collecting data. However, processing the raw data proved to be a challenge. To overcome this challenge, the author built a custom plugin using Starlark, a programming language interface provided by Telegraf. The Starlark Processor Plugin allowed the author to transform power meter readings into more usable data for analysis and visualization. The plugin used a state machine approach to "remember" prior measurements and calculate differences between them. This enabled the creation of new fields in the measurement data, such as delta power, which provided valuable insights into the energy production and consumption. The use of Starlark in Telegraf provides additional functionality beyond what is available with other plugins, allowing for sophisticated computations and data manipulation.