Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

(perl) a POE Component that implements check_nrpe functionality

tag: 0.16

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 t
Octocat-spinner-32 Changes
Octocat-spinner-32 LICENSE
Octocat-spinner-32 MANIFEST
Octocat-spinner-32 MANIFEST.SKIP
Octocat-spinner-32 Makefile.PL
Octocat-spinner-32 README
README
NAME
    POE::Component::Client::NRPE - a POE Component that implements
    check_nrpe functionality

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.

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';
          'context', anything you like that'll fit in a scalar, a ref for instance;

        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;

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

    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/>
Something went wrong with that request. Please try again.