This repository contains AppDynamics IoT C++ SDK that can be used in embedded applications to monitor network perfomance, errors and business metrics.
sdk
- C++ SDK source and headerssample
- Sample Application showing how to use the SDK to capture and send eventstests
- Unit Tests to test functionality of SDKdocs
- SDK API document built in html format using Doxygen.
- GNU C++ Compiler (g++) version 4.2 or above for 32/64-bit architectures
- Any Linux x86 distribution based on glibc 2.20+
- If using macOS - LLVM version 8.0.0 or above
- cmake version 3.0 or above
Before building the sdk, check if cmake is installed. If not, you can get it using package manager
$ sudo apt-get install cmake
$ cmake -v
Also, ensure your system has all the tools (g++, make, libc, git etc) to build c++ code. If not, you can install them using
$ sudo apt-get install build-essential
$ sudo apt-get install git
$ sudo apt-get install lcov
Note: lcov
version 1.13 or higher is needed.
On 32 bit machines, you might also need multilib
$ sudo apt-get install gcc-multilib g++-multilib
- cgreen - Tests are written using cgreen unit testing framework to verify SDK functionality. cgreen repo will be downloaded, compiled and linked to tests as part of build step.
- curl - Sample application uses curl to send events to Appdynamics IoT Collector
You can install curl and its headers using below commands:
$ sudo apt-get install curl
$ sudo apt-get install libcurl4-gnutls-dev
SDK has been built and tested on below platforms.
- Linux x86 32/64 bit architectures
- macOS 10.12 and above
SDK can be built on other platforms as long the compiler has support for ISO C++ standard C++98/C++03.
Below are the targets that can be built using this repository.
appdynamicsiotsdk
- SDK is built as a library(libappdynamicsiot) by default. The library and headers can be found in lib/ and include/ directories created when this target is built.sample
- Sample application is built as executablesample
by default.tests
- Tests are built as executable linking cgreen library.
All the targets can be built from root directory using the below commands.
$ git clone https://github.com/Appdynamics/iot-cpp-sdk.git
$ cd iot-cpp-sdk
$ mkdir build
$ cd build
$ cmake ..
$ make
if build
directory is created outside of the root directory, then pass the path of root directory to cmake command.
Only sdk and sample targets are built by default. To build tests, run
$ cmake .. -DBUILD_TESTS=1
$ make
If you want to build tests and enable code coverage, run
$ cmake .. -DENABLE_COVERAGE=1
Code coverage has a dependency on gcov
, lcov
& genhtml
.
If you want to build a 32 bit library on a 64 bit machine, set the flag DBUILD_32BIT
$ cmake .. -DBUILD_32BIT=1
$ make
You can also build individual targets using below commands
$ make appdynamicsiotsdk
$ make sample
$ make tests
You can run tests from the build
folder by using commands below
$ make ./run-tests
You can run a report on code coverage from the build
folder by using commands below
$ sudo make run-code-coverage
You can view the code coverage report from the build
folder by opening the
out/index.html
file
Best place to understand the usage of SDK is to run the sample application. Please refer README of sample application for steps to run.
Below are the steps to integrate and use SDK within your own application:
- Dynamically link SDK Library (libappdynamicsiot) to your application
- You can find the library
libappdynamicsiot
in lib/ folder once sdk target is built - If you are using cmake, refer to CMakeLists.txt within sample/ on how sdk library is linked
- You can find the library
- Copy and import SDK headers from include directory into your application
- Get EUM App Key and Collector URL
- Initialize SDK with App Key and Collector URL before adding and sending data
- Confirm IoT Data is reported to Collector
- SDK API docs - provides definition and implementation of SDK API
- REST API docs - provides payload structure sent to IoT Collector
- User Documents - provides overview on IoT monitoring capabilities
- Sample Application in other languages are available on github