diff -r a4b752ca44d7 -r f773a81fcff5 submit-via-nsca.pl --- a/submit-via-nsca.pl Wed Nov 02 17:52:43 2011 +0100 +++ b/submit-via-nsca.pl Wed Nov 02 18:03:01 2011 +0100 @@ -2,7 +2,7 @@ # © 2011 Heiko Schlittermann # source: https://ssl.schlittermann.de/hg/check-by-nsca -use 5.010; + use strict; use warnings; use Sys::Hostname; @@ -32,7 +32,7 @@ "nsca-host=s" => \$o{nsca_host}, "p|nsca-port=i" => \$o{nsca_port}, "h|help" => sub { pod2usage(-verbose => 1, -exit => 0) }, - "man" => sub { + "m|man" => sub { pod2usage( -verbose => 2, -exit => 0, @@ -40,7 +40,7 @@ ); }, "d|debug" => \$o{debug}, - ) or pod2Usage(); + ) or pod2usage(); my $cmdline = "send_nsca -H '$o{nsca_host}'" @@ -70,15 +70,53 @@ __END__ -set +e +=head1 NAME + + submit-via-nsca - submit service, or host check results via nsca + +=head1 SYNOPSIS + + submit-via nsca --nsca-host {host} [options] -- {check} [check-options] + +=head1 DESCRIPTION -output=$("$@") -rc=$? +This simple script submits the result of nagios check plugins to an NSCA +receiver. The script does not send the result itself, it's merely a +wrapper around C. + +=head1 OPTIONS + +=over + +=item B<-H> | B<--hostname> I + +The hostname to be sent along with the result. (defaults to the local +host name). + +=item B<-S> | B<--servicename> I -test "$svcname" || svcname="${output%% *}" +The servicename to be sent along with the result. If a single "-" (dash) +is used, the servicename is guessed from service check output, if "" +(empty), a host check is submitted. (default: "-") + +=item B<--nsca-host> I + +The destination host (the host, where the NSCA listener is running). +(no default). + +=item B<--nsca-port> I + +The destination port. (default depends on the C utility) -tab=$'\x09' -echo "$hostname$tab$svcname$tab$rc$tab$output" \ - | $send -H "$nsca_host" ${nsca_port:+-p $nsca_port} +=item B<-h> | B<--help> + +=item B<-m> | B<--man> + +The long or short help text. -# vim:sts=4 sw=4 aw ai sm et: +=back + +=head1 AUTHORS + +Heiko Schlittermann L, the source can be +found at L.