


Manometer CPU, memory, Temperature, net
Conky by walloo13 36 comments
Hi,
I managed to fix the Memory/swap meter by patching the python script. (I just copy/pasted from another screenlet, I don't know the first thing about python programming ;-) )
So:
1) Open ManometerScreenlet.py - e.g. with gedit.
2) Search for "def get_usedmem(self):" and replace the function with the following code:
Quote:
def get_usedmem(self):
"""Get used memory"""
meminfo = commands.getoutput('cat /proc/meminfo').splitlines()
mem = {}
for line in meminfo:
if line.startswith('MemTotal'):
mem['total'] = line.split()[1]
elif line.startswith('Cached'):
mem['cached'] = line.split()[1]
elif line.startswith('Buffers'):
mem['buffers'] = line.split()[1]
elif line.startswith('MemFree'):
mem['free'] = line.split()[1]
return int((100*(int(mem['total'])-int(mem['cached']) - int(mem['buffers']) - int(mem['free'])))/int(mem['total']))
3) Search for "def get_usedswap(self):" and replace the function with the following code:
Quote:
def get_usedswap(self):
"""Get used swap memory"""
meminfo = commands.getoutput('cat /proc/meminfo').splitlines()
mem = {}
for line in meminfo:
if line.startswith('SwapTotal'):
mem['SwapTotal'] = line.split()[1]
elif line.startswith('SwapCached'):
mem['SwapCached'] = line.split()[1]
elif line.startswith('SwapFree'):
mem['SwapFree'] = line.split()[1]
return int((100*(int(mem['SwapTotal'])-int(mem['SwapCached']) - int(mem['SwapFree'])))/int(mem['SwapTotal']))
4)Restart manometer screenlet.
Hopefully, the mem & swap meters will display properly this time. - May 15 2010
I managed to fix the Memory/swap meter by patching the python script. (I just copy/pasted from another screenlet, I don't know the first thing about python programming ;-) )
So:
1) Open ManometerScreenlet.py - e.g. with gedit.
2) Search for "def get_usedmem(self):" and replace the function with the following code:
Quote:
def get_usedmem(self):
"""Get used memory"""
meminfo = commands.getoutput('cat /proc/meminfo').splitlines()
mem = {}
for line in meminfo:
if line.startswith('MemTotal'):
mem['total'] = line.split()[1]
elif line.startswith('Cached'):
mem['cached'] = line.split()[1]
elif line.startswith('Buffers'):
mem['buffers'] = line.split()[1]
elif line.startswith('MemFree'):
mem['free'] = line.split()[1]
return int((100*(int(mem['total'])-int(mem['cached']) - int(mem['buffers']) - int(mem['free'])))/int(mem['total']))
3) Search for "def get_usedswap(self):" and replace the function with the following code:
Quote:
def get_usedswap(self):
"""Get used swap memory"""
meminfo = commands.getoutput('cat /proc/meminfo').splitlines()
mem = {}
for line in meminfo:
if line.startswith('SwapTotal'):
mem['SwapTotal'] = line.split()[1]
elif line.startswith('SwapCached'):
mem['SwapCached'] = line.split()[1]
elif line.startswith('SwapFree'):
mem['SwapFree'] = line.split()[1]
return int((100*(int(mem['SwapTotal'])-int(mem['SwapCached']) - int(mem['SwapFree'])))/int(mem['SwapTotal']))
4)Restart manometer screenlet.
Hopefully, the mem & swap meters will display properly this time. - May 15 2010