[Zope] Monitoring Zope.

2000-12-03 Thread Jason C. Leach

hi,

A while ago someone was asking about monitoring zope. This is a simple
python script I use to keep an eye on the server.

It's run in cron, every so often it fetches the last known zope PID, and
makes sure zope is still running on it.  If it's not, it runs the Zope
startup script.

I'll eventual improve upon it so it mails me a note and makes a log so I
know if zope starts to bail quite a bit.

j.

..
. Jason C. Leach
... University College of the Cariboo.
.. 


#!/usr/local/bin/python
#
# Simple Zope monitoring script.
# Jason C. Leach. Canada.
#


import string, os

def ScanLines(token, command):
#print 'in ScanLines'

Status = 0

# fetch data
Lines = PipeInput(command)

# cycle through the input
for line in Lines:
# if a line contains the 'daemons' name, just exit gracefully.
Status = string.find(line, token)
#print Status
#print line
# should exit
if Status = 0:
Status = 1
break
else:
Status = 0

#print 'done ScanLines'
return Status

def PipeInput(command):
# check to make sure the disks are not to full.
#print 'int PipeInput'

# variable decleration
Lines = []

# open pipe to os command
pipe = os.popen(command, 'r')

# fetch input
Lines = pipe.readlines()

# close the pipe
pipe.close()

return Lines

def GetPid(FILE):

fin = open(FILE, 'r')

pid = fin.readline()

fin.close()

return pid



if __name__ == '__main__':

TOKEN = 'Zope'
ZOPEPID = '/usr/local/www/Zope/var/zProcessManager.pid'
CMD = 'ps -p ' + GetPid(ZOPEPID) + ' | grep Zope'
SCRIPT = ' /usr/local/etc/rc.d/zope.sh start'



Status = ScanLines(TOKEN, CMD)
if not Status:
os.system(SCRIPT)

#return 1





[Zope] monitoring zope

2000-06-14 Thread Bak @ kedai

hi again,
there were threads that talk about restarting Zope if and when it hangs.  i
know of the -Z option for z2.py and daemontools.

i know there's another one, a script maybe, with a peculiar name, but can't
really remember it.  any clues/url?

i wwant to give it a try

thanks
  -- 
--
http://www.kedai.com.my/kk
Am I Evil?


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] monitoring Zope with daemontools

2000-05-25 Thread Dan L. Pierson

Frank Tegtmeyer writes:
  About two months ago there was a discussion about monitoring the Zope 
  processes. Someone mentioned daemontools of Daniel J. Bernstein.
  
  Because I use daemontools for several other applications I tried it with 
  Zope too.
  
  See my article at
  http://www.lightwerk.de/zope/monitoring
  if you are interested for "how to set up and use" this combination.

I notice that your setup requires the -D switch to z2.py.  This does a 
number of things other than preventing the controlling terminal from
detaching.  Most of these other things (no multiple threads, enabling
internal debugging support) will harm the performance of your Zope
server.

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )