Exemplo n.º 1
0
    def __init__(self, config):
        
        cfgObject = ProdAgentConfiguration()
        cfgObject.loadFromFile(config)
        notifCfg = cfgObject.getConfig("Notification")
        
        senderName = notifCfg.get("Notification_SenderName")
        senderPwd  = notifCfg.get("Notification_SenderPwd")
        
        if senderName == None :
            raise RuntimeError, "missing Notification_SenderName property in " + config + " configuration file"

        if senderPwd == None:
            raise RuntimeError, "missing Notification_SenderPwd property in " + config + " configuration file"
        
        self.senderName = senderName
        self.senderPwd  = senderPwd
        
        self.smtpServer = notifCfg.get("Notification_SMTPServer")

        if self.smtpServer == None :
            raise RuntimeError, "missing Notification_SMTPServer property in " + config + " configuration file"

        self.smtpDbgLvl = notifCfg.get("Notification_SMTPServerDBGLVL")
        if self.smtpDbgLvl == None:
            self.smtpDbgLvl = 0
        

        msg = "Notification.Mailer: mail Sender is [" + self.senderName + "]"
        logging.info( msg )
        msg = "Notification.Mailer: SMTP server is [" + self.smtpServer + "]"
        logging.info( msg )
        msg = "Notification.Mailer: SMTP server debug level [" + self.smtpDbgLvl + "]"
        logging.info( msg )
Exemplo n.º 2
0
    def __init__(self, servername):
        Thread.__init__(self)
	
        config = os.environ.get("PRODAGENT_CONFIG", None)
        self.serverName = servername
	
        if config == None:
            msg = "No ProdAgent Config file provided\n"
            msg += "set $PRODAGENT_CONFIG variable\n"
            logging.error(msg)
            raise Exception(msg)
            
        okmsg = "Notification.Consumer.__init__: Configuration file is ["
        okmsg += config
        okmsg += "]"
        logging.info(okmsg)
                
        cfgObject = ProdAgentConfiguration()
        cfgObject.loadFromFile(config)
        notifCfg = cfgObject.getConfig("Notification")

        self.notif_delay = notifCfg.get("NotificationDelay")

        if self.notif_delay == None:
            self.notif_delay = 1800
            
        try:
            self.mailer = Mailer.Mailer(config)
        except RuntimeError, mex:
            logging.error( mex )
            import traceback
            logging.error(str(traceback.format_exc()))
            raise Exception(mex)
Exemplo n.º 3
0
def CompDIR(comp_name):

    config = os.environ.get("PRODAGENT_CONFIG", None)
    cfgObject = ProdAgentConfiguration()
    cfgObject.loadFromFile(config)
    compCfg = cfgObject.getConfig(comp_name)
    return compCfg['ComponentDir']
Exemplo n.º 4
0
def status(compList=False):
    """
    _status_

    Print status of all components in config file

    """
    config = os.environ.get("PRODAGENT_CONFIG", None)
    cfgObject = ProdAgentConfiguration()
    cfgObject.loadFromFile(config)

    components = cfgObject.listComponents()
    if compList: return components
    else:
        component_run = []
        component_down = []
        for component in components:
            compCfg = cfgObject.getConfig(component)
            compDir = compCfg['ComponentDir']
            compDir = os.path.expandvars(compDir)
            daemonXml = os.path.join(compDir, "Daemon.xml")
            if not os.path.exists(daemonXml):
                continue
            daemon = DaemonDetails(daemonXml)
            if not daemon.isAlive():
 
                component_down.append(component)
            else:
                tmp=[component, daemon['ProcessID']]
                component_run.append(tmp)
        return component_run, component_down
Exemplo n.º 5
0
def isDrained():
    """
    _isDrained_

    true returned if the server is in drain mode
    """
    config = os.environ.get("PRODAGENT_CONFIG", None)
    cfgObject = ProdAgentConfiguration()
    cfgObject.loadFromFile(config)
    cmconf = cfgObject.getConfig("CommandManager")
    try:
        if int(cmconf['acceptableThroughput']) == 0:
            return True
    except:
        return False
    return False