| 66 | return int(uptime[0]) |
| 67 | |
| 68 | def get_memory(): |
| 69 | re_parser = re.compile(r'^(?P<key>\S*):\s*(?P<value>\d*)\s*kB') |
| 70 | result = dict() |
| 71 | for line in open('/proc/meminfo'): |
| 72 | match = re_parser.match(line) |
| 73 | if not match: |
| 74 | continue |
| 75 | key, value = match.groups(['key', 'value']) |
| 76 | result[key] = int(value) |
| 77 | MemTotal = float(result['MemTotal']) |
| 78 | MemUsed = MemTotal-float(result['MemFree'])-float(result['Buffers'])-float(result['Cached'])-float(result['SReclaimable']) |
| 79 | SwapTotal = float(result['SwapTotal']) |
| 80 | SwapFree = float(result['SwapFree']) |
| 81 | return int(MemTotal), int(MemUsed), int(SwapTotal), int(SwapFree) |
| 82 | |
| 83 | def get_hdd(): |
| 84 | valid_fs = { |