How to pass business data from the device to AiKaan dashboard

Hi,

How do I pass on business data from the device to the AiKaan dashboard?

Steps to generate Business Telemetry

  1. Create a scripts/telemetry directory in /opt/aikaan folder

  2. Write the shell script inside the /opt/aikaan/scripts/telemetry folder

  3. Provide executable permission (chmod +x businessTele.sh)

  4. Now select the proper telemetry in the Visualization sub-tab of the devices page

Ref: https://gitlab.com/AiEdge/AiCon/-/blob/develop/ReleaseNotes.md (Version 2.25.1)

Sample Shell Script:

businessTele.sh

#!/bin/bash
echo fieldkey=test1
x=$(shuf -i 0-30 -n 1)
echo value=$x

echo unit=t

2 Likes

I followed the above steps, but Business Telemetry still shows no sufficient data. Am I missing something here?

Hi @Priya,
Verify whether the script file (businessTele.sh) is executable. You can check it by executing the command /opt/aikaan/scripts/telemetry/businessTele.sh


Also, verify that you have selected the correct business telemetry name on the Visualizations page.

Thanks for the quick reply, the script is executable. I don’t see any options listed down below

@Priya, As communicated over mail, the script file should contain 3 keys

  1. fieldkey
  2. value
  3. unit
    The business telemetry script gets executed at regular intervals. Hence it is not necessary to use any looping statements.

@shreeram, thanks it worked. However, when I pass multiple (fieldkey, value, unit) pairs in a single script I see only the first telemetry data getting updated. Is this an intended behaviour? Also, is it possible to execute the script at user defined intervals say, 1 min instead of 3 min.

@siddharthmunot @shreeram Would be grateful, if you could provide some clarity on the same. Also is there any documentation available for reference?

@Priya,
Apologies for the delayed response.

  • 1 script file can have a single fieldkey, value, and unit. You can create as many scripts as you wish.
  • The scripts could be executed at user-defined intervals but the interval ENV variables should be set at the server level. This part is not yet opened up for the end-user.
  • There is no standard documentation available as of now.

Hi,
Continuing on this topic, would it be possible to send business telemetry

  1. Via a python/C++ script?
  2. As an object, as opposed to an integral value like float or int?

Thanks,
Varshini

Hi @varshmail7,

The interface for the business telemetry is text. We do not accept binary, hence we can not accept objects. You can use Python script for example. The script when executed must generate 2 key-value pairs, ref How to pass business data from the device to AiKaan dashboard

@chetansk, thank you for your reply

Here’s my simple python script:

#!/usr/bin/python

fieldkey='battery'
value= 10
unit='percentage'

I do not see any data under business telemetry. (I tried with a bash script, and that works)
Is there something wrong with the python script?

Hi @varshmail7,

This should definitely work. In order to debug, can you please confirm you are able to run this script on the device and you get the results? Sometimes the interpreter (#!/bin/… ) path might be different on the device vs your dev environment.

Thanks
C

Hi @chetansk

Yes, I can run the script on my device. It is executable and is located in the /opt/aikaan/scripts/telemetry folder.

Hi @varshmail7,
As mentioned in the sample shell script, the 3 keys are echoed finally. Please use the same format of echoing keys and their respective values in your python script as shown below:

#!/usr/bin/python

fieldkey='battery'
value=10
unit='percentage'
print ("fieldkey="+fieldkey);
print ("value="+str(value));
print ("unit="+unit);
2 Likes

@shreeram thanks a lot, it worked!

1 Like