Table of Content
Kaa is a highly flexible, open source middleware platform for Internet of Things (IoT) 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 about quick installation of Kaa Sandbox using Virtual Box environment and connecting a sample application with MongoDB log appenders.
- Download and install the following from the below link:
- 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 as shown in the below diagram:
- Download .ova file and provide proper location in the local system.
- Download VirtualBox platform packages.
In our use case, Windows hosts are used.
- Locate the two downloaded files in proper location for better understanding.
- Open the VirtualBox and go to File –> Import Virtual Appliance.
- Import the downloaded kaa-sandbox-0.10.0.1.ova file as shown in the below diagram:
- On clicking Next button, select proper configuration details such as Name, OS Type, CPU, RAM, and so on.
Note: Minimum of 4096 MB should be available to run in the environment.
- On verifying the configuration details, click Import to start the process.
- On completing the import process, start Kaa Sandbox in VM.
- Click Start arrow button to start the process as shown in the below diagram:
On 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 login to this virtual machine.
- Give log in credentials (user name “Kaa” and password “Kaa”) to log in.
- Copy Kaa Sandbox Web UI host (http://127.0.0.1:9080) and paste it into browser to browse the URL.
Now, you can successfully access Kaa dashboard as shown in the below diagram:
Demonstrating Sample Application
In this section, let us discuss about demonstrating a sample Kaa application in Kaa Sandbox.
This application sends temperature data at preset time period from the endpoint to the server. A Log appender is setup to collect data from the endpoint. In our use case, MongoDB log appender is used.
The sample application is executed by:
- Generating Java SDK
- Creating log appenders
- Launching the application
- Fetching MongoDB logs from the appenders
The sample application named Data Collection Java Demo is chosen.
To generate SDK, perform the following:
- Download Java SDK – DataCollectionDemo.jar by clicking Binary button in the below diagram:
The corresponding SDK component will be built or generated. You can also download Objective C, C++, and Android files for Java SDK.
- Click Source button as shown in the above image to generate source code for the application as DataCollectionDemo.tar.gz.
- Log in to Administration UI by entering the default credentials (username: admin and password: admin123).
You 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.
MongoDB log appender is used in this use case.
Note: You can also choose Rest, File, Cassandra, Couchbase, Kafka, Oracle NoSQL, and Flume.
To create 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.
Launch the application (.jar file) in 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 log appenders as shown in the below diagram:
Fetching Logs from MongoDB
To fetch logs from MongoDB, log in to Kaa Sandbox and use the below 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 Host
Selecting Application Token
Viewing Startup Log
In this blog, we discussed about basic steps to install Kaa Sandbox using Virtual Machine for Kaa project Internet of Things (IoT). We also discussed about executing the demo application by generating Java SDK, creating log appenders, launching the application, and fetching MongoDB logs from the appenders.
- Kaa: https://www.kaaproject.org/
- Kaa Getting started: https://kaaproject.github.io/kaa/docs/v0.10.0/Getting-started/
- Kaa IoT Development Platform Overview: https://www.kaaproject.org/overview/
- Your first Kaa application: https://kaaproject.github.io/kaa/docs/v0.10.0/Programming-guide/Your-first-Kaa-application/