Cannot see microservice running in iofog agent

Setup iofog using the quickstart guide. The iofog agent shows 3 microservices running already.
I added a new microservice in the controller but the number of microservices running the iofog agent remains the same.

/# iofog-agent status
ioFog daemon                : RUNNING
Memory Usage                : about 131.78 MiB
Disk Usage                  : about 0.00 MiB
CPU Usage                   : about 0.00%
Running Microservices       : 3
Connection to Controller    : ok
Messages Processed          : about 0
System Time                 : 25/11/2018 05:10 PM

/# iofog-agent info
Iofog UUID                               : GBgjjQ7wxpWN6jgdT66ZgBymZ9nqckVC
IP Address                               :
Network Interface                        : eth0
Developer's Mode                         : on
ioFog Controller                         : http://iofog-controller:51121/api/v3/
ioFog Certificate                        : /etc/iofog/cert.crt
Docker URL                               : unix:///var/run/docker.sock
Disk Usage Limit                         : 50.00 GiB
Message Storage Directory                : /var/lib/iofog/
Memory RAM Limit                         : 4096.00 MiB
CPU Usage Limit                          : 80.00%
Log Disk Limit                           : 10.00 GiB
Log File Directory                       : /var/log/iofog/
Log Rolling File Count                   : 10
Status Update Frequency                  : 30
Get Changes Frequency                    : 60
Scan Devices Frequency                   : 60
Post Diagnostics Frequency               : 10
Isolated Docker Containers Mode          : off
GPS mode                                 : off
GPS coordinates(lat,lon)                 : 
Fog type                                 : intel_amd

# iofog-controller microservice list
  "microservices": [
      "uuid": "L7XmYwczB26cjPd4bmTGFpH8R2CJbwdr",
      "config": "",
      "name": "iofog service test",
      "rootHostAccess": false,
      "logSize": 0,
      "delete": false,
      "deleteWithCleanup": false,
      "userId": 1

Kindly help.

Try to check log directory inside iofog-agent docker image and look into /iofog-agent.0.log file which contains latest logs.

Also iofog-agent UUID from config.xml (iofog-agent info) should match the one you are using while adding new microservice.
Field in config.xml:
Iofog UUID : GBgjjQ7wxpWN6jgdT66ZgBymZ9nqckVC

And your current config.xml content looks old (currently it uses iofog-agent namings & 54421 port by default), it may cause some issue. Try to re-install quickstart project using
curl -sSf | sh

You can also check current running microservices using docker ps inside iofog-agent container.

Couldn’t find any logs in /var/lib/iofog-agent/ .
iofog-agent UUID is the same. I tried adding a microservice (iofog/temperature-sensor-simulator) that was already present in the iofog-controller catalog, and it worked. And could see the ms running using docker ps in the iofog-agent.
The microservice that I was trying to add is working locally using the docker run command. But not when added using iofog-controller.

Check /var/log/iofog-agent folder, logs should be there or in /var/log/iofog folder depending on your config.xml.

Thanks. I could find logs in /var/log/iofog/. Let me go through them.

1 Like

Thanks for the help. I could resolve the issue with the help of log. Now my microservice is up and running . How can I access the same?

In order to access running microservices you can use docker commands. Get microservice UUID from ‘docker ps’ and then enter microservice using ‘docker exec -ti microserviceUuidHere sh’.

I would like to access the service from outside the container. I couldn’t see port mapping for the container when running docker ps command. How could I access it from outside?

CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS              PORTS                      NAMES
dd3d07ac91aa        josemaria02/helloworld               "python"          20 minutes ago      Up 19 minutes       5000/tcp                   bk3YQjPR2nM2NNg4VnNPwgFzpWwvxym2

Port mapping should be visible in PORTS field. You can check existing port mappings in CLI using ‘microservice port-mapping-list -i microserviceUUID’ for this microservice. Currently it looks like this microservice has EXPOSE command in its Dockerfile and it exposes this port only inside your docker container. with port mapping you’ll be able to access it from outside.

From microservice CLI help with example of how to create port mapping:


-i, --microservice-id string Microservice ID
-P, --mapping string Container port mapping


-i, --microservice-id string Microservice ID
-b, --internal-port string Internal port


-i, --microservice-id string Microservice ID

Create port mapping (80:8080:false - internal port : external port : public mode, ABC - microservice)
$ iofog-controller microservice port-mapping-create --mapping 80:8080:false -i ABC

bash-4.4# iofog-controller microservice port-mapping-create --mapping 5000:5000:false -i z3y3CQQcK4dp7GvNK7wGDzHJjMKNbgRV

Executing (3b255b3c-84fa-4bc2-91ab-ec1f591bdbe3): BEGIN DEFERRED TRANSACTION;
Executing (3b255b3c-84fa-4bc2-91ab-ec1f591bdbe3): SELECT `uuid`, `config`, `name`, `config_last_updated` AS `configLastUpdated`, `is_network` AS `isNetwork`, `rebuild`, `root_host_access` AS `rootHostAccess`, `log_size` AS `logSize`, `image_snapshot` AS `imageSnapshot`, `delete`, `delete_with_cleanup` AS `deleteWithCleanup`, `created_at`, `updated_at`, `catalog_item_id`, `flow_id` AS `flowId`, `iofog_uuid`, `catalog_item_id` AS `catalogItemId`, `iofog_uuid` AS `iofogUuid`, `user_id` AS `userId` FROM `Microservices` AS `Microservice` WHERE `Microservice`.`uuid` = 'z3y3CQQcK4dp7GvNK7wGDzHJjMKNbgRV';
Executing (3b255b3c-84fa-4bc2-91ab-ec1f591bdbe3): SELECT `id`, `port_internal` AS `portInternal`, `port_external` AS `portExternal`, `is_public` AS `isPublic`, `created_at`, `updated_at`, `microservice_uuid`, `microservice_uuid` AS `microserviceUuid`, `user_id` AS `userId` FROM `MicroservicePorts` AS `MicroservicePort` WHERE (`MicroservicePort`.`port_internal` = 5000 OR `MicroservicePort`.`port_external` = 5000) AND `MicroservicePort`.`microservice_uuid` = 'z3y3CQQcK4dp7GvNK7wGDzHJjMKNbgRV' LIMIT 1;
Executing (3b255b3c-84fa-4bc2-91ab-ec1f591bdbe3): ROLLBACK;
Cannot read property 'id' of undefined

Why do I get this error?

Added another microservice using the below command.
iofog-controller microservice add --name "newservice" --catalog-id 13 --iofog-id LcNX4rzvTFmRwvHFPDwpTFcPzKpnBP6H --flow-id 1 -u 1 --ports 5000:5000:false

This worked and I could access the service at 5000.

Creating port-mapping for an existing microservice failed.

1 Like

It looks like we have a bug in this command, we’ll look into it and fix this one in the next release (few days).

For now you can use REST API for the same command

There’s also a collection for Postman client which may help, just import this file.

1 Like

Thanks for the help :slight_smile:

1 Like