Skip to content

Commit

Permalink
add some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Danijel Tasov committed Jan 12, 2012
1 parent 7056d1d commit 231d5d2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Nagios/Passive.pm
Expand Up @@ -62,6 +62,9 @@ If there is a key named
=back
If you're using checkresults_dir, you may also wan't to take a look at
L<Nagios::Passive::BulkResult>.
object ist created.
Other required keys are C<host_name> and C<check_name>.
Expand Down Expand Up @@ -147,6 +150,7 @@ likely to brake in the future.
Nagios::Passive::ResultPath interacts with an undocumented feature of Nagios.
This feature may disappear in the future.
(Well, that feature works for years now, so ....)
=head1 DEVELOPMENT
Expand Down
38 changes: 38 additions & 0 deletions lib/Nagios/Passive/BulkResult.pm
Expand Up @@ -40,3 +40,41 @@ sub submit {

1;
__END__
=head1 NAME
Nagios::Passive::BulkResult - submit passive check results to nagios' checkresult_dir in one file
=head1 SYNOPSIS
my $bulk = Nagios::Passive::BulkResult->new(
checkresults_dir => $command_file,
);
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;
=head1 DESCRIPTION
Submitting a huge amount of results with L<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 C<-E<gt>submit> on the container and one big file is created.

0 comments on commit 231d5d2

Please sign in to comment.