remotelogin/oper_sys/linux/__init__.py
def free_mem(self, conn=None):
        """ gets the free command output and parses it

        :param conn:
        :return:
        """
        out, err = conn.check_output('free')
        mem = dict(total=0, used=0, free=0)
        swap = dict(total=0, used=0, free=0)
        buff = dict(total=0, used=0, free=0)
        if out:
            for line in out[1:]:
                line = line.strip()
                if line.startswith('Mem'):
                    mem['total'], mem['used'], mem['free'] = line.split()[1:4]
                elif line.startswith('Swap'):
                    swap['total'], swap['used'], swap['free'] = line.split()[1:4]
                elif line.startswith('-/+ buffers/cache:'):
                    buff['used'], buff['free'] = line[len('-/+ buffers/cache:'):].split()
        return dict(memory=mem, swap=swap, buffered=buff)
 gets the free command output and parses it

        :param conn:
        :return:
        
gets the free command output and parses it
gets the free command output and parses it
def free_mem(self, conn=None):
        out, err = conn.check_output('free')
        mem = dict(total=0, used=0, free=0)
        swap = dict(total=0, used=0, free=0)
        buff = dict(total=0, used=0, free=0)
        if out:
            for line in out[1:]:
                line = line.strip()
                if line.startswith('Mem'):
                    mem['total'], mem['used'], mem['free'] = line.split()[1:4]
                elif line.startswith('Swap'):
                    swap['total'], swap['used'], swap['free'] = line.split()[1:4]
                elif line.startswith('-/+ buffers/cache:'):
                    buff['used'], buff['free'] = line[len('-/+ buffers/cache:'):].split()
        return dict(memory=mem, swap=swap, buffered=buff)
def free_mem ( self , conn = None ) : out , err = conn . check_output ( 'free' ) mem = dict ( total = 0 , used = 0 , free = 0 ) swap = dict ( total = 0 , used = 0 , free = 0 ) buff = dict ( total = 0 , used = 0 , free = 0 ) if out : for line in out [ 1 : ] : line = line . strip ( ) if line . startswith ( 'Mem' ) : mem [ 'total' ] , mem [ 'used' ] , mem [ 'free' ] = line . split ( ) [ 1 : 4 ] elif line . startswith ( 'Swap' ) : swap [ 'total' ] , swap [ 'used' ] , swap [ 'free' ] = line . split ( ) [ 1 : 4 ] elif line . startswith ( '-/+ buffers/cache:' ) : buff [ 'used' ] , buff [ 'free' ] = line [ len ( '-/+ buffers/cache:' ) : ] . split ( ) return dict ( memory = mem , swap = swap , buffered = buff )
gets the free command output and parses it
gets the free command output and parses it
""" gets the free command output and parses it

        :param conn:
        :return:
        """
None
self
conn
None