All Projects → algernon → riemann-c-client

algernon / riemann-c-client

Licence: other
A C client library for the Riemann monitoring system.

Programming Languages

c
50402 projects - #5 most used programming language
Roff
2310 projects
M4
1887 projects
Makefile
30231 projects
shell
77523 projects
clojure
4091 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to riemann-c-client

galileo
Scala Math - Numerical (Matlab-like) and Symbolic (Mathematica-like) tool
Stars: ✭ 62 (+100%)
Mutual labels:  riemann
riemannx
A riemann client for elixir (TCP/UDP/TLS supported)
Stars: ✭ 23 (-25.81%)
Mutual labels:  riemann
katja
A simple Riemann client written in Erlang.
Stars: ✭ 28 (-9.68%)
Mutual labels:  riemann
alerta-contrib
Contributed integrations, plugins and custom webhooks
Stars: ✭ 107 (+245.16%)
Mutual labels:  riemann
riemann-sumd
Agent for scheduling event generating processes and sending the results to Riemann
Stars: ✭ 48 (+54.84%)
Mutual labels:  riemann
python-riemann-client
A Riemann client and command line tool
Stars: ✭ 38 (+22.58%)
Mutual labels:  riemann
Riemann
A network event stream processing system, in Clojure.
Stars: ✭ 4,099 (+13122.58%)
Mutual labels:  riemann

Riemann C client library

CI status License

This is a C client library for the Riemann monitoring system, providing a convenient and simple API, high test coverage and a copyleft license, along with API and ABI stability.

The library uses semantic versioning.

Breaking changes

This is a new major version of the library, with breaking changes compared to the previous versions. While it is API-compatible still, the ABI has changed, and any application or library built upon this will need to be recompiled. For production use, go with an existing stable release instead.

Features

  • Sending events over TCP, TLS and UDP
  • Launching queries (TCP & TLS only)
  • Support for tags and attributes on events
  • Ability to send multiple events in a single message
  • Convenient and straightforward API (see the API docs and the demo below!)
  • A comprehensive test suite
  • API and ABI stability (including symbol versioning on platforms where it is available), to the extent possible.

Demo

A simple program that sends a static event to Riemann is included below. A few more useful programs are included in the src directory of the source code.

#include <riemann/riemann-client.h>
#include <riemann/simple.h>

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int
main (void)
{
  riemann_client_t *client;
  riemann_message_t *r;

  client = riemann_client_create (RIEMANN_CLIENT_TCP, "localhost", 5555);
  if (!client)
    {
      fprintf (stderr, "Error while connecting to Riemann: %s\n",
               strerror (errno));
      exit (EXIT_FAILURE);
    }

  r = riemann_communicate_event
    (client,
     RIEMANN_EVENT_FIELD_HOST, "localhost",
     RIEMANN_EVENT_FIELD_SERVICE, "demo-client",
     RIEMANN_EVENT_FIELD_STATE, "ok",
     RIEMANN_EVENT_FIELD_TAGS, "demo-client", "riemann-c-client", NULL,
     RIEMANN_EVENT_FIELD_NONE);

  if (!r)
    {
      fprintf (stderr, "Error while sending message: %s\n", strerror (errno));
      exit (EXIT_FAILURE);
    }

  if (r->ok != 1)
    {
      fprintf (stderr,  "Error communicating with Riemann: %s\n",
               (r->error) ? r->error : strerror (errno));
      exit (EXIT_FAILURE);
    }

  riemann_message_free (r);
  riemann_client_free (client);

  return EXIT_SUCCESS;
}

Installation

The library follows the usual autotools way of installation:

$ git clone https://git.madhouse-project.org/algernon/riemann-c-client.git
$ cd riemann-c-client
$ autoreconf -i
$ ./configure && make && make check && make install

For the build to succeed, one will need libtool 2.2+ (only if building from a git checkout), the protobuf-c compiler. Optionally, for TLS support, one needs either GnuTLS 3.3+ or wolfSSL 4.6+, and to enable the JSON output support in riemann-client, one also needs the json-c library installed.

From this point onward, the library is installed and fully functional, and one can use pkg-config to compile programs against it:

${CC} $(pkg-config --cflags --libs riemann-client) demo.c -o demo -Wall

If, for some reason the build fails, one may need to regenerate the protobuf-c-compiler generated headers (changes in the compiler are known to cause issues). To do this, do a make distclean first, and then start over from configure.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].