send_nsca
Marc Powell
marc at ena.com
Thu May 22 19:56:11 CEST 2008
On May 22, 2008, at 12:19 PM, Nair wrote:
> Can some one please help me in integrating send_nsca command with my
> Perl script for passive monitoring system.
>
> Say how can we integrate plugin output without writing to any file
> and then piping thru send_nsca.
>
In it's simplest form it's hardly different than the example shell
script in the Distributed Monitoring Documentation. Your perl script
will need to know the shortname and service description in nagios that
it's submitting a result for as well as the return code and text to
display. When all that is known a system call is all that's needed --
system("/bin/echo -e '$host_name\t$service_description\t$return_code\t
$outputtext\n' | /usr/local/nagios/bin/send_nsca <nagois_host> -p 5668
-c /usr/local/nagios/etc/send_nsca.cfg");
If you wanted to get more sophisticated you could open a pipe directly
from perl to send_nsca and send to it's STDIN which would eliminate
the slight overhead of the shell initiation. http://www.unix.com.ua/orelly/perl/cookbook/ch19_07.htm
has some safer options than a straight system call for this purpose.
--
Marc
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nagios-users mailing list
Nagios-users at 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
More information about the Users
mailing list