Skip to content

Latest commit

 

History

History

sample

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Sample Application using IoT C++ SDK

Overview

This sample application uses IoT C++ SDK to fill and send sample IoT data (Custom, Network and Error Events) to AppDynamics Collector. Sample Data reflects a Smart Car Application capturing usage information, network performance and errors.

Steps

  1. Build Sample Application using instructions given in README
  2. Get EUM App Key
  3. Run the Sample App
  4. Confirm IoT Data is reported to Collector
  5. To Customize Instrumentation review Getting Started and SDK API docs
  6. Refer to REST API docs for payload structure sent to IoT Collector

Run the Sample App

You can find the executable sample in the build folder

Below is usage information for the sample app. Provide AppKey as an input along with any options as needed.

USAGE: ./sample <appkey> [options]
options:
-collectorurl <url> Collector URL to which sdk will send events to.
-logfile <file>     Log file to which sdk log messages are written to.
-loglevel <level>   Log level set to one of the values:
                    1-error, 2-warn, 3-info, 4-debug, 5-verbose, 6-all.
-sendevent <event>  Sample event to be sent. Set to one of the following
                    event types: 1-custom, 2-network, 4-error, 7-all.
-url <url>          URL to trigger network request and capture network event.
-request <command>  Specify the request type to url. It is set to GET by default.
-data <data>        Data in JSON format that is to be sent in a POST request.
-help               Display available options

Below are the default values used by the sample app if above options are not given

DEFAULT PARAMS:
collectorurl = https://iot-col.eum-appdynamics.com
logfile = appd_iot_sdk.log
loglevel = 6
sendevent = 7

Here are some examples of using the sample app:

Display Usage Information

$ ./sample -h

Send Sample Custom, Network, and Error Events to default APPD Collector (https://iot-col.eum-appdynamics.com)

$ ./sample <appkey>

Send Sample Custom, Network, and Error Events to Custom Collector (http://localhost:9001)

$  ./sample <appkey> -c http://localhost:9001

Send Sample Custom, Network, and Error Events to Custom Collector (http://localhost:9001) and publish log messages to custom log file (mylog.log)

$  ./sample <appkey> -c http://localhost:9001 -f mylog.log

Send Sample Custom, Network, and Error Events to Custom Collector (http://localhost:9001) and publish log messages to mylog.log with loglevel set to warn

$  ./sample <appkey> -c http://localhost:9001 -f mylog.log -l 2

Send Sample Custom Event to Custom Collector (http://localhost:9001)

$  ./sample <appkey> -c http://localhost:9001 -s 1

Send Sample Network Event to Custom Collector (http://localhost:9001)

$  ./sample <appkey> -c http://localhost:9001 -s 2

Trigger POST Network Request to URL (http://yoururl.com) with data in JSON format. Capture and Send Network Event to Custom Collector (http://localhost:9001)

$  ./sample <appkey> -c http://localhost:9001 -s 2 -u http://yoururl.com -x POST -d '{"param1"="value1"}'

Send Sample Error Event to Custom Collector (http://localhost:9001)

$  ./sample <appkey> -c http://localhost:9001 -s 4