The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNOPSIS

    <LoadPlugin perl>
        Globals true
    </LoadPlugin>
    <Plugin perl>
        BaseName "Collectd::Plugin"
        LoadPlugin "Write::Message::Passing"
        <Plugin "Write::Message::Passing">
            # MANDATORY - You MUST configure an output class
            outputclass "ZeroMQ"
            <outputoptions>
                connect "tcp://192.168.0.1:5552"
            </outputoptions>
            # OPTIONAL - Defaults to JSON
            #encoderclass "JSON"
            #<encoderoptions>
            #   pretty "0"
            #</encoderoptions>
        </Plugin>
    </Plugin>

    Will emit 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":"GAUGE"
            },
            {
                "value":0.13,
                "min":0,
                "max":100,
                "name":"midterm",
                "type":"GAUGE"
            },
            {
                "value":0.08
                "min":0,
                "max":100,
                "name":"longterm",
                "type":"GAUGE"
            }
        ],
        "interval":10,
        "host":"t0m.local"
    }

DESCRIPTION

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

PACKAGE VARIABLES

%CONFIG

A hash containing the following:

outputclass

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

outputoptions

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

encoderclass

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

encoderoptions

The hash of options for the encoder class.

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 $OUTPUT

write

Writes a metric to the output in $OUTPUT.

BUGS

Never enters the AnyEvent event loop, and therefore may only work reliably with (and is only tested with) Message::Passing::Output::ZeroMQ.

AUTHOR, COPYRIGHT & LICENSE

See Message::Passing::Collectd.