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->{status}."\n";
}

DESCRIPTION

This Perl Module implements Version 2 of the NRPE-Protocol. With this module you can execute

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

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:

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