> Hopes it's o.k. cross posting to both groups on this matter...
>
> Using the concept of one service per up/down trap for each network
> interface, I tested a little by creating a very simple set of nagios
> configs, but with about 8000 PASSIVE service checks and no active
> service checks. of course there was no problem in terms of scheduling
> issues, but the CGIs all crawled to a snails pace. In my setup (nagios
> 1.2, Dual G4 first-gen xServe) it takes about 30 secs to display the
> Status Summary page.
Yes, this is what I'd expect. The problem is that nagios out of the
box has some terrible code in it. In particular, there's a lot of
places (including the display cgi's) that use O(n^2) algorithms.
Some of the time the problem is hidden; Upper level code will
do "foreach (list) { action }" where 'action' calls a function
also does a linear search of the same list. oops.
Other times the problem is obvious: Code that adds elements
to the end of a singly linked list. By doing a linear
search from the beginning. For each item added. For 12,000
items. oops.
In our local version we create hash tables, and pre/post-sort lists to
work around the worst of the problems.
If you dig through the list archives you'll see the patches that
were sent in to fix it for 1.1.
That still leaves the other big problem with the passive service
checks. Believe it or not, sending a passive result makes nagios
fork()!! The parent process reads the check result, fork()s and then
resends the result again to the parent. Rather wild stuff.
Even better is that the child process has to wait around
for the parent to handle the send.
This is normally masked because the main event loop simply
doesn't check the named pipe very frequently, so normally
your external scripts will blow up with massive queues
waiting for nagios to read the pipe.
Nagios out of the box is simply not ready for reasonable
scale yet.
Michael.
Ps. Ok. I saved you some effort. I dug up the local patches:
(Note: I didn't write these)
* Check the named pipe frequently.
* Don't fork() too often when handling passive check results.
* Use hash tables and sorted lists to get rid of most of the
O(n^2) places.
* Sleep only for a short time in the main loop.
* allow check for auth-smtp.
* fix a few bugs.
* introduces depedancy on glib.
diff -ru nagios-1.1-virgin/base/Makefile.in nagios-1.1/base/Makefile.in
--- nagios-1.1-virgin/base/Makefile.in Thu Jul 10 08:30:10 2003
+++ nagios-1.1/base/Makefile.in Tue Oct 7 13:03:51 2003
@@ -10,9 +10,9 @@
SRC_XDATA=../xdata
CC=@CC@
-CFLAGS=@CFLAGS@ @DEFS@ -DNSCORE
+CFLAGS=@CFLAGS@ @DEFS@ -DNSCORE `pkg-config glib --cflags`
#CFLAGS=-O3 -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -DHAVE_CONFIG_H -DNSCORE
-LDFLAGS=@LDFLAGS@ @LIBS@
+LDFLAGS=@LDFLAGS@ @LIBS@ `pkg-config glib --libs`
prefix=@prefix@
exec_prefix=@exec_prefix@
diff -ru nagios-1.1-virgin/cgi/Makefile.in nagios-1.1/cgi/Makefile.in
--- nagios-1.1-virgin/cgi/Makefile.in Thu Jul 10 08:30:10 2003
+++ nagios-1.1/cgi/Makefile.in Tue Oct 7 13:03:51 2003
@@ -25,9 +25,9 @@
CP=@CP@
CC=@CC@
-CFLAGS=@CFLAGS@ @DEFS@ -DNSCGI
+CFLAGS=@CFLAGS@ @DEFS@ -DNSCGI `pkg-config glib --cflags`
#CFLAGS=-O3 -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -DHAVE_CONFIG_H -DNSCGI
-LDFLAGS=@LDFLAGS@ @LIBS@
+LDFLAGS=@LDFLAGS@ @LIBS@ `pkg-config glib --libs`
CGIS=avail.cgi cmd.cgi config.cgi extinfo.cgi history.cgi notifications.cgi outages.cgi showlog.cgi status.cgi statuswml.cgi summary.cgi tac.cgi $(CGIEXTRAS)
diff -ru nagios-1.1-virgin/common/common.h nagios-1.1/common/common.h
--- nagios-1.1-virgin/common/common.h Thu Jul 10 08:30:10 2003
+++ nagios-1.1/common/common.h Tue Oct 7 13:03:51 2003
@@ -208,8 +208,12 @@
#define OK 0
#define ERROR -2 /* value was changed from -1 so as to not interfere with STATUS_UNKNOWN plugin result */
+#ifndef TRUE
#define TRUE 1
+#endif
+#ifndef FALSE
#define FALSE 0
+#endif
/*********
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]