[Nagios-users] ANNOUNCE: NSCA-ng 1.0

Holger Weiß holger-vuI+aYxVR0X31zTM6d8ziw at public.gmane.org
Mon Mar 18 22:11:54 CET 2013


* Tech Support <support-Qnfo8ztTn5vR92Hmh3tCeA at public.gmane.org> [2013-03-18 10:43]:
> I took one of my perl plugins and simply redefined the send_nsca binary
> and config file, while keeping everything else the same.
> 
> my $ETB = "\027";
> # If we want to use nsca-ng instead of nsca.
> $nscaprog = '/usr/local/sbin/send_nsca';
> $nscacfg  = '/usr/local/etc/send_nsca.cfg';
> ...
> ...
> foreach my $param ( @params ) {
>     my $service = "Sys Info - $param";
>     my $code    = $ERRORS{ OK      } if $stats->{ $param } ne $NULL;
>     $code       = $ERRORS{ UNKNOWN } if $stats->{ $param } eq $NULL;
>     my $message = "$param = $stats->{ $param }";
>     $nsca_cmd  .= "$nscahost\t$service\t$code\t$message\n$ETB";
> };
> # Now send all of the results to the Nagios host.
> my $retval = `$system /bin/echo -e "$nsca_cmd" | $nscaprog -H $nagioshost -c $nscacfg`;
> 
> But I'm getting the error:
> send_nsca: [FATAL] Input format incorrect, see the send_nsca(8) man page

This probably happens because echo adds a trailing newline character and
NSCA-ng's send_nsca interprets that as another check result (because
it's seperated from the previous result with an ETB character).  The
following commit lets send_nsca ignore such trailing newlines:

https://www.nsca-ng.org/cgi-bin/repository/nsca-ng/commit/?id=521c7d15

However, using "echo -n -e [...]" should do the trick.

Holger





More information about the Users mailing list