#! /bin/sh
#
# Version 0.4 28 Jan 96	- Adrian Cockcroft
#
# set this to point to your NCSA/Netscape format access log
# default points to a common Netscape server log location
NCSAHTTPLOG=/opt/ns-home/httpd-80/logs/access; export NCSAHTTPLOG
#
# set this to indicate the hostname or IP address of a special system
# as it appears in the access log. It can be used to track fast local
# accesses to your server, for example 192.9. is Sun.com
# and all web accesses from inside Sun to the Internet appear to be from it
# if you have DNS lookups turned on, substitute the name for the IP addr
GATEWAY=192.9.; export GATEWAY
#
# location for web logs to be accumulated. Set to a public doc directory
# if you want to view the data using a web browser or java applet.
OUTDIR=/var/adm/weblogs; export OUTDIR
#
#Live Rule specific thresholds:
#LR_DISK_SLOW_FD    default=10.0x   derate slow floppys
#LR_DISK_SLOW_CD    default=10.0x   derate slow CDs
#LR_DISK_FLOPPY     default=   fd0  default floppy device
#LR_DISK_CDROM      default=c0t6d0  default CD device
#Pure Rule thresholds
#DISK_BUSY_WARNING  default= 5.0%   ignore less than this
#DISK_BUSY_PROBLEM  default=20.0%   
#DISK_SVC_T_WARNING default=30.0ms    
#DISK_SVC_T_PROBLEM default=50.0ms   
#ENET_INUSE         default=50.0/s  ignore fewer output packets/s
#ENET_COLL_WARNING  default=15.0%   
#ENET_COLL_PROBLEM  default=30.0%   
#ENET_ERROR_PROBLEM default=0.050/s  
#ENET_DEFER_WARNING default=2.00%   some delayed output packets
#ENET_DEFER_WARNING default=10.00%  too many delayed output packets
#ENET_NOCANPUT_PROBLEM default=1.000/s incoming packet dropped by IP
#RPCCLIENT_MINCALLS default= 0.0/s  calls per sec for idle
#RPCCLIENT_TIMEOUT  default= 5.0%   calls that timeout
#RPCCLIENT_BADXID   default= 0.0%   timeouts with badxid
# increase swap rule from defaults for web server
#SWAP_WASTE         default=100000KB  more may be a waste
SWAP_WASTE=250000; export SWAP_WASTE
#SWAP_LOTS          default= 10000KB  more is lots
SWAP_LOTS=80000; export SWAP_LOTS
#SWAP_LOW           default=  4000KB  warning LOW to LOTS
SWAP_LOW=20000; export SWAP_LOW
#SWAP_NONE          default=  1000KB  danger LOW-NONE, crisis
SWAP_NONE=5000; export SWAP_NONE
#RESTIME_LONG       default=600s    No scanning - long res time
#RESTIME_OK         default= 40s    residence time of unref pages
#RESTIME_PROBLEM    default= 20s    pages stolen too quickly
#KMEM_FREEMEM_LOW   default= 64pg   few pages for kernel to use
#RUNQ_IDLE          default= 1.0    Spare CPU capacity
#RUNQ_BUSY          default= 2.0    OK up to this level
#RUNQ_OVERLOAD      default= 5.0    Warning up to this level
#MUTEX_BUSY         default=200.0/s OK up to this level per-CPU
#MUTEX_OVERLOAD     default=500.0/s Warning up to this level
#DNLC_ACTIVE        default=100.0/s minimum activity
#DNLC_WARNING       default=80.0%   warning missrate
#INODE_ACTIVE       default=100.0/s minimum activity
#INODE_WARNING      default=80.0%   warning missrate
#INODE_IPF          default= 0.0%   stolen inodes w/pages frac
#TCP_ACTIVE         default= 2.0KB/s ignore if no output activity
# increase threashold for web server
TCP_ACTIVE=10.0; export TCP_ACTIVE
#TCP_RETRANS_WARN   default=15.0%   moderate retransmissions
#TCP_RETRANS_PROBLEM default=25.0%  excessive retransmissions
#TCP_LISTEN_WARN    default=0.00/s  look out for listen drops
#TCP_LISTEN_PROBLEM default=0.50/s  excessive listen drops
#
# argument is log interval - default is 300 seconds
#

SE=/opt/RICHPse/bin/se
PC=/opt/RICHPse/examples/percollator.se
export SE PC

case "$1" in
 
'start')
	# Start the monitor daemon
	if [ -f /opt/RICHPse/etc/start_wl ]; then
	    if [ -f $PC ] ; then
		echo "Web server percollator is bubbling"
		/usr/bin/mkdir -p $OUTDIR
		$SE -o- $PC | $SE -t$PC - 300 &
	    fi
	fi
	;;
'stop')
	# Stop the monitor daemon
	id=`/bin/ps -ef | /bin/grep percollator.se | /bin/grep -v grep | /bin/awk '{print $2}'`
	if [ -n "$id" ]; then
		echo "Web server percollator is off"
		kill $id
	fi
	;;
esac
