question

PascalTellier-7750 avatar image
0 Votes"
PascalTellier-7750 asked PascalTellier-7750 commented

Manage device with nodejs script in iot edge context with iot central

Hi everyone,

I'm working with IoT edge modules on a device but for different reasons I need to do some remote tasks on the device itself (for example send files to azure blob storage or delete files).
I can't use an IoT edge module docker because I need to move files in different directories (/etc for example)

so I developed a nodejs script directly installed on the device and used onDeviceMethod to trap the command I want to execute on the device.

the script and the IoT edge modules are managed by IoT central

It doesn't work anymore since a new release of Iot central (the script and iot edge modules are using DPS to connect to IoT central ).


Have you already develop this kind of use case and what are the best practice?


Best regards.

azure-iot-edgeazure-iot-central
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @PascalTellier-7750 ,

Although I usually connect my Azure IoT Edge devices to an IoT Hub directly, support for folders is available in Azure IoT Edge too.

Check out these (C#) examples and the related Container Create Options here.


0 Votes 0 ·

Hello @SandervandeVelde42,

Thanks for your answer. I read the article very well documented.

But I have to do some tasks like rebooting the device or getting logs from a module (Iotedge logs module name ) ... not possible to do within a docker.

I developed a nodejs script on the device. It works but I need to set the deviceconnexionstring in the script which is not very sexy and scalable.

I was wondering if I could use values from the config.yaml file (scopeID, device name, keys..) and rebuild the connexion string

or may. be other solution



Thanks



0 Votes 0 ·

1 Answer

SandervandeVelde42 avatar image
1 Vote"
SandervandeVelde42 answered PascalTellier-7750 commented

Hello @PascalTellier-7750 ,

yes, Azure IoT Edge only give you access to the 'sand boxed' containers.

Though, it is possible to get the logs of any Azure IoT Edge module using the Edge Agent direct method.

I'm not sure why you need the security part but it's not recommended to use it in that way.

You could build a custom module that passes certain messages to some script on the operating system if you want to trigger a reboot.

But again, if this is needed to restart certain modules, this is also supported.

Please check out the feature of the Azure IoT Edge in the documentation.


· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SandervandeVelde42


Thanks for your advice. I agree the best way will be to create a docker to communicate with the operating system.

For the logs or restart module, I'm working with IoT Central and I'm not sure it's implemented but maybe you have a way to do it


Best regards.

0 Votes 0 ·

Hello @PascalTellier-7750 ,

Can you try to make these predefined Direct Methods of the edgeAgent module part of the DeviceTemplate?

In that case, you can call these from the dashboard.

0 Votes 0 ·

HI @SandervandeVelde42,

I got an answer. GetModuleLogs, UploadModuleLogs, UploadSupportBundle... are not yet implemented with Iot Central.

So I will developp my own module for doing some task ont the device

Thanks for your time

0 Votes 0 ·