Пример #1
0
    def __init__(self,
                 translator,
                 sing,
                 plural='',
                 message='',
                 enabled=True,
                 locale='',
                 tip='',
                 index=0):
        Templated.__init__(self)

        self.translator = translator
        self.message = message
        self.enabled = enabled
        self.locale = locale
        self.tip = ''
        self.index = 0

        # figure out where this item appears in the source
        source = source_line.findall(message)
        if source:
            self.source, self.line = source[0]
        else:
            self.source = self.line = ''

        self.msgid = self._SubstString(sing)
        self.msgid_plural = self._SubstString(plural)
        if str(self.msgid_plural):
            self.msgstr = []
        else:
            self.msgstr = self._SubstString('')
Пример #2
0
    def __init__(self, hosts = None, queue_length_max = {}):
        """
        hosts is a list of machine hostnames to be tracked.
        """
        self._hosts = hosts or g.monitored_servers 

        db_info = {}
        for db in g.databases:
            dbase, ip = list(g.to_iter(getattr(g, db + "_db")))[:2]
            try:
                name = socket.gethostbyaddr(ip)[0]

                for host in g.monitored_servers:
                    if (name == host or
                        ("." in host and name.endswith("." + host)) or
                        name.startswith(host + ".")):
                        db_info[db] = (dbase, ip, host)
            except socket.gaierror:
                print "error resolving host: %s" % ip

        self._db_info = db_info
        q_host = g.amqp_host.split(':')[0]
        if q_host:
            # list of machines that have amqp queues
            self._queue_hosts = set([q_host, socket.gethostbyaddr(q_host)[0]])
        # dictionary of max lengths for each queue 
        self._queue_length_max = queue_length_max

        self.hostlogs = []
        Templated.__init__(self)
Пример #3
0
    def __init__(self, hosts=None, queue_length_max={}):
        """
        hosts is a list of machine hostnames to be tracked.
        """
        self._hosts = hosts or g.monitored_servers

        db_info = {}
        for db in g.databases:
            dbase, ip = list(g.to_iter(getattr(g, db + "_db")))[:2]
            try:
                name = socket.gethostbyaddr(ip)[0]

                for host in g.monitored_servers:
                    if (name == host
                            or ("." in host and name.endswith("." + host))
                            or name.startswith(host + ".")):
                        db_info[db] = (dbase, ip, host)
            except socket.gaierror:
                print "error resolving host: %s" % ip

        self._db_info = db_info
        q_host = g.amqp_host.split(':')[0]
        if q_host:
            # list of machines that have amqp queues
            self._queue_hosts = set([q_host, socket.gethostbyaddr(q_host)[0]])
        # dictionary of max lengths for each queue
        self._queue_length_max = queue_length_max

        self.hostlogs = []
        Templated.__init__(self)
Пример #4
0
    def __init__(self, hosts = None):
        """
        hosts is a list of machine hostnames to be tracked.
        """
        self._hosts = hosts or g.monitored_servers 

        db_info = {}
        for db in g.databases:
            dbase, ip = list(g.to_iter(getattr(g, db + "_db")))[:2]
            try:
                name = socket.gethostbyaddr(ip)[0]
    
                for host in g.monitored_servers:
                    if (name == host or
                        ("." in host and name.endswith("." + host)) or
                        name.startswith(host + ".")):
                        db_info[db] = (dbase, ip, host)
            except socket.gaierror:
                print "error resolving host: %s" % ip

        self._db_info = db_info
        self.hostlogs = []
        Templated.__init__(self)
Пример #5
0
    def __init__(self, translator, sing, plural = '', message = '',
                 enabled = True, locale = '', tip = '', index = 0):
        Templated.__init__(self)

        self.translator = translator
        self.message = message
        self.enabled = enabled
        self.locale = locale
        self.tip = ''
        self.index = 0

        # figure out where this item appears in the source
        source = source_line.findall(message)
        if source:
            self.source, self.line = source[0]
        else:
            self.source = self.line = ''

        self.msgid = self._SubstString(sing)
        self.msgid_plural = self._SubstString(plural)
        if str(self.msgid_plural):
            self.msgstr = []
        else:
            self.msgstr = self._SubstString('')
Пример #6
0
 def render(self, *a, **kw):
     self.hostlogs = list(self)
     return Templated.render(self, *a, **kw)
Пример #7
0
 def render(self, *a, **kw):
     self.hostlogs = list(self)
     return Templated.render(self, *a, **kw)