Over a million developers have joined DZone.

Visualize IoT Data With Kaa and MongoDB Compass

DZone's Guide to

Visualize IoT Data With Kaa and MongoDB Compass

If you aren't familiar with it, Kaa is an open source middleware platform for IoT development. See how to put it to use to visualize your devices' data.

· IoT Zone ·
Free Resource

Download The Comparative Guide to Rules Engines for IoT to learn what are the most common automation technologies used in the IoT domain for application development

Kaa is a highly flexible, open source middleware platform for Internet of Things product development. It provides a scalable, end-to-end IoT framework for large, cloud-connected IoT networks. Kaa enables data management and real-time bidirectional data exchange between the connected objects and backend infrastructure by providing server and endpoint SDK components.

The SDK components support multi-programming development, client server communication handling authentications, and so on. The SDK components can be virtually integrated with unlimited and any type of connected devices or microchips.

In this blog, let us discuss the quick installation of Kaa Sandbox using a VirtualBox environment and connecting a sample application with MongoDB log appenders.


  • Download and install the following from the links below:
  • Minimum system requirements (64-bit OS, 4 GB RAM)
  • Virtualization enabled in BIOS

Installing Kaa Sandbox

To install Kaa Sandbox, perform the following:

  • Download Sandbox image v0.10.0 from the download link.
  • Download the .ova file and provide a proper location in the local system.

  • Download the VirtualBox platform packages. In our use case, Windows hosts are used.
  • Locate the two downloaded files in the proper location for a better understanding.
  • Open VirtualBox and go to File --> Import Virtual Appliance.

  • Import the downloaded kaa-sandbox- file.
  • Click the Next button, then select the proper configuration details such as Name, OS Type, CPU, RAM, and so on.
    Note: A minimum of 4096 MB should be available to run in the environment.

  • Upon verifying the configuration details, click Import to start the process.


  • Upon completing the import process, start Kaa Sandbox in a VM.

  • Click the Start button (the green arrow) to start the process as shown in the below diagram:


Upon starting Kaa Sandbox in VirtualBox, the local host Kaa Dashboard Access Interfaces will be provided as shown below:


Screen 1 provides the local host for dashboard access and screen 2 provides the login to this virtual machine.

  • Give the login credentials (user name "Kaa" and password "Kaa") to log in.
  • Copy the Kaa Sandbox Web UI host ( and paste it into the browser to browse the URL.

    Now, you can successfully access Kaa dashboard as shown in the below diagram:


Demonstrating a Sample Application

In this section, let's discuss a sample Kaa application in Kaa Sandbox.

This application sends temperature data at preset time periods from the endpoint to the server. A log appender is set up to collect data from the endpoint. In our use case, a MongoDB log appender is used.

The sample application is executed by:

  • Generating a Java SDK
  • Creating the log appenders
  • Launching the application
  • Fetching MongoDB logs from the appenders

Choosing the Application

The sample application here is named Data Collection Java Demo

Generating the SDK

To generate the SDK, perform the following:

  • Download the Java SDK – DataCollectionDemo.jar by clicking the Binary button in the diagram below:

data_collection_java_demoThe corresponding SDK component will be built or generated. You can also download Objective C, C++, and Android files for the Java SDK.

  • Click the Source button as shown in the above image to generate source code for the application as DataCollectionDemo.tar.gz.
  • Log into the Administration UI by entering the default credentials (username: admin and password: admin123).

kaa_admin_uiYou can add or delete the application and get the application token required to communicate with the endpoint and the server.

Note: Copy this application token to fetch the data from the logs, which is required in further steps.

Creating Log Appenders

Developer credentials (username: devuser and password: devuser123) were used for developing the applications by creating schemas, log appenders, client configuration, and so on.kaa_admin_ui2

MongoDB's log appender is used in this use case.

Note: You can also choose REST, File, Cassandra, Couchbase, Kafka, Oracle NoSQL, and Flume.

To create a log appender, perform the following:

  • Select the application name from the applications in the Administration UI.
  • Select Data collection demo --> Log appenders --> Add log appender --> MongoDB appender.


Launching the Application

Launch the application (.jar file) in a command prompt.

For example, C:\demo_app> java –jar DataCollectionDemo.jar  

Kaa will be automatically started and the data will be sent to logs by the log appenders as shown in this screenshot:kaa_log

Fetching Logs from MongoDB

To fetch logs from MongoDB, log into Kaa Sandbox and use the following command:

$ mongo kaa
$db.logs_<application_token>.find() ---- (copied application token in Generate SDK section to be enter here)


Visualizing Logs in MongoDB Compass

Connecting to Hostconnecting_to_host

Selecting Application Token


selecting_application_token1Applying Query

applying_queryViewing Startup Logviewing_startup_log

See how CEP engines, stream processing engines, flow based programming engines and other popular rule-based technologies perform against seven IoT-specific criteria.

kaa ,mongodb compass ,data visualization ,tutorial ,iot

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}