BalenaHub block to capture device / application metrics with Prometheus

I’ve been wanting to look at how BalenaHub works for a while now. I’ve been having device connectivity problems with one of my Pi Projects which I think is related to some dodgy network infrastructure so I decided it would be useful to do some connection quality monitoring.

As I looked around for tools I found this Prometheus tool which I like the look of so I thought I’d get it going. As this has gone on I decided it would be a nice little project to set up as a BalenaHub Block (although possibly in future I might want it to run on the host itself, we shall see).

So I have a simple project here which works

This runs in a container on my Pi4-64 here and I’m exposing the Prometheus node-exporter on port 80. I can then query that on my device public URL and I get something like this

Then I have the main Prometheus application installed on a cloud server of mine and scraping and I can then graph up all sorts of interesting statistics over time

It also seems to have a Grafana visualisation plugin which I’m going to look at next.

So this all seems quite interesting, quite useful, and a nice way to get into Blocks so I’ll submit this now for the Powers That Be™ to look into

Ambassador Alex :slight_smile:

1 Like

Oh. My. Word. I am loving this!!! @mpous !!!

2 Likes

WHOA @ajlennon! :eyes: :tada:

1 Like

@ajlennon did you submit the block! now you can do it yourself :slight_smile:

find more information of how to do it here → Blocks: new management functionality and a public roadmap for what's next

looking forward to test your block!

1 Like

I did! I didn’t hear anything back though!

OK! I added a block “prometheus exporter” with a release for you to play with :smiley:

@ajlennon could you please improve the README file to provide the instructions to anyone to use this block?

Find here an example → GitHub - balenablocks/pulse: A block for counting pulses on a Raspberry Pi GPIO pin.

1 Like

Will do - although there should be nothing to do. It “just works”

(I could do with a pointer to a “routing” block if there is such a thing to put this behind the public web URL instead of occupying the port)

well, i think it’s important to mention:

  • how to install this block in my fleet. What do i need to add on my docker-compose?
  • is there any service exposed? how can i access to the service?
  • is there any data being send or collected from the block? how?

Thanks @ajlennon :slight_smile:

1 Like

Ok!

1 Like

I’m trying to find out how to add a balena block to a fleet. I’d assumed there was something automated but you seemed to imply there are changes to docker-compose.yml @mpous. I’ve been hunting around but can’t see any details.

e.g. Introducing balenaBlocks: jumpstart your IoT app development

Can you point me to a written walk through of what I need to do to add my block to a fleet?

Thanks!

Alex

Ah I think I might be able to figure out what I need to do from that pulse link you sent…

Fighting here to find the right incantations to push the image up to Docker Hub with balena CLI…

Made some progress but it’s been quite hard work. I had to figure out that there’s a build script to upload to Docker Hub, then there are some twiddly bits in the docker buildx platform configuration.

Now what I am fighting is that I am building for arm64 but the balena cli push is failing as it wants arm64/v8

OK this is running now. I had to put a dirty hack into my Fleet to be able to use the Block on my RPi4v64

Details here - GitHub - DynamicDevices/balena-prometheus-exporter: BalenHub project to export metrics to Prometheus

1 Like

Beautiful work @ajlennon

on my to-do list this week :slight_smile:

1 Like

My thanks :slight_smile: When you’ve had a chance to go through would be good to catch up with you on how to make this device / platform / archicecture agnostic in the “best practice” way

Nice work on the block @ajlennon !

Made some progress but it’s been quite hard work. I had to figure out that there’s a build script to upload to Docker Hub, then there are some twiddly bits in the docker buildx platform configuration.

I hear you. We are working hard now to take away the need to build and push to somewhere like Dockerhub, and leverage the balenaCloud platform better for blocks. Details in the roadmap section here:

Blocks: new management functionality and a public roadmap for what’s next (balena.io)

2 Likes

Yeah thanks! It was an interesting experience. Love what you’re doing here of course and actually @mpous 's “call to action” to me to document really helped as I found that when I started testing there were more moving parts to this than I expected.

Not interested in criticising of course as I love where this is going but I do feel from my experience it’s possible to “ease the path” for people for this a bit.

That said I see there are numbers of blocks on there so maybe everybody else found this easy and it was just me that found it hard!

I would say the most important thing for me would be making the blocks hardware/board agnostic as I am running into trouble with this now… (and by that I think that the main issue I was seeing was weirdness for ARM64/v8 versus aarch64 and arm64v8 and so forth.

2 Likes