Feature request: Long term Uptime stats

Firstly, congrats on the device stats card. Looks like the beginning of something very useful for the cloud interface.
However, one thing that I find myself constantly wishing Balena offered is an uptime statistic as an extension of the Last Seen (VPN) data.

It seems like balena cloud is already gathering all the necessary data to calculate long term uptime (ie. 98.55% over a certain period) via the VPN data, maybe even with a mini chart showing red bars in downtime.

I think it would be useful enough to include in the paid version of Balena, especially if the uptime over a selectable time range is included.

In the meantime, is there a way to pipe the last seen and device statsu (online/offline) data to a third party like Datadog?


I know this information on the radar of the product team already, so I’ll tack on that another user is asking about it. Thank you for your feedback :+1:

If you wanted to create an agent to pull the info from the device model on our API then you could do that. Obviously you can only see the current state, so the granularity would be only as fine as the period you chose to run the query. Our API docs can be found here for reference: https://www.balena.io/docs/reference/api/overview/

Thanks again, I hope this helps.

Thanks Rich. Presumably I could whip something up using these calls:

is_online is_active last_connectivity_event is_connected_to_vpn last_vpn_event

I know this was discussed before but a outbound web hook from Balena would be very useful in this scenario rather than doing constant polling against the is_online endpoint for example. Are there usage limits on the APIs? I’m imagining I’d do something like a 15-30 second recurring call and then just chart that over time.

There are rate limits, yes, but I am not sure what they are exactly. My suggestion would be to make a single call to pull back the info for all your devices, in one shot, and to do that every 60 secs at the most.

You can construct a call to $select these fields for every device in your application, using a $filter to specify the app ID etc. If you get stuck then we can help out with that query :+1:

1 Like

That’s an excellent idea. It would allow very smooth UX when a user is watching my web UI, waiting for their device to come online.

I decided to just build the query, save the time later on :wink: Here you go:


Replace ${AppId} with the ID of your application, e.g. 1234

That should return some JSON data which will be an entry for each device, and just the values in the $select.

Hope that helps :+1:

Awesome thanks Rich. Although I’m getting a malformed request error on your verbatim query.

I thought perhaps it was the double underscore after the “to” in belongs_to__application, but that didnt seem to clear it up.

I can run the query no problem if excluding the &filter=belongs_to__application%20eq%{AppId}

Hi there, try the following:


Replace <APP_NAME> with your application name

Hi Juan, that does work (kind of). No formatting error, but it doesn’t actually perform the filter. It just gives me a list of every device I’ve got. Strange behavior.

Hi there, it shows you all the devices across all applications, or all devices inside one application that are both online and offline. The behavior I am seeing is the second one

if you only want to see the online devices of that application, you can use the following call :


and you can extend this filter by adding %20and%20<KEY>%20eq%20<VALUE>

if hope that helps

Ha, I appreciate you trying to help. Here’s my query, that still seems to be returning every device. Send back about 730 lines at 15kb - which is about 10 devices across just as many apps.

GET /v6/device HTTP/1.1
Content-Type: application/json
Authorization: Bearer <<REDACTED>>
$select: uuid,is_online,is_active,last_connectivity_event,is_connected_to_vpn,last_vpn_event,belongs_to__application
$filter: belongs_to__application/app_name%20eq%20'<<REDACTED>>'%20and%20is_online%20eq%20true
Host: api.balena-cloud.com

Hi, how are you performing the query? I seem to get the correct result using curl with the query as is

 curl -X GET "https://api.balena-cloud.com/v6/device?\$select=uuid,is_online,is_active,last_connectivity_event,is_connected_to_vpn,last_vpn_event,belongs_to__application&\$filter=belongs_to__application/app_name%20eq%20'APP-NAME'%20and%20is_online%20eq%20true"  -H "Content-Type: application/json" -H "Authorization: Bearer $AUTH_TOKEN" 

Interesting… this whole time I’ve been testing with Insomia app (https://insomnia.rest) and it kept failing the filter portion of the query. However, I just tested in Postman and it works like a charm.

Sorry for the hassle! Guess I’ll be sticking with postman.