Call Diagnostics through the Supervisor

I am wondering if it is possible to run the diagnostics through the balena supervisor API on device? I would like to call it from a container but don’t see anything in the docs. Thanks

Hello, you can’t run the diagnostics through the supervisor api.

But you can run them through https://actions.balena-devices.com

Something like this should start the diagnostics:

curl \
	'https://actions.balena-devices.com/v1/<DEVICE-UUID>/diagnose' \
	--compressed \
	-H 'Content-Type: application/json;charset=utf-8' \
	-H 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
	--data '{"parameters":{}}'

And a GET on the same URL should get you the results when they are available.
You can see the details of this by opening you web browser’s developer tools network panel on the diagnostics page of the dashboard.

Ok, I was hoping to be able to run this potentially without a network connection. Since that doesn’t seem possible, I will just manually pull the data I need. Was hoping that I could leverage the supervisor, but not a big deal. Thanks

I have another question about the supervisor. Is it possible to set device or service variables using it?

Hi @nleonardi ,

For production devices (and development devices not in local mode), this is not possible. The main reason for this is to ensure that state is kept synced between the device and the application/device settings stored in the balena database, as mismatches between these could cause issues. So, whilst you can set these (much as my colleague says using the API), it’s not possible to do this on-device.

It is possible to set service variables on a development device in local mode (https://github.com/balena-io/balena-supervisor/blob/master/docs/API.md#set-a-target-state-post-v2localtarget-state) but I suspect this is not the use case you’re trying to achieve.

Best regards,

Heds