added manpage
authorHeiko Schlittermann (JUMPER) <hs@schlittermann.de>
Wed, 02 Nov 2011 18:03:01 +0100
changeset 4 f773a81fcff5
parent 3 a4b752ca44d7
child 5 3ce1738b5b5c
added manpage
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 <hs@schlittermann.de>
 # 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<send_nsca>.
+
+=head1 OPTIONS
+
+=over
+
+=item B<-H> | B<--hostname> I<hostname>
+
+The hostname to be sent along with the result. (defaults to the local
+host name).
+
+=item B<-S> | B<--servicename> I<servicename>
 
-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<hostname>
+
+The destination host (the host, where the NSCA listener is running).
+(no default).
+
+=item B<--nsca-port> I<port>
+
+The destination port. (default depends on the C<send_nsca> 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<mailto:hs@schlittermann.de>, the source can be
+found at L<https://ssl.schlittermann.de/hg/submit-via-nsca>.