author | ms.service | ms.topic | ms.date | ms.author |
---|---|---|---|---|
alkohli |
databox |
include |
07/26/2019 |
alkohli |
On an Azure Stack Edge device that has the compute role configured, a subset of docker commands are available to monitor or troubleshoot modules. To see a list of available commands, connect to the PowerShell interface and use the dkrdbe
function.
[10.100.10.10]: PS>dkrdbe -?
Usage: dkrdbe COMMAND
Commands:
image [prune]
images
inspect
login
logout
logs
port
ps
pull
start
stats
stop
system [df]
top
[10.100.10.10]: PS>
The following table has a brief description of the commands available for dkrdbe
:
command | Description |
---|---|
image |
Manage images. To remove unused images, use: dkrdbe image prune -a -f |
images |
List images |
inspect |
Return low-level information on Docker objects |
login |
Sign in to a Docker registry |
logout |
Sign out from a Docker registry |
logs |
Fetch the logs of a container |
port |
List port mappings or a specific mapping for the container |
ps |
List containers |
pull |
Pull an image or a repository from a registry |
start |
Start one or more stopped containers |
stats |
Display a live stream of container(s) resource usage statistics |
stop |
Stop one or more running containers |
system |
Manage Docker |
top |
Display the running processes of a container |
To get help for any available command, use dkrdbe <command-name> --help
.
For example, to understand the usage of the port
command, type:
[10.100.10.10]: P> dkrdbe port --help
Usage: dkr port CONTAINER [PRIVATE_PORT[/PROTO]]
List port mappings or a specific mapping for the container
[10.100.10.10]: P> dkrdbe login --help
Usage: docker login [OPTIONS] [SERVER]
Log in to a Docker registry.
If no server is specified, the default is defined by the daemon.
Options:
-p, --password string Password
--password-stdin Take the password from stdin
-u, --username string Username
[10.100.10.10]: PS>
The available commands for the dkrdbe
function use the same parameters as the ones used for the normal docker commands. For the options and parameters used with the docker command, go to Use the Docker commandline.
Compute modules are containers that have a business logic implemented. To check if a compute module is deployed successfully, run the ps
command and check if the container (corresponding to the compute module) is running.
To get the list of all the containers (including the ones that are paused), run the ps -a
command.
[10.100.10.10]: P> dkrdbe ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d99e2f91d9a8 edgecompute.azurecr.io/filemovemodule2:0.0.1-amd64 "dotnet FileMoveModu…" 2 days ago Up 2 days movefile
0a06f6d605e9 edgecompute.azurecr.io/filemovemodule2:0.0.1-amd64 "dotnet FileMoveModu…" 2 days ago Up 2 days filemove
2f8a36e629db mcr.microsoft.com/azureiotedge-hub:1.0 "/bin/sh -c 'echo \"$…" 2 days ago Up 2 days 0.0.0.0:443->443/tcp, 0.0.0.0:5671->5671/tcp, 0.0.0.0:8883->8883/tcp edgeHub
acce59f70d60 mcr.microsoft.com/azureiotedge-agent:1.0 "/bin/sh -c 'echo \"$…" 2 days ago Up 2 days edgeAgent
[10.100.10.10]: PS>
If there was an error in creation of the container image or while pulling the image, run logs edgeAgent
. EdgeAgent
is the IoT Edge runtime container that is responsible for provisioning other containers.
Because logs edgeAgent
dumps all the logs, a good way to see the recent errors is to use the option --tail 20
.
[10.100.10.10]: PS>dkrdbe logs edgeAgent --tail 20
2019-02-28 23:38:23.464 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Util.Uds.HttpUdsMessageHandler] - Connected socket /var/run/iotedge/mgmt.sock
2019-02-28 23:38:23.464 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Util.Uds.HttpUdsMessageHandler] - Sending request http://mgmt.sock/modules?api-version=2018-06-28
2019-02-28 23:38:23.464 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Agent.Core.Agent] - Getting edge agent config...
2019-02-28 23:38:23.464 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Agent.Core.Agent] - Obtained edge agent config
2019-02-28 23:38:23.469 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Agent.Edgelet.ModuleManagementHttpClient] - Received a valid Http response from unix:///var/run/iotedge/mgmt.soc
k for List modules
--------------------CUT---------------------
--------------------CUT---------------------
08:28.1007774+00:00","restartCount":0,"lastRestartTimeUtc":"2019-02-26T20:08:28.1007774+00:00","runtimeStatus":"running","version":"1.0","status":"running","restartPolicy":"always
","type":"docker","settings":{"image":"edgecompute.azurecr.io/filemovemodule2:0.0.1-amd64","imageHash":"sha256:47778be0602fb077d7bc2aaae9b0760fbfc7c058bf4df192f207ad6cbb96f7cc","c
reateOptions":"{\"HostConfig\":{\"Binds\":[\"/home/hcsshares/share4-dl460:/home/input\",\"/home/hcsshares/share4-iot:/home/output\"]}}"},"env":{}}
2019-02-28 23:38:28.480 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Agent.Core.Planners.HealthRestartPlanner] - HealthRestartPlanner created Plan, with 0 command(s).
To get logs for a specific container, first list the container and then get the logs for the container that you're interested in.
-
To get the list of running containers, run the
ps
command.[10.100.10.10]: P> dkrdbe ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d99e2f91d9a8 edgecompute.azurecr.io/filemovemodule2:0.0.1-amd64 "dotnet FileMoveModu…" 2 days ago Up 2 days movefile 0a06f6d605e9 edgecompute.azurecr.io/filemovemodule2:0.0.1-amd64 "dotnet FileMoveModu…" 2 days ago Up 2 days filemove 2f8a36e629db mcr.microsoft.com/azureiotedge-hub:1.0 "/bin/sh -c 'echo \"$…" 2 days ago Up 2 days 0.0.0.0:443->443/tcp, 0.0.0.0:5671->5671/tcp, 0.0.0.0:8883->8883/tcp edgeHub acce59f70d60 mcr.microsoft.com/azureiotedge-agent:1.0 "/bin/sh -c 'echo \"$…" 2 days ago Up 2 days edgeAgent
-
Make a note of the container ID for the container that you need the logs for.
-
To get the logs for a specific container, run the
logs
command providing the container ID.[10.100.10.10]: PS>dkrdbe logs d99e2f91d9a8 02/26/2019 18:21:45: Info: Opening module client connection. 02/26/2019 18:21:46: Info: Initializing with input: /home/input, output: /home/output. 02/26/2019 18:21:46: Info: IoT Hub module client initialized. 02/26/2019 18:22:24: Info: Received message: 1, SequenceNumber: 0 CorrelationId: , MessageId: 081886a07e694c4c8f245a80b96a252a Body: [{"ChangeType":"Created","ShareRelativeFilePath":"\\__Microsoft Data Box Edge__\\Upload\\Errors.xml","ShareName":"share4-dl460"}] 02/26/2019 18:22:24: Info: Moving input file: /home/input/__Microsoft Data Box Edge__/Upload/Errors.xml to /home/output/__Microsoft Data Box Edge__/Upload/Errors.xml 02/26/2019 18:22:24: Info: Processed event. 02/26/2019 18:23:38: Info: Received message: 2, SequenceNumber: 0 CorrelationId: , MessageId: 30714d005eb048e7a4e7e3c22048cf20 Body: [{"ChangeType":"Created","ShareRelativeFilePath":"\\f [10]","ShareName":"share4-dl460"}] 02/26/2019 18:23:38: Info: Moving input file: /home/input/f [10] to /home/output/f [10] 02/26/2019 18:23:38: Info: Processed event.
To monitor the memory, CPU usage, and IO on the device, use the stats
command.
-
Run the
stats
command so as to disable the live stream and pull only the first result.dkrdbe stats --no-stream
The following example shows the usage of this cmdlet:
[10.100.10.10]: P> dkrdbe stats --no-stream CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS d99e2f91d9a8 movefile 0.0 24.4MiB / 62.89GiB 0.04% 751kB / 497kB 299kB / 0B 14 0a06f6d605e9 filemove 0.00% 24.11MiB / 62.89GiB 0.04% 679kB / 481kB 49.5MB / 0B 14 2f8a36e629db edgeHub 0.18% 173.8MiB / 62.89GiB 0.27% 4.58MB / 5.49MB 25.7MB / 2.19MB 241 acce59f70d60 edgeAgent 0.00% 35.55MiB / 62.89GiB 0.06% 2.23MB / 2.31MB 55.7MB / 332kB 14 [10.100.10.10]: PS>