disk space calculation using /sys/block/

This commit is contained in:
Shailaja Kumari 2024-06-25 17:42:42 +05:30
parent 5b61f38715
commit aa577a0d02
Signed by: shailaja
GPG Key ID: 2B9455CAFBC4D75A

View File

@ -27,12 +27,12 @@ class ServerData:
self.public_ip = self.get_public_ip()
logging.basicConfig(level=logging.INFO)
def get_ram_and_disk(self):
def get_ram_and_disk(self):
# RAM information
with open('/proc/meminfo', 'r') as f:
meminfo = f.read()
ram = int([x for x in meminfo.split('\n') if 'MemTotal' in x][0].split()[1]) // 1024
# Disk space information
disk = 0
for device in os.listdir('/sys/block'):