

def get_stats(self, host, port):
    ignored = ('libevent', 'pointer_size', 'time', 'version', 'repcached_version', 'replication', 'accepting_conns', 'pid')
    pid = None
    stats = {
        
    }
    data = self.get_raw_stats(host, port)
    for line in data.splitlines():
        pieces = line.split(' ')
        if ((pieces[0] != 'STAT') or (pieces[1] in ignored)):
            continue
        elif (pieces[1] == 'pid'):
            pid = pieces[2]
            continue
        if ('.' in pieces[2]):
            stats[pieces[1]] = float(pieces[2])
        else:
            stats[pieces[1]] = int(pieces[2])
    self.log.debug('pid %s', pid)
    try:
        cmdline = ('/proc/%s/cmdline' % pid)
        f = open(cmdline, 'r')
        m = re.search('-c\x00(\\d+)', f.readline())
        if (m is not None):
            self.log.debug('limit connections %s', m.group(1))
            stats['limit_maxconn'] = m.group(1)
        f.close()
    except:
        self.log.debug('Cannot parse command line options for memcached')
    return stats

dataset/ETHPy150Open python-diamond/Diamond/src/collectors/memcached/memcached.py MemcachedCollector.get_stats/original