[Web-Interface] CGI load workaround solution(s)

Marcel Mitsuto Fucatu Sugano msugano at uolinc.com
Sun Oct 30 12:18:09 CET 2005


Thank you both for your clarifying answers....

But...

On Fri, 2005-10-28 at 09:50 +0100, Rob Moss wrote:
> Marc Powell wrote:
> > > -----Original Message-----
> > > From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> > > admin at lists.sourceforge.net] On Behalf Of Marcel Mitsuto Fucatu Sugano
> > > Sent: Thursday, October 27, 2005 4:13 PM
> > > To: nagios-users at lists.sourceforge.net
> > > Subject: [Nagios-users] [Web-Interface] CGI load workaround
> > > 
> > > Hi,
> > > 
> > > 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.
> > > 
> > > Does anyone know any documentation, or links to, or any thought about
> > > this situation?
> > >     
> > 
> > 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.
> > 
> > Purely speculating, it may be possible to specify a path to the command
> > file that is unique to each machine then write a small daemon that
> > creates the pipe on each machine, reads the external commands and ships
> > them off to the master server for insertion there. Sort of like NSCA but
> > for external commands. I am not aware of any work that has been done
> > like that though. That seems like it might be an interesting project to
> > enhance the scalability of Nagios.
> > 
> > The alternative of course is to change the way that Nagios receives
> > external commands to be NFS friendly. I believe there may be compelling
> > reasons to stick with a named pipe however.
> >   
> 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
> 
> 
> This is write-only, which I think is okay.. I don't think the
> nagios.cmd needs to write anything back to the client cgi.
> 
> There is room for error trapping, such as sending email alerts if the
> SSH connection fails..
> 
> There is another way that I have thought of, probably a little more
> reliable but a lot more work.
> 
> Create a Perl script, client/server app which constantly reads the
> nagios.cmd file on each webserver, and a server counterpart which
> listens on a TCP port and writes in to the nagios.cmd fifo on the
> server.
> - On the client application, when there is data to write by a
> webserver, open a TCP connection to the nagios server and write the
> output.
> - On the server application, every time there is a new connection
> check it against a list of valid IP addresses and perhaps some other
> auth (secret key or something). Then write into the nagios.cmd fifo.
> 
> You could go for a UDP connection instead of TCP, but UDP is
> unreliable by design.
> 
> Cheers
> rob.

We ended up by piping the content of nagios.cmd to send_nsca, and with a
little modification on nsca, we managed it to write the named pipe. It
is working and we are about to distribute the CGI load among other
webservers.

Thanks for all your support.

-- 
Marcel Mitsuto Fucatu Sugano <msugano at uolinc.com>
Universo Online S.A. -- http://www.uol.com.br


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
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