Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Developer Troubleshooting Guide

Jill Bender edited this page Jan 15, 2019 · 15 revisions

Use this troubleshooting guide to help to identify and resolve commonly encountered issues for Azure IoT Preconfigured Solutions development tasks.

If you are unable to find the solution to an issue here, please check out our Developer Reference Guide or file an issue.

Contents

What to do when a deployment fails

When starting a new deployment from the pcs-cli, you may see output showing one of the deployed resources fails. More information is available from portal.azure.com under Resource Groups > Your Resource Group > Deployments > Your Deployment > Operation Details.

Check that you don't need to update some setting with your subscription (like too many IoT Hubs), delete the resource group with the failure, and try again.

We are working on a solution to redeploy a single failed resource, stay tuned.

How do I know if the app is running?

Visit the URL for your deployment, https://{deployment-name}.azurewebsites.net/. You should see simulated telemetry flowing in the chart. Is you aren't seeing any telemetry, you can check the status of the application on the VM.

List all running containers to check status of a service

  1. SSH into the VM
  2. use docker ps -a

Example output:

CONTAINER ID        IMAGE                                            COMMAND                  CREATED             STATUS              PORTS                                      NAMES
b84eeb26c07a        azureiotpcs/remote-monitoring-nginx:latest       "/bin/bash /app/ru..."   12 minutes ago      Up 12 minutes       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   app_reverseproxy_1
c66af1abbafb        azureiotpcs/pcs-remote-monitoring-webui:latest   "/bin/sh /app/run.sh"    12 minutes ago      Up 12 minutes       80/tcp, 443/tcp                            app_webui_1
8cb29cd3902d        azureiotpcs/telemetry-agent-dotnet:latest        "/bin/bash /app/ru..."   13 minutes ago      Up 13 minutes                                                  app_telemetryagent_1
d96b506acf7a        azureiotpcs/pcs-config-dotnet:latest             "/bin/bash /app/ru..."   13 minutes ago      Up 13 minutes                                                  app_config_1
6c6802aacd91        azureiotpcs/device-simulation-dotnet:latest      "/bin/bash /app/ru..."   13 minutes ago      Up 13 minutes                                                  app_devicesimulation_1
47ec9f594920        azureiotpcs/telemetry-dotnet:latest              "/bin/bash /app/ru..."   13 minutes ago      Up 13 minutes                                                  app_telemetry_1
3531b19916be        azureiotpcs/pcs-storage-adapter-dotnet:latest    "/bin/bash /app/ru..."   13 minutes ago      Up 13 minutes                                                  app_storageadapter_1
d84d888d55e3        azureiotpcs/pcs-auth-dotnet                      "/bin/bash /app/ru..."   13 minutes ago      Up 13 minutes                                                  app_auth_1
67dbea599512        azureiotpcs/iothub-manager-dotnet                "/bin/bash /app/ru..."   14 minutes ago      Up 14 minutes                                                  app_iothubmanager_1

View aggregated logs for deployed services

  1. SSH into the VM
  2. navigate to the app folder from the home directory: cd /app
  3. run the logs script from the terminal (root access required)
    sudo ./logs.sh
    

View logs for a deployed service

Basic

  1. SSH into the VM
  2. List all containers with docker ps -a
  3. Get the logs for a running container docker logs {Container ID} or docker logs --tail 100 {Container ID} (lists last 100 lines of log file)

Pull the logs to a local machine for a container

  1. Open a bash terminal.
  2. SSH into the VM using the instructions above in "SSH into a VM".
  3. Find your container name or id with docker ps.
  4. Write the logs for a container to disk: docker logs <containerid> >& simlog.log
  5. Ensure the log data is present: sudo nano container.log
  6. Open a second bash terminal on your local machine.
  7. Copy the file local: scp <username>@<vm ip>:container.log c:/temp/container.log

How do I know if telemetry is flowing?

If telemetry is flowing, you should see the telemetry on the dashboard page. If you aren't seeing any telemetry, you can try the following steps.

  1. Check the logs for the telemetry service, and the telemetry agent service on the VM, see View logs for a deployed service
  2. Disable auth and send sample requests via Postman.

Resolve errors for resource provider registration

If deployment fails because a resource is not available in a selected region, follow the instruction.

Cosmos DB Consistency Errors

If you see the following error:

DocumentDbKeyValueContainer.CreateDatabaseIfNotExistsAsync

ConsistencyLevel Strong specified in the request is invalid when service is configured with consistency level Session. Ensure the request consistency level is not stronger than the service consistency level.

This is caused by the RequestOptions not matching the same consistency as the deployed resource. Update the default consistency to match.