All Projects → bmhatfield → riemann-sumd

bmhatfield / riemann-sumd

Licence: MIT license
Agent for scheduling event generating processes and sending the results to Riemann

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to riemann-sumd

hasses
Hyper's Asynchronous Server Sent event (SSE) notification Server
Stars: ✭ 18 (-62.5%)
Mutual labels:  daemon
funcd
Daemon for functional keys (works without X11)
Stars: ✭ 14 (-70.83%)
Mutual labels:  daemon
php-daemon
Easily daemonize PHP scripts
Stars: ✭ 70 (+45.83%)
Mutual labels:  daemon
final-pm
Finally a good node.js process manager.
Stars: ✭ 21 (-56.25%)
Mutual labels:  daemon
vps host server
VPS Hosting Server Daemon for provisioning, monitoring, and communications with the central system.
Stars: ✭ 12 (-75%)
Mutual labels:  daemon
Swatch
Watcher for Unit Tests written in Swift
Stars: ✭ 55 (+14.58%)
Mutual labels:  daemon
shinit
Basic Init Daemon in POSIX sh
Stars: ✭ 17 (-64.58%)
Mutual labels:  daemon
rsync
gokrazy rsync
Stars: ✭ 308 (+541.67%)
Mutual labels:  daemon
GChan
Scrape boards and threads from 4chan (8kun WIP). Downloads images, videos and HTML if desired.
Stars: ✭ 31 (-35.42%)
Mutual labels:  daemon
haaukins
A Highly Accessible and Automated Virtualization Platform for Security Education
Stars: ✭ 148 (+208.33%)
Mutual labels:  daemon
python-riemann-client
A Riemann client and command line tool
Stars: ✭ 38 (-20.83%)
Mutual labels:  riemann
rescrobbled
MPRIS music scrobbler daemon
Stars: ✭ 152 (+216.67%)
Mutual labels:  daemon
bustd
Process killer daemon for out-of-memory scenarios
Stars: ✭ 182 (+279.17%)
Mutual labels:  daemon
v-switch
Virtual Encrypted Switch across the network, using UDP + AES + TAP
Stars: ✭ 27 (-43.75%)
Mutual labels:  daemon
dohd
Very fast DNS-over-HTTPS to DNS proxy with emphasis on privacy (no logging)
Stars: ✭ 14 (-70.83%)
Mutual labels:  daemon
ShellRemoteBot
Shell remote control from telegram (SSH/terminal emulator)
Stars: ✭ 28 (-41.67%)
Mutual labels:  daemon
npshell
Command line music queue manager. A music player from the comfort of your own shell.
Stars: ✭ 15 (-68.75%)
Mutual labels:  daemon
Minerva-Debugger
Providing a great interface to the iOS kernel, hardware, threads and processes in a great research environment. (WIP)
Stars: ✭ 23 (-52.08%)
Mutual labels:  daemon
SampleOSXLaunchDaemon
A simple launch daemon for macOS which communicates with a client application via XPC
Stars: ✭ 37 (-22.92%)
Mutual labels:  daemon
gon2n
Go bindings, management daemons and CLIs for n2n edges and supernodes.
Stars: ✭ 67 (+39.58%)
Mutual labels:  daemon

Riemann-sumd

Python agent for scheduling event generating processes and sending the results to Riemann

What?

Riemann-sumd is an agent for scheduling 'tasks', such as commands that conform to the Nagios plugin interface, and sending the results to Riemann. There are multiple task interfaces, such as the Nagios plugin interface, a JSON interface over stdout, and a JSON interface from arbitrary URLs.

Why?

While configuring my Riemann install, I noticed that the already-built clients were single-purpose daemons that sent their own events to Riemann. To operationalize such a thing, I'd have to deploy and monitor and maintain a fleet of little processes, which I was not interested in doing. In addition, I'd have to create additional little monitoring daemons that reproduce this functionality.

Instead, I decided that I'd prefer to have a small daemon that scheduled customizable tasks to run, and transformed their output into Riemann events. Additionally, I realized that there's a wealth of monitoring scripts out there that cohere quite nicely to the concept of a Riemann event: Nagios checks! If one could run a Nagios check, capture the return code, and send it (and the check's output and performance data) to Riemann as an event, that could be quite useful!

Configuration

It's a simple daemon with the capability to perform a few different 'types' of tasks on a schedule.

  • nagios: Nagios style tasks (IE; return 0 for OK, 2 for CRITICAL, etc)
  • json: JSON style tasks (Execute a command that returns a JSON list of events over stdout)
  • http_json: JSON retrieved over HTTP (See below for schema)
  • Deprecated: cloudkick: Has been renamed to http_json

The configuration aims to be dead simple: in a /etc/riemann/tasks.d/ directory, create SOMETASK.task with the following YAML-style fields:

# Required
service: "Random State"
arg: 'bash -c "exit $((RANDOM % 4))"'
type: "nagios"

# If omitted, defaults to 60s
ttl: 60

# If omitted, defaults to empty set
tags: ['flapper', 'notify']


# If omitted, defaults to system's hostname
host: "myhost.example.com"

# Set arbitrary attributes, optional
attributes:
	window-size: 3
	contact-email: "[email protected]"

# Assign a specific 'performance data' key to be the 'metric' for the event.
# Must be prepended with "task_", all others will be added as attributes on the event.
# If omitted, the first performance data pair returned by the check is used
metric: task_load5

# Set a grace period on the events sent to Riemann before the expired.
# If omitted, defaults to 5.
ttl_multiplier: 5

# Set a note to be prepended to the description attached to the event. Defaults to ""
note: "SOMERANDOMSTRING" (also settable per-item in cloudkick.json)

Internal Notes

Internally, the scheduler calculates the task's skew, and schedules the next event of this task to run at now + offset - skew. When that deadline is near, the scheduler returns the task, which is started in a subprocess and added to a queue to be examined later. A pool of worker threads pull the next already-running task off the queue, join it, wait for it to complete, and send the results to Riemann.

Dependencies

YAML parser
http://pyyaml.org/wiki/PyYAML
Ubuntu: python-yaml
import yaml

Daemonizing library - implements unix daemon functionality nicely
http://pypi.python.org/pypi/python-daemon/
Ubuntu: python-daemon
import daemon

Riemann client library, depends on 'protobuf'
https://github.com/banjiewen/bernhard
Ubuntu: python-protobuf
Ubuntu: -does not exist-
import bernhard

Requests
http://docs.python-requests.org/en/latest/
Ubuntu: python-requests
import requests

Nagios Plugin Interface

For documentation about the Nagios Plugin Interface, see the Plugin Interface Documentation and the Performance Data Format

HTTP JSON Interface

The JSON structure should contain an entry for each event, as well as metrics and other data:

{
   "status":"All systems go",
    "state":"ok",
    "enabled":true,
    "metrics":[
        {
            "name":"Some Queue Count",
            "state":"ok",
            "value":0,
            "warn_threshold":4500,
            "error_threshold":9000
        },
        {
            "name":"Other Queue Count",
            "state":"ok",
            "value":38,
            "warn_threshold":4500,
            "error_threshold":9000
        }
    ]
}

Packaging riemann-sumd

You can package riemann-sumd for debian using bdist_deb:

python setup.py --command-packages=stdeb.command bdist_deb

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].