<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
John P. Rouillard wrote:<br>
<blockquote cite="mid200510281441.j9SEfSo9027516@mx1.cs.umb.edu" type="cite">
<pre wrap="">In message <a class="moz-txt-link-rfc2396E" href="mailto:4361E65E.4070902@aol.com"><4361E65E.4070902@aol.com></a>,
Rob Moss writes:
</pre>
<blockquote type="cite">
<pre wrap="">Marc Powell wrote:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">From: On Behalf Of Marcel Mitsuto Fucatu Sugano
Sent: Thursday, October 27, 2005 4:13 PM
Placed '<path_to_nagios>/var' available through a NFS partition,
and would like to spread webservers to reduce the load on CGIs at
the central nagios server. But the servers running the
web-interface cannot place commands to be executed by cmd.cgi, all
permissions are set correctly, and we still can't figure out what
we missed along the way.
</pre>
</blockquote>
<pre wrap="">Nagios uses a named pipe to receive external commands. Named pipes are
not supported over NFS so at best you'll end up with at read-only view
on the other hosts. We've done this in a similar fashion.
</pre>
</blockquote>
<pre wrap="">There is a way to do this without changing the nagios code..
Create the nagios.cmd fifo on each webserver in the expected location
/usr/local/nagios/var/nagios.cmd (or wherever the correct location is)
You will need to set up SSH keys to log in to the nagios server as the
nagios username
You can do a while loop on the nagios.cmd file from each webserver
#!/usr/bin/bash
nagioscmd="/usr/local/nagios/var/nagios.cmd"
ssh="/usr/bin/ssh"
nagiosserver=nagios.domain.com
while :; do
commandtxt=`cat $nagioscmd`
$ssh $nagiosserver "echo $commandtxt > $nagioscmd"
sleep 1
done
</pre>
</blockquote>
<pre wrap=""><!---->
I would do this in a read loop rather then using cat. A flurry of
commands could exceed the atomic write size on the real nagios
server. Other than that it looks good.
</pre>
</blockquote>
<br>
True, good point<br>
<br>
<pre wrap="">#!/usr/bin/bash
nagioscmd="/usr/local/nagios/var/nagios.cmd"
ssh="/usr/bin/ssh"
nagiosserver=nagios.domain.com
cat $nagioscmd | while read commandtext; do
$ssh $nagiosserver "echo $commandtxt > $nagioscmd"
sleep 1
done</pre>
<br>
<br>
That should just about do it..<br>
<br>
<br>
rob.<br>
<br>
</body>
</html>