The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Collectd::Plugin::Read::Message::Passing - Read collectd metrics via Message::Passing

SYNOPSIS

    # Only tested with 1 read thread!
    ReadThreads   1
    # You MUST setup types.db for all types you emit!
    TypesDB       "/usr/share/collectd/types.db"
    TypesDB       "/usr/local/share/collectd/types_local.db"
    <LoadPlugin perl>
        Globals true
    </LoadPlugin>
    <Plugin perl>
        BaseName "Collectd::Plugin"
        LoadPlugin "Read::Message::Passing"
        <Plugin "Read::Message::Passing">
            # MANDATORY - You MUST configure an output class
            inputclass "ZeroMQ"
            <inputoptions>
                socket_bind "tcp://192.168.0.1:5552"
            </inputoptions>
            # OPTIONAL - Defaults to JSON
            #decoderclass "JSON"
            #<decoderoptions>
            #</decoderoptions>
        </Plugin>
    </Plugin>

    Will consume metrics like this:

    {
        "plugin":"ElasticSearch",
        "time":1341656031.18621,
        "values":[
            {
                "value":0,
                "min":0,
                "name":"indices.get.time",
                "max":0,
                "type":0
            }
        ],
        "type":"indices.get.time",
        "interval":10,
        "host":"t0m.local"
    }

    or, for multi-value metrics:

    {
        "plugin":"load",
        "time":1341655869.22588,
        "type":"load",
        "values":[
            {
                "value":0.41,
                "min":0,"max":100,"name":"shortterm","type":1
            },
            {
                "value":0.13,
                "min":0,
                "max":100,
                "name": "midterm",
                "type":1
            },
            {
                "value":0.08
                "min":0,
                "max":100,
                "name":"longterm",
                "type":1
            }
        ],
        "interval":10,
        "host":"t0m.local"
    }

DESCRIPTION

A collectd plugin to consume metrics from Message::Passing into collectd.

WARNING: This plugin is pre-alpha, and is only tested with 1 collectd thread and the ZeroMQ Input.

NOTE: You MUST have registered any types you ingest in a types.db for collectd. Failure to do this can result in segfaults!

PACKAGE VARIABLES

%CONFIG

A hash containing the following:

inputclass

The name of the class which will act as the Message::Passing output. Will be used as-is if prefixed with +, otherwise Message::Passing::Input:: will be prepended. Required.

inputoptions

The hash of options for the input class. Not required, but almost certainly needed.

decoderclass

The name of the class which will act the Message::Passing decoder. Will be used as-is if prefixed with +, otherwise Message::Passing::Filter::Decoder:: will be prepended. Optional, defaults to JSON.

decoderoptions

The hash of options for the decoder class.

readtimeslice

The amount of time to block in Message::Passing's read loop. Defaults to 0.25 seconds, which could not be enough if you are consuming a lot of metrics..

FUNCTIONS

config

Called first with configuration in the config file, munges it into the format expected and places it into the %CONFIG hash.

init

Validates the config, and initializes the $INPUT

read

Blocks for a metric to the output in $INPUT.

BUGS

Blocking collectd for a fixed time to allow the AnyEvent loop to run is a horrible horrible way of reading.

AUTHOR, COPYRIGHT & LICENSE

See Message::Passing::Collectd.