Danijel Tašov > Nagios-Passive-v0.3.5 > Nagios::Passive::BulkResult

Download:
Nagios-Passive-v0.3.5.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Source   Latest Release: Nagios-Passive-v0.3.6

NAME ^

Nagios::Passive::BulkResult - submit passive check results to nagios' checkresult_dir in one file

SYNOPSIS ^

  my $bulk = Nagios::Passive::BulkResult->new(
    checkresults_dir => '/var/lib/nagios/checkresults',
  );
  for my $check (@checkresults) {
    my $nw = Nagios::Passive->create(
        checkresults_dir => undef, # the checkresults_dir key is required here
        service_description => $check->{service_description},
        check_name => $check_name,
        host_name  => $check->{hostname},
        return_code => $check->{code},
        output => 'looks (good|bad|horrible) | performancedata'
    );
    $bulk->add($nw);
  }
  $bulk->submit;

DESCRIPTION ^

Submitting a huge amount of results with Nagios::Passive::ResultPath has some limits. Typically a checkresult has a size of 200 bytes or so. But the blocksize of most filesystems is about 4K. So a file takes at least 4K of disk space.

Well, disk space is cheap and nagios deletes the file again after it has processed it, but most of the time the checkresults_dir is a memory filesystem. And suddenly you waste a lot of RAM. Also reading one large file is faster than reading thousands of small files.

Nagios can handle multiple check results within one file. This is what this Module provides. You just create a Nagios::Passive objects with an undefined checkresults_dir and add that object to the BulkResult container. When you are done, just call ->submit on the container and one big file is created.

syntax highlighting: