You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Paul Sutton <pa...@ukweb.com> on 1996/07/09 12:43:01 UTC
httpd_monitor
support/httpd_monitor does know about the new scoreboard statuses,
and there isn't very much information about how to compile it
correctly if you've turned on -DSTATUS. The patch below brings it
(a bit more) up-to-date:
* Knows about child statuses K, D, L and W
* Comments updated for correct usage
* Removed unused #defines
* Updated max displayed processes to HARD_SERVER_LIMIT
* Added -DSTATUS comment and example to Makefile
* Fixed getopt return value to be int rather than char
Paul
--
Paul Sutton, Technical Director, UK Web --- http://www.ukweb.com/~paul/
diff -c ../../apache_1.1/support/Makefile ./Makefile
*** ../../apache_1.1/support/Makefile Thu Jun 13 20:49:55 1996
--- ./Makefile Tue Jul 9 12:34:05 1996
***************
*** 12,17 ****
--- 12,24 ----
# For OS/2 port
#EXTRA_LIBS= -llibufc
+ # If you turned on extra status logging with the -DSTATUS flag in the
+ # Configuration file, you _must_ uncomment the following line for
+ # httpd_monitor to work (remember that httpd_monitor only works if
+ # you are using a scoreboard file -- on most systems the scoreboard
+ # will be held in memory and httpd_monitor will not work)
+ STATUS=-DSTATUS
+
INCLUDES= -I../src
***************
*** 63,69 ****
$(CC) $(CFLAGS) htdigest.c -o htdigest
httpd_monitor: httpd_monitor.c
! $(CC) $(INCLUDES) $(CFLAGS) httpd_monitor.c -o httpd_monitor
rotatelogs: rotatelogs.c
$(CC) $(INCLUDES) $(CFLAGS) rotatelogs.c -o rotatelogs
--- 70,76 ----
$(CC) $(CFLAGS) htdigest.c -o htdigest
httpd_monitor: httpd_monitor.c
! $(CC) $(INCLUDES) $(CFLAGS) $(STATUS) httpd_monitor.c -o httpd_monitor
rotatelogs: rotatelogs.c
$(CC) $(INCLUDES) $(CFLAGS) rotatelogs.c -o rotatelogs
diff -c ../../apache_1.1/support/httpd_monitor.c ./httpd_monitor.c
*** ../../apache_1.1/support/httpd_monitor.c Thu Feb 22 11:47:38 1996
--- ./httpd_monitor.c Tue Jul 9 12:31:24 1996
***************
*** 52,68 ****
* simple script to monitor the child Apache processes
* Usage:
! * httpd_monitor -p pid_file -s sleep_time
! * Will give you an update ever sleep_time seconds
! * using pid_file as the location of the PID file.
* If you choose 0, it might chew up lots of CPU time.
*
* Output explanation..
*
! * s = sleeping but "ready to go" child
! * R = active child
! * _ = dead child (no longer needed)
! * t = just starting
*
*
* Jim Jagielski <ji...@jaguNET.com>
--- 52,73 ----
* simple script to monitor the child Apache processes
* Usage:
! * httpd_monitor [ -d serverdir | -f conffile ] [ -s sleep_time ]
! * -d/-f options specify server dir or config files, as per
! * httpd.
! * -s specifies how long to pause between screen updates
* If you choose 0, it might chew up lots of CPU time.
*
* Output explanation..
*
! * s = sleeping but "ready to go" child (this is '_' in mod_status)
! * R = active child - writing to client
! * W = active child - reading from client
! * K = active child - waiting for additional request on kept-alive connectio
n
! * D = active child - doing DNS lookup
! * L = active child - logging
! * _ = dead child (no longer needed) (this is '.' in mod_status)
! * t = just starting (this is 'S' in mod_status)
*
*
* Jim Jagielski <ji...@jaguNET.com>
***************
*** 72,77 ****
--- 77,85 ----
*
* v1.1:
* Minor fixes
+ *
+ * v1.2:
+ * Handles Apache 1.1.* scoreboard format (W/K/D/L states) -- PCS 09Jul96
*/
#include <stdio.h>
***************
*** 81,91 ****
#include "scoreboard.h"
#include "httpd.h"
- #define PIDFILE_OPT "PidFile"
- #define SCORE_OPT "ScoreBoardFile"
#define DEFAULT_SLEEPTIME 2
#define ASIZE 1024
! #define MAX_PROC 40
int
main(argc, argv)
--- 89,97 ----
#include "scoreboard.h"
#include "httpd.h"
#define DEFAULT_SLEEPTIME 2
#define ASIZE 1024
! #define MAX_PROC HARD_SERVER_LIMIT
int
main(argc, argv)
***************
*** 99,106 ****
char score_name[ASIZE];
char tbuf[ASIZE];
char *ptmp;
! static char kid_stat[] = { '_', 's', 'R', 't' };
! char achar;
long thepid;
int score_fd;
int sleep_time = DEFAULT_SLEEPTIME;
--- 105,112 ----
char score_name[ASIZE];
char tbuf[ASIZE];
char *ptmp;
! static char kid_stat[] = { '_', 's', 'R', 't', 'W', 'K', 'L', 'D' };
! int achar;
long thepid;
int score_fd;
int sleep_time = DEFAULT_SLEEPTIME;
***************
*** 200,206 ****
achar = kid_stat[(int)scoreboard_image.status];
if (scoreboard_image.pid != 0 && scoreboard_image.pid != thepid) {
total++;
! if (achar == 'R')
running++;
*ptmp = achar;
*++ptmp = '\0';
--- 206,213 ----
achar = kid_stat[(int)scoreboard_image.status];
if (scoreboard_image.pid != 0 && scoreboard_image.pid != thepid) {
total++;
! if (scoreboard_image.status != SERVER_DEAD &&
! scoreboard_image.status != SERVER_READY)
running++;
*ptmp = achar;
*++ptmp = '\0';
***************
*** 267,273 ****
* ServerRoot line... if not, we bail out
*/
if (!*sroot) {
- perror("httpd_monitor");
fprintf(stderr, "Can't find ServerRoot!\n");
exit(1);
}
--- 274,279 ----
Re: httpd_monitor
Posted by Mark J Cox <ma...@ukweb.com>.
Paul Sutton wrote:
> support/httpd_monitor does (NOT) know about the new scoreboard statuses,
> The patch below brings it (a bit more) up-to-date:
It will only work when the scoreboard isn't in memory, but I know a
few people that still use it.
+1 on this for 1.2.X tree
Mark