* Tech Support <supp...@voipbusiness.us> [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

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to