Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

intelsdi-x/snap-plugin-lib-cpp

Repository files navigation

DISCONTINUATION OF PROJECT.

This project will no longer be maintained by Intel.

This project has been identified as having known security escapes.

Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.

Intel no longer accepts patches to this project.

Snap Plugin Library for C++ Build Status

This is a library for writing plugins in C++ for the Snap telemetry framework.

Snap has three different plugin types. For instructions on how to write a plugin check out the following links to example plugins:

Before writing a Snap plugin:

If you do decide to write a plugin, open a new issue following the plugin wishlist guidelines and let us know you are working on one!

Brief Overview of Snap Architecture

Snap is an open and modular telemetry framework designed to simplify the collection, processing and publishing of data through a single HTTP based API. Plugins provide the functionality of collection, processing and publishing and can be loaded/unloaded, upgraded and swapped without requiring a restart of the Snap daemon.

A Snap plugin is a program that responds to a set of well defined gRPC services with parameters and returns types specified as protocol buffer messages (see plugin.proto). The Snap daemon handshakes with the plugin over stdout and then communicates over gRPC.

Snap Plugin C++ Library Examples

You will find example plugins that cover the basics for writing collector, processor, and publisher plugins in the examples folder.

Building libsnap:

Dependencies:

Building GRPC from source

Plugin currently depends on GRPC 1.0.x, so if your OS's package repository contains another version, it won't be compatible. First, you need to install all dependencies except GRPC, then build GRPC 1.0.x from source.

To install GRPC 1.0.1:

git clone https://github.com/grpc/grpc
cd grpc
git checkout tags/v1.0.1
git submodule update --init
make
[sudo] make install

To install protobuf (Google Protocol Buffers):

Snap plugin library for C++ depends also on protobuf library. As it is already in GRPC dependencies, you can install it like:

cd ./third_party/protobuf
[sudo] make install

Once the above dependencies have been resolved:

$ ./autogen.sh
$ ./configure
$ make
$ [sudo] make install

autotools installs libsnap into /usr/local/lib, which not all linkers use when searching for shared objects. Using the --prefix=/usr switch when running the configure script will place the resulting libraries into /usr/lib, for example.

To clean up and rebuild use:

$ make clean
$ git clean -df  # warning! This deletes all dirs and files not checked in.  Be sure to check in any new files before running `git clean`.