NAME
    POE::Component::Client::NRPE - A POE Component that implements
    check_nrpe functionality

VERSION
    version 0.20

SYNOPSIS
       # A simple 'check_nrpe' version 2 clone
       use strict;
       use POE qw(Component::Client::NRPE);
       use Getopt::Long;

       $|=1;

       my $command;
       my $hostname;
       my $return_code;

       GetOptions("host=s", \$hostname, "command=s", \$command);

       unless ( $hostname ) {
            $! = 3;
            die "No hostname specified\n";
       }

       POE::Session->create(
            inline_states => {
                    _start =>
                    sub {
                       POE::Component::Client::NRPE->check_nrpe(
                            host    => $hostname,
                            command => $command,
                            event   => '_result',
                       );
                       return;
                    },
                    _result =>
                    sub {
                       my $result = $_[ARG0];
                       print STDOUT $result->{data}, "\n";
                       $return_code = $result->{result};
                       return;
                    },
            }
       );

       $poe_kernel->run();
       exit($return_code);

DESCRIPTION
    POE::Component::Client::NRPE is a POE component that implements version
    1 and version 2 of the nrpe (Nagios Remote Plugin Executor) client,
    check_nrpe. It also supports SSL encryption using Net::SSLeay and a
    hacked version of POE::Component::SSLify.

NAME
    POE::Component::Client::NRPE - a POE Component that implements
    check_nrpe functionality

CONSTRUCTOR
    check_nrpe
        Takes a number of parameters:

          'host', the hostname or IP address to connect to, mandatory;
          'event', the event handler in your session where the result should be sent, mandatory;
          'session', optional if the poco is spawned from within another session;
          'port', the port to connect to, default is 5666;
          'version', the NRPE protocol version to use, default is 2;
          'usessl', set this to 0 to disable SSL support with NRPE Version 2, default is 1;
          'command', the command to run remotely, default is '_NRPE_CHECK';
          'args', any arguments to be passed along with the 'command';
          'context', anything you like that'll fit in a scalar, a ref for instance;
          'timeout', number of seconds to wait for socket timeouts, default is 10;
          'unknown', set this to true to make the poco return socket timeouts as UNKNOWN instead of CRITICAL;

        The 'session' parameter is only required if you wish the output
        event to go to a different session than the calling session, or if
        you have spawned the poco outside of a session.

        The poco does it's work and will return the output event with the
        result.

OUTPUT EVENT
    This is generated by the poco. ARG0 will be a hash reference with the
    following keys:

      'version', the NRPE protocol version;
      'host', the hostname given;
      'command', the command that was run;
      'context', anything that you specified;
      'result', the Nagios result code, can be 0,1,2 or 3;
      'data', what the NRPEd gave us by way of output;

ACKNOWLEDGEMENTS
    This module uses code derived from
    <http://www.stic-online.de/stic/html/nrpe-generic.html> Copyright (C)
    2006, 2007 STIC GmbH, http://www.stic-online.de

SEE ALSO
    POE

    POE::Component::SSLify

    <http://www.nagios.org/>

AUTHOR
    Chris Williams <chris@bingosnet.co.uk>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2012 by Chris Williams, Apocalypse, Rocco
    Caputo and STIC GmbH..

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.