NAME

Nagios::NRPE::Client - A Nagios NRPE client

SYNOPSIS

use Nagios::NRPE::Client;

my $client = Nagios::NRPE::Client->new( host => "localhost", check => 'check_cpu');
my $response = $client->run();
if(defined $response->{error}) {
  print "ERROR: Couldn't run check " . $client->{check} . " because of: " . $response->{reason} . "\n";
} else {
  print $response->{buffer}."\n";
}

DESCRIPTION

This Perl Module implements Version 2 and 3 of the NRPE-Protocol. With this module you can execute checks on a remote server.

COPYRIGHT AND LICENSE

This software is copyright (c) 2013-2018 by the authors (see AUTHORS file).

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

SUBROUTINES

new()

Constructor for the Nagios::NRPE::Client Object

example

my $client = Nagios::NRPE::Client->new( host => "localhost", check => 'check_cpu');

Takes a hash of options:

*  host => <hostname or IP>

The hostname or IP on which the NRPE-Server is running

* port => <Portnumber>

The port number at which the NRPE-Server is listening

* timeout => <number in seconds>

Timeout for TCP/IP communication

* arglist => ["arg","uments"]

List of arguments attached to the check

* check => "check_command"

Command defined in the nrpe.cfg on the NRPE-Server

* ssl => 0,1

Use or don't use SSL

create_socket()

Helper function that can create either an INET socket or a SSL socket

run()

Runs the communication to the server and returns a hash of the form:

my $response = $client->run();

The output should be a hashref of this form for NRPE V3:

{
  version => NRPE_VERSION,
  type => RESPONSE_TYPE,
  crc32 => CRC32_CHECKSUM,
  code => RESPONSE_CODE,
  alignment => PACKET_ALIGNMENT,
  buffer_length => OUTPUT_LENGTH,
  buffer => CHECK_OUTPUT
}

and this for for NRPE V2:

{
  version => NRPE_VERSION,
  type => RESPONSE_TYPE,
  crc32 => CRC32_CHECKSUM,
  code => RESPONSE_CODE,
  buffer => CHECK_OUTPUT
}

COPYRIGHT AND LICENSE

This software is copyright (c) 2013-2018 by the authors (see AUTHORS file).

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