Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add some docs

  • Loading branch information...
commit 231d5d243aea1e2149721ac938dfd714b5a08365 1 parent 7056d1d
Danijel Tasov authored
Showing with 42 additions and 0 deletions.
  1. +4 −0 lib/Nagios/Passive.pm
  2. +38 −0 lib/Nagios/Passive/BulkResult.pm
4 lib/Nagios/Passive.pm
View
@@ -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>.
@@ -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
38 lib/Nagios/Passive/BulkResult.pm
View
@@ -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.
Please sign in to comment.
Something went wrong with that request. Please try again.