nagios.cmd over nfs

kyle.odonnell at gmail.com kyle.odonnell at gmail.com
Wed Jan 23 14:12:36 CET 2008


Success!

Web Server-
cmd.c

change:
fopen(command_file,"w")
to:
fopen("/path/to/cgi.pipe","a")

Nagios Server-

edit nagios startup script to:

start)
touch /path/to/cgi.pipe
tail -f /path/to/cgi.pipe > /path/to/nagios.cmd

stop)
rm /path/to/cgi.pipe



On 1/23/08, kyle.odonnell at gmail.com <kyle.odonnell at gmail.com> wrote:
> I was thinking of changing the cgi.cgi source to write to an actual
> file on the nfs mount, and then have tail -f nfswrittenfile.cmd-pipe >
> /path/to/nagios.cmd
>
> On 1/22/08, Thomas Guyot-Sionnest <dermoth at aei.ca> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On 22/01/08 03:38 PM, kyle.odonnell at gmail.com wrote:
> > > ... not so much
> > >
> > > It solves the web page spinning, but since nagios never picks up the
> > > data nothing happens.
> >
> > Yep. As it was already said on the thread fifos only works locally. It
> > implemented in the kernel, not in the FS code. The FS is only involved
> > in giving it a name and permissions (and this trivial task is properly
> > implemented by NFS: each server can use the pipe ... locally).
> >
> > A trivial (hacky) workaround could be using Netcat (nc):
> >
> > On the webserver:
> >
> > cat /path/to/nagios.cmd | nc <nagios_host> <some_port>
> >
> > On the Nagios server:
> >
> > nc -lp <some_port> >/path/to/nagios.cmd
> >
> > Since NC can die you should ideally run in with Daniel J Bernstein's
> > Daemontools:
> >
> > http://cr.yp.to/daemontools.html
> >
> > Also try in UDP mode (nc -u host post / nc -lup port) if you have
> problems.
> >
> >
> > The solution I'd go for though would be using Perl daemons for relaying
> > the commands using code similar to these daemons:
> >
> > http://www.nagioscommunity.org/wiki/index.php/OCP_Daemon#OCP_daemon_code
> > http://nagiosexchange.altinity.org/nagiosexchange/NPDaemon/
> >
> > It requires good Perl knowledge, especially since these daemons doesn't
> > include any non-blocking sending function. Since the command pipe isn't
> > much solicited you can just go blocking too (while (<FIFO>)/blocking
> > send on the web server, blocking listen/blocking write to the nagios
> > server), but make sure you implement timeouts with alarm() in the
> > network code to avoid jamming there.
> >
> > Thomas
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.6 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> >
> > iD8DBQFHlroF6dZ+Kt5BchYRAuhlAJ0SZ5RXPnXkRZGMHTaklNw8znQIVwCdHrah
> > EqhmEozdq4qLNeM8W0Ip3l0=
> > =BRMo
> > -----END PGP SIGNATURE-----
> >
>

-------------------------------------------------------------------------
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