[Web-Interface] CGI load workaround solution(s)
Rob Moss
robmossrm at aol.com
Fri Oct 28 17:11:47 CEST 2005
John P. Rouillard wrote:
>In message <4361E65E.4070902 at aol.com>,
>Rob Moss writes:
>
>
>>Marc Powell wrote:
>>
>>
>>>>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.
>>>>
>>>>
>>>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.
>>>
>>>
>>>
>>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
>>
>>
>
>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.
>
>
True, good point
#!/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
That should just about do it..
rob.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20051028/2cfc5f75/attachment.html>
More information about the Users
mailing list