NAME

POE::Component::Client::BigBrother - a POE Component for sending Big Brother commands

VERSION

Version 0.01

SYNOPSIS

use strict;
use POE qw< Component::Client::BigBrother >;

POE::Session->create(
    inline_states => {
        _start => sub {
            POE::Component::Client::BigBrother->send(
                host    => $bbhost,
                event   => "_result",
                command_type    => "status",
                command_fields  => {
                    host        => "front01.domain.net",
                    service     => "cpu",
                    color       => "red",
                    message     => "load average is 105.45",
                },
            );
        },
        _result => sub {
            my $result = $_[ARG0];
        },
    },
);

DESCRIPTION

POE::Component::Client::BigBrother is a POE component which can be used to send commands to a Big Brother server.

This module tries to follow POE::Component::Client::NSCA API whenever possible.

METHODS

send()

Parameters

  • host

    (mandatory) Big Brother server name

  • port

    (optional) Big Brother server port, default 1984

  • timeout

    (optional) number of seconds to wait for socket timeouts, default is 10

  • retry

    (optional) number of times to retry connecting after an error, default is 2

  • event

    (mandatory) the event handler in your session where the result should be sent

  • session

    (optional) your session name, in case this component is from from within another session

  • command_type

    (mandatory) command type, must be one of status, page, enable, disable, event

  • command_fields

    (mandatory) command fields, must be a hash reference, with the appropriate fields; see "COMMANDS"

COMMANDS

status and page commands

  • host

    (mandatory) the host name this command applies to

  • service

    (mandatory) the service name this command applies to

  • color

    (mandatory) the color (result) of this command, must be one of: green, yellow, red

  • message

    (mandatory) the message body of this command

  • offset

    (optional) the offset of this command

disable command

  • host

    (mandatory) the host name this command applies to

  • service

    (mandatory) the service name this command applies to

  • message

    (mandatory) the message body of this command

  • duration

    (mandatory) the period of time during which the service is to be disabled

  • offset

    (optional) the offset of this command

enable command

  • host

    (mandatory) the host name this command applies to

  • service

    (mandatory) the service name this command applies to

  • message

    (mandatory) the message body of this command

  • offset

    (optional) the offset of this command

event command

  • host

    (mandatory) the host name this command applies to

  • service

    (mandatory) the service name this command applies to

  • id

    (mandatory) the event message ID; should be unique

  • activation

    (optional) the activation time as a Unix timestamp; defaults to the current time

  • expiration

    (optional) the expiration time as a Unix timestamp

  • escalation

    (optional) the escalation time as a Unix timestamp

  • color

    (mandatory) the color of this event message

  • escalation_color

  • title

  • message

  • default

  • order

  • persistence

  • suppress

  • suppress_id

  • suppress_if_non_defaults

OUTPUT EVENT

This event is generated by the component. ARG0 will be a hash reference with the following keys:

  • host

    the hostname given

  • message

    the message that was sent

  • context

    anything that you specified

  • success

    indicates that the check was successfully sent to the NSCA daemon

  • error

    only exists if something went wrong

DIAGNOSTICS

'%' command requires a '%' field

(E) The caller did not provide the indicated field for the given command.

%s requires a '%s' parameter

(E) The caller did not provide the indicated parameter to the component.

Could not resolve 'session' to a valid POE session

(E) The value of the given session parameter could not be resolved to a running POE session.

Unknown command type '%'

(E) An illegal value was given for the command_type parameter.

AUTHOR

Sébastien Aperghis-Tramoni, <sebastien at aperghis.net>

BUGS

Please report any bugs or feature requests to bug-poe-component-client-bigbrother at rt.cpan.org, or through the web interface at https://rt.cpan.org/Public/Dist/Display.html?Name=POE-Component-Client-BigBrother. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc POE::Component::Client::BigBrother

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2010 Sébastien Aperghis-Tramoni.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.