Example #1
0
def mailException(txt):
    global g_allExcTxt, g_lastExceptionMailTime, g_mailExceptionLock
    g_mailExceptionLock.acquire()
    try:
        mailingFrequency = g_hourInSeconds
        g_allExcTxt += txt
        curTime = time.time()
        # disable buffering of exceptions
        # now I think it's better to just send them immediately
        #if (None == g_lastExceptionMailTime) or (curTime > g_lastExceptionMailTime + mailingFrequency):
        if True:
            # send the e-mail about exception if at least 60 min passed
            # since the last e-mail
            g_lastExceptionMailTime = curTime
            curDate = time.strftime("%Y-%m-%d", time.localtime())
            subject = "InfoMan server exception on %s" % curDate
            emailContent = "Server: %s on port %d\n" % (
                multiUserSupport.getServerUser(),
                multiUserSupport.getServerPort())
            emailContent += g_allExcTxt
            g_allExcTxt = ""
            parserErrorLogger.mail(subject, emailContent)
    finally:
        g_mailExceptionLock.release()
Example #2
0
import os, sys, string, re, socket, random, time, smtplib
import arsutils, multiUserSupport
import Fields
from InfoManServer import *

SERVER_PORT = multiUserSupport.getServerPort()
SERVER_USER = multiUserSupport.getServerUser()

PYTHON_EXEC = "python2.4"

# possible server states
# we can find the server process and it responds to our ping request
STATE_ALIVE = 0
# we can find the server process but it doesn't respond to our poing request
# (too busy?)
STATE_NOT_RESPONDING = 1
# we can't find the server process
STATE_DEAD = 2

def stateName(state):
    if STATE_ALIVE == state:
        return "STATE_ALIVE"

    if STATE_NOT_RESPONDING == state:
        return "STATE_NOT_RESPONDING"

    if STATE_DEAD == state:
        return "STATE_DEAD"

    return "UNKNOWN"
Example #3
0
def mailException(txt):
    global g_allExcTxt, g_lastExceptionMailTime, g_mailExceptionLock
    g_mailExceptionLock.acquire()
    try:
        mailingFrequency = g_hourInSeconds
        g_allExcTxt += txt
        curTime = time.time()
        # disable buffering of exceptions
        # now I think it's better to just send them immediately
        #if (None == g_lastExceptionMailTime) or (curTime > g_lastExceptionMailTime + mailingFrequency):
        if True:
            # send the e-mail about exception if at least 60 min passed
            # since the last e-mail
            g_lastExceptionMailTime = curTime
            curDate = time.strftime( "%Y-%m-%d", time.localtime() )
            subject = "InfoMan server exception on %s" % curDate
            emailContent = "Server: %s on port %d\n" % (multiUserSupport.getServerUser(), multiUserSupport.getServerPort())
            emailContent += g_allExcTxt
            g_allExcTxt = ""
            parserErrorLogger.mail(subject, emailContent)
    finally:
        g_mailExceptionLock.release()
import os, sys, string, re, socket, random, time, smtplib
import arsutils, multiUserSupport
import Fields
from InfoManServer import *

SERVER_PORT = multiUserSupport.getServerPort()
SERVER_USER = multiUserSupport.getServerUser()

PYTHON_EXEC = "python2.4"

# possible server states
# we can find the server process and it responds to our ping request
STATE_ALIVE = 0
# we can find the server process but it doesn't respond to our poing request
# (too busy?)
STATE_NOT_RESPONDING = 1
# we can't find the server process
STATE_DEAD = 2


def stateName(state):
    if STATE_ALIVE == state:
        return "STATE_ALIVE"

    if STATE_NOT_RESPONDING == state:
        return "STATE_NOT_RESPONDING"

    if STATE_DEAD == state:
        return "STATE_DEAD"

    return "UNKNOWN"
def mailRetrieveFailure(fieldName, fieldValue, url):
    global MAILHOST
    if None == fieldValue:
        fieldValue = ""
    curDate = time.strftime( "%Y-%m-%d", time.localtime() )
    userName = multiUserSupport.getServerUser()
    subject = "InfoMan retrieve failure notification %s for %s" % (curDate, userName)
    emailContent = "Server: %s on port %d\n" % (multiUserSupport.getServerUser(), multiUserSupport.getServerPort())
    txt = "InfoMan failed to retrieve results for query:\n%s: %s\n" % (fieldName, fieldValue)
    if None != url:
        txt = "%surl=%s\n" % (txt, url)
    mail(subject, txt)