How to Monitor Super SIM Connection Events using AWS ElasticSearch and Kibana
KORE Event Streams is a new, unified mechanism to help you track your application's interactions with KORE products. Event Streams spans KORE's product line to provide a common event logging system that supports product-specific event types in a consistent way. You use a single API to subscribe to the events that matter to you.
Super SIM provides a set of event types, called Connection Events, which are focused on devices' attempts to attach to cellular networks and, once they are connected, the data sessions they establish to send and receive information.
This tutorial will show you how to integrate Super SIM Connection Events into a typical business process: routing the data to AWS ElasticSearch so it can feed your Kibana dashboards. To do so, you'll set up Event Streams to send Super SIM Connection Events to an AWS Kinesis Data Stream and into ElasticSearch via AWS Kinesis Firehose.
If you'd prefer to start with a more basic guide to using Super SIM connection events, or your use-case doesn't require AWS, we have another tutorial that focuses on streaming Super SIM Connection Events to a webhook in your cloud.
With the AWS resources in place to read and feed events to Kibana, you'll explore probing the event data, setting up visualizations to help you spot underlying trends in the data, and configuring a dashboard so you're ready to monitor event data regularly.
This tutorial assumes you're working on a Linux box or a Mac, but it should also work under Windows if you're running Windows Subsystem for Linux. Whatever platform you're using, we'll take it as a given that you're familiar with the command line.
You don't need to have experience of working with AWS accounts and processes, unless you plan to change or upgrade the resources configured during the tutorial. All of the AWS setup required by the tutorial is driven by a script, so you can focus on the flow rather than keying in code or navigating the AWS console. The script is fully commented so you can understand exactly what is to be installed.
If you've already set up Event Streams for another KORE product, then you may prefer to jump straight to the documentation that describes the event types unique to Super SIM. No problem.
Let's get started.
1. Review the requirements
To work through this tutorial, you'll need your KORE API Client setup. If you don't have these credentials handy, you can get them from the Console. To learn more about KORE APIs, getting started guides are available for you.
You'll also need an AWS account set up with an AWS user that has resource creation permissions. You'll make use of these in Steps 2 and 3.
The tutorial creates and uses AWS resources, so please be aware that this will come at a cost to your AWS account holder. We've made sure we used as few and as limited resources as possible. For more details, check out AWS' pricing page.
You may also find that certain configurations are not available in your preferred AWS region, so you may need to modify the config you use accordingly. Make sure you thoroughly review the supersim_events.tf
script in Step 3, which has all the details of the config you'll use and will be where you'll make any changes you need.
2. Set up your machine
You may have already completed some of these tasks for other tutorials you have followed, or as part of your own workflow, so just skip those steps. For each step, we've linked to the relevant setup guide, so just jump straight there if you need further assistance then hop back here when you're done.
Setup and configure your KORE API Client using this guide.
Install and configure the AWS CLI. Amazon has full guidance for you.
Install the JSON processor JQ from its website. JQ is used to process data in a script you'll run shortly to validate the Events Stream Destination you set up.
Install the Terraform CLI. Terraform lets you build out infrastructure using code. Because this tutorial involves the creation of many AWS resources of various types, you'll use Terraform and a ready-to-go setup script to automate this process. Terraform's developer, Hashicorp, has a guide to get you started with the installation process — come back here as soon as you've installed the CLI tool — there's no need to go further.
3. Build out your AWS resources
In this step you'll put in place all of the AWS resources you need and connect them together so that they're ready to receive your Super SIM Connection Events and make them available to Kibana. You will create:
A Kinesis Data Stream as an entry point for Super SIM Connection Events.
An ElasticSearch domain to receive, store, and work with the events, which will be presented by Kibana.
A Kinesis Firehose to bridge the Data Stream and ElasticSearch.
An S3 Bucket as a store for records Firehose could not pass to ElasticSearch.
Assorted Roles and Policies to authorize KORE to write to your stream, and for the AWS components to interact with each other.
The entire set up process is automated using Terraform code-as-infrastructure technology and a script you'll download shortly. Feel free to review the script before you run it.
Open a terminal and run the following commands to prepare your working directory:
Copy the first of the three scripts below and save it to your
supersim_events
directory assetup_aws.sh
and then runchmod +x setup_aws
to make the script executable.You'll need to update the first line of the script with your preferred AWS region.
Get the second script, save it as
validate_sink.sh
, and runchmod +x validate_sink.sh
.Copy the third script and save it to your
supersim_events
directory assupersim_events.tf
. This does not need to be made executable. It is read by the Terraform CLI and used to build a setup scheme. You should review this script to make sure you're happy with its role and policy settings.Edit
setup_aws.sh
and set your AWS region where marked, eg.us-east-2
.You're now ready to put your AWS infrastructure into place. Remember, there is a cost implication for your account holder, which we've attempted to minimize by instantiating as few and as limited a set of AWS resources as possible. For more details, check out AWS' pricing page.
Run:
This script sets the variables Terraform will use and calls two Terraform CLI commands, one to check the
supersim_events.tf
script, and the other to build the infrastructure from the script, which it does via the AWS CLI. It will output what it is going to generate, and then ask you how you'd like to proceed. Review its plan, then type inyes
and hit Enter.As the AWS resources are created, you'll receive progress reports in the terminal, and then it will output some key data: the External ID value, the stream ARN, and the role ARN that you'll use to set up your KORE Events Stream Destination, and the URL you'll use to access Kibana. You'll need to keep all of these values handy for future steps.
If you subsequently make changes to your Terraform script, just run terraform apply
to see the changes Terraform will make and, if you agree, apply them. You don't need to run setup_aws.sh
again, but if you wish to, just make sure you replace the $(...)
section in line 3 with the external ID output on the first run. If you change the external ID, either via the script or manually, you will need to recreate your Destination.
Here are the scripts, or just jump to the next step.
You can also find all of these files in our public GitHub repo.
Script #1 — setup_aws.sh
Script #2 — validate_sink.sh
Script #3 — supersim_events.tf
4. Configure your KORE Event Streams
1 — Stream KORE Events to your AWS Kinesis instance
KORE Event Streams currently support two Destination types: AWS Kinesis and webhooks. In this guide, you're going to configure Event Streams to send events to your AWS Kinesis.
A quick guide on how to setup KORE Events to your AWS Kinesis is available through the AWS Kinesis Quick Start guide. The pre-requisite to use this guide is that you must already have your AWS Kinesis ARN
, Role ARN
, External ID
handy. Otherwise, you can use the script - create_kinesis_stream.sh
- to automate the creation for you.
2 — Validate your setup
AWS Kinesis Destination types need to be validated before events can be delivered to them, in contrast to Webhook Destination types. To validate a Destination, you need to tell the Destination that you want to test it. This automatically sends a test message to the Destination, which you'll then retrieve from the Destination itself and use to confirm that the Destination is operational. This validates your setup.
In one terminal tab or window, run the validate_sink.sh
script:
Next, send a Test event to your destination using the Console.
Switch back to yout terminal and you'll shortly see a block of JSON code. Look for the data
key and note the value of its nested test_id
key. You're done with the validation script, so hit Ctrl-c to quit from it.
Your Sink has been validated and is ready to receive Super SIM Connection Events.
We've included the Data Session Updated event because it will allow you to monitor your Super SIMs' data usage in Kibana, but please be aware that this event is emitted every six minutes for every Super SIM in your account so you can quickly use up your free event allowance. If this might be an issue for you, consider omitting the Data Session in your Streaming rule or you can tidy up using this guide.
5. Monitor events in Kibana
1 — Explore the data
The URL you use to access Kibana was output at the end of Step 3. If it's not still visible in your terminal, navigate to the working directory, run terraform show
, and scan the results for the kibana_endpoint
key — its value will give you the URL you need.
If you know your way around Kibana, you can jump out of the tutorial at this point if you wish. The remainder focuses on using Kibana to explore and chart the incoming Connection Events data. You should, however, check out the Super SIM Connection Events documentation, which describes the information contained within each event.
Staying with us? Good. Paste the Kibana URL into a browser and hit Enter.
Click on the hamburger menu at the top left and select Stack Management under Management.
Click on Create index pattern:
Under Index pattern name, enter
super-sim*
and then click Next Step.Under Time field, select data.timestamp, and then click Create Index Pattern. What you've done is establish the data fields Kibana can use and the particular field that it uses to track the flow and order of incoming events. Let's see what we can do with these events.
Click on the hamburger menu at the top left and select Discover under Kibana. This will show you the most recent records received. How recent is set by the date value at the top right of the screen; you can click this to change the time period in focus:
You can click Refresh to update the list of events, but it's better to click the calendar icon next to the date range, add a period under Refresh every, and then hit Start. This will refresh the data automatically:
At the left, under Available fields, is a selection of all the data types available in each Super SIM connection event. Scroll down a little and locate data.sim_iccid. Move your mouse over it to reveal a + symbol, which you should click.
The events are now segmented by each of your Super SIMs' ICCIDs. Look back at the left-hand list of data fields and add data.network.friendly_name to the table (click on the + that appears alongside it). You can now see the networks your SIMs have connected through:
Go to Available fields and add data.rat_type to the table. Now you can see what cellular technologies your devices used to connect:
Pick a Super SIM and move your mouse to one of its rows. You'll see + and - icons appear at the right of the data.sim_iccid column. Click the + and Kibana will show only events experienced by that SIM:
Filters like the one you just set up are listed above the chart; click on any filter's X symbol to clear it. You can do the same with column headings to remove them from the table. The << and >> symbols you'll see when you move your mouse over a column heading allow you to reorder the columns. If you like, click Save — it's in the menu at the top right — and save your search parameters for use again.
2 — Looking for patterns
Click on the hamburger menu at the top left and select Visualize under Kibana.
Click Create visualization.
In the New Visualization dialog, locate Vertical Bar (it's toward the bottom of the list) and select it.
Under New Line / Choose a source, click super-sim*.
You're going to visualize how much data each of your Super SIMs have downloaded. This will be the Y axis value; you'll list the SIMs on the X axis. First, click on Y-axis Count under Metrics. Then, under Aggregation, click Count, scroll down through the list of options and click Sum.
Click on Select a Field, start typing
down
, and select data.data_download when it's suggested:Click Add under Buckets. Click on X-axis in the pop-up that appears, and then, under Aggregation, click on Terms.
Click on the Field text field and start typing
icc
— Kibana will suggest data.sim_iccid.keyword, so select it:Click Update at the bottom right of the screen. You'll now see a chart showing how much data in bytes each Super SIM has downloaded:
Depending on the number of Super SIMs you have, you might need to adjust the Size setting under Buckets > X-axis, and the date range you're using (this works just the way you saw in Step 5.1).
Let's include upload data volumes too. Click Add under Metrics and select Y-axis. Under Aggregation, click Sum.
Under Field, click Select a field, start typing
upload
and select data.data_upload when it's suggested:Click Update. You'll see something like this:
Again, you might need to adjust the date range to see meaningful data.
3 — Build a dashboard
Setting up visualizations for occasional use is all very well, but what you really want to do is add them to a dashboard that you can check regularly. Let's do that now with the visualization you just made.
Click on **Save **at the top right. Give the visualization the name
Super SIM Data Usage
and click the Save button.Click on the hamburger menu at the top left and select Dashboard under Kibana.
Click Create new dashboard.
Kibana invites you to create a new dashboard widget — or "object" — but let's use the visualization you just created. Click Add in the menu at the top right, and under Add panels select Super SIM Data Usage — the visualization you just made.
Click the X in the top right of the panel to close it:
1.Click Save in the top right menu to save the dashboard so it's accessible next time you visit.
Next steps
Well done — you've come a long way. You've used Terraform to put in place your AWS infrastructure and then set up KORE Event Streams to first create a connection to your infrastructure, called a Sink. You've subscribed to a series of Super SIM Connection Events which have then begun to flow from KORE to your AWS setup as your IoT devices' Super SIMs connect to networks and transfer data.
You've used Kibana to explore the events data that has been received, from all your SIMs right down to single SIM, and you've learned how to create graphs to help you spot trends in your devices' data usage. You've added that graph to a dashboard you can use regularly to monitor the behavior of the devices in your fleet.
We've only just scratched the surface of what Kibana can do, but having real, meaningful data to work with — all those Super SIM Connection Events — will make it much easier to explore the rest to see how it can help your business.
Try adding some more visualizations to your dashboard that will help you understand which radio technologies your devices are using to connect.
Imagine you're fielding a support query from a customer. Drill down to examine how a specific Super SIM or small group of SIMs behaved around a certain point in time.
Want to know more? Kibana's developer, Elastic, has a bunch of tutorials which will walk you through common scenarios and help you grow your knowledge.
We can't wait to see what business intelligence tools you build with Super SIM Connection Events!
Last updated