Retrieve mender id from application on device


I’d like to have my software report the mender id to my cloud, so I can use that to track back which customer device is which mender device (and do versioning from there).

How can i get the mender id on the device? (ie, the 24-character string)

Thanks in advance!

With kind regards,
Matthijs ter Woord

1 Like

The only way to retrieve that information is using the server API`s,

You could probably call that API on the device as well, but this sounds like you are integrating two different “cloud” services and then it makes more sense to create services in “the cloud” that glues information from these two services together.

That’s what I’m working on:

I have a cloud service that does the functional cloud stuff (data logging, configuration pushes, etc), and I have device twins in there. Now I want to be able to link those to mender devices.

It’s then either post my cloud id to mender, but i’d rather go other way around.

How would you suggest I do that glueing? Manual entering id’s?

How would you suggest I do that glueing? Manual entering id’s?

No not manually.

I am assuming that your cloud service has some form of identity information about the devices (MAC or serial number or something). This identity should be part of Mender device identity or inventory as well.

Then it should be pretty straight forward to extract the necessary information using the identity/inventory information.

Your cloud service could call the server API`s directly or you can write a separate service that extracts the information from both locations and pushes merged data somewhere.

The preauthorization example does something similar when removing existing authsets for a device and I can verify that I have done this kind of thing from the target device itself. You just need to run the mender-device-identity script and then use that to locate yourself in the list of devices.