Creating the Prometheus Exporter

Now that a hardware endpoint exists to query at any time, use that always-on accessibility to your advantage by leveraging the power of the Prometheus server you installed in the last chapter. Prometheus uses its own particular naming conventions and formatting rules for indicating value names and related assignments. As such, you’ll need to convert the JSON payload received by the Pico W server into an exported format that Prometheus can consume. Fortunately, this is a trivial process to create in Go because Prometheus itself is written in Go.

This implementation, while not sophisticated, applies several of Prometheus exporter development guidelines,[52] ensuring it exports metrics according to Prometheus’s ...

Get Automate Your Home Using Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.