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)
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)
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)