Andreas Marschke > Nagios-NRPE-0.003 > Nagios::NRPE::Client

Download:
Nagios-NRPE-0.003.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.003   Source  

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

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Andreas Marschke <andreas.marschke@googlemail.com>.

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

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
  }
syntax highlighting: