[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
monit spawn.c
From: |
Jan-Henrik Haukeland |
Subject: |
monit spawn.c |
Date: |
Tue, 17 Jun 2003 22:03:56 -0400 |
CVSROOT: /cvsroot/monit
Module name: monit
Branch:
Changes by: Jan-Henrik Haukeland <address@hidden> 03/06/17 22:03:56
Modified files:
. : spawn.c
Log message:
Added MONIT_xxx environment variables to all programs executed by spawn.
(also removed the dubious release memory code to make spawn simpler)
The current environment variables are (with example values):
(Which variables to use are absolutely open for discussion)
MONIT_PROGRAM_CPU_PERCENT=0
MONIT_PROGRAM_MEMORY=2332
MONIT_PROGRAM_PID=12470
MONIT_DATE=Wed, 18 Jun 2003 03:50:48 +0200
MONIT_PROGRAM_CHILDREN=1
MONIT_PROGRAM=/home/hauk/bin/tst
MONIT_HOST=t7w7kz
The above values is if a program was stopped, if it was started many
variables
have a null value, e.g. the pid is not set and so on. This means that
many variables does not have much meaning in the usual case where monit
starts a program. Should we drop variables? Viewpoints???
To test I use a simple script that pops up an xterm. Here's the fake
entry in .monitrc and below the script:
check test with pidfile /tmp/tst.pid
start program = "/home/hauk/bin/tst start -bg blue -fn 7x13eurobold"
stop program = "/home/hauk/bin/tst stop"
host nettvenn.sol.no port 80 proto http
request "/index.jhtml?action=user_create"
alert address@hidden
if cpu usage is greater than 10% then alert
checksum /home/hauk/bin/tst
group server
host shop.sol.no port 443 type TCPSSL proto http
timeout if 2 restarts within 3 cycles
The script (remember to do xhost +localhost in the monit console first):
#!/bin/bash
/usr/bin/env > /tmp/myenv
echo "Got $# argument(s): $*" > /tmp/myargs
export DISPLAY=localhost:0.0
case $1 in
start) shift;
echo $$ > /tmp/tst.pid
exec 2>&1 1>/tmp/tst.log
exec /usr/X11R6/bin/xterm $*;;
stop) shift;
kill `cat /tmp/tst.pid`;;
*) echo "usage: tst {start|stop}";;
esac
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/monit/monit/spawn.c.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- monit spawn.c,
Jan-Henrik Haukeland <=