[CalendarServer-changes] [1981] CalDAVTester/trunk/monitor.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Oct 24 09:57:01 PDT 2007
Revision: 1981
http://trac.macosforge.org/projects/calendarserver/changeset/1981
Author: cdaboo at apple.com
Date: 2007-10-24 09:57:01 -0700 (Wed, 24 Oct 2007)
Log Message:
-----------
Put the actual error message into the email message as well.
Modified Paths:
--------------
CalDAVTester/trunk/monitor.py
Modified: CalDAVTester/trunk/monitor.py
===================================================================
--- CalDAVTester/trunk/monitor.py 2007-10-24 02:37:14 UTC (rev 1980)
+++ CalDAVTester/trunk/monitor.py 2007-10-24 16:57:01 UTC (rev 1981)
@@ -22,6 +22,7 @@
#
from getpass import getpass
+from StringIO import StringIO
import itertools
import getopt
import socket
@@ -70,8 +71,8 @@
self.minfo = monitorinfo()
self.minfo.parseXML(node)
- def doScript(self, script):
- mgr = manager(level=manager.LOG_ERROR, log_file=self.log)
+ def doScript(self, script, logger):
+ mgr = manager(level=manager.LOG_ERROR, log_file=logger)
return mgr.runWithOptions(
self.minfo.serverinfo,
"",
@@ -127,13 +128,14 @@
time.sleep(self.minfo.period)
if not self.running:
break
- result, timing = m.doScript(self.minfo.testinfo)
+ logger = StringIO()
+ result, timing = m.doScript(self.minfo.testinfo, logger)
if not self.running:
break
if self.minfo.logging:
self.logtxt("Result: %d, Timing: %.3f" % (result, timing,))
if result != 0:
- msg = "WARNING: request failed"
+ msg = "WARNING: request failed\n----\n%s\n----\n" % (logger.getvalue(),)
self.logtxt(msg)
if self.minfo.notify_request_failed and (time.time() - last_notify > self.minfo.notify_interval * 60):
self.logtxt("Sending notification to %s" % (self.minfo.notify,))
@@ -258,6 +260,8 @@
-h Print this help and exit
-u generate report of server uptime
--html generate report as HTML
+ --user user name for test account
+ --pswd password
"""
if __name__ == "__main__":
@@ -265,8 +269,10 @@
infoname = "scripts/monitoring/monitorinfo.xml"
uptime = False
html = False
+ user = None
+ pswd = None
- options, args = getopt.getopt(sys.argv[1:], "huw", ["html"])
+ options, args = getopt.getopt(sys.argv[1:], "huw", ["html", "user=", "pswd=",])
for option, value in options:
if option == "-h":
@@ -276,6 +282,10 @@
uptime = True
elif option == "--html":
html = True
+ elif option == "--user":
+ user = value
+ elif option == "--pswd":
+ pswd = value
else:
print "Unrecognized option: %s" % (option,)
usage()
@@ -301,8 +311,10 @@
user = ""
pswd = ""
else:
- user = raw_input("User: ")
- pswd = getpass("Password: ")
+ if not user:
+ user = raw_input("User: ")
+ if not pswd:
+ pswd = getpass("Password: ")
if uptime:
monitor.reportStart(html)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20071024/1ace8bfd/attachment.html
More information about the calendarserver-changes
mailing list