Skip to content
Permalink
Browse files
bug fix top processes
  • Loading branch information
usmannasir committed May 3, 2020
1 parent b20af73 commit d297bbb43befd468f657abf08d2bc83422a9e957
Showing 1 changed file with 16 additions and 4 deletions.
@@ -580,34 +580,46 @@ def topProcessesStatus(request):

## Memory

logging.CyberCPLogFileWriter.writeToFile(str(memory))

if memory[3].find('+') > -1:
memoryFinal = memory[3].split('+')[0]
else:
memoryFinal = memory[3]

data['totalMemory'] = str(int(float(memoryFinal) / 1024)) + 'MB'


##

if memory[5].find('free') > -1:
data['freeMemory'] = str(int(float(memory[4]) / 1024)) + 'MB'
else:
data['freeMemory'] = str(int(float(memory[5]) / 1024)) + 'MB'


##

if memory[7].find('used') > -1:
data['usedMemory'] = str(int(float(memory[6]) / 1024)) + 'MB'
else:
data['usedMemory'] = str(int(float(memory[7]) / 1024)) + 'MB'

if memory[9].find('buff') > -1:
data['buffCache'] = str(int(float(memory[8]) / 1024)) + 'MB'
else:
data['buffCache'] = str(int(float(memory[9]) / 1024)) + 'MB'

try:
if memory[9].find('buff') > -1:
data['buffCache'] = str(int(float(memory[8]) / 1024)) + 'MB'
else:
data['buffCache'] = str(int(float(memory[9]) / 1024)) + 'MB'
except:
logging.CyberCPLogFileWriter.writeToFile(memory[8])
data['buffCache'] = str(int(float(memory[8].split('+')[0]) / 1024)) + 'MB'


## Swap

logging.CyberCPLogFileWriter.writeToFile(str(swap))


data['swapTotalMemory'] = str(int(float(swap[2]) / 1024)) + 'MB'
data['swapFreeMemory'] = str(int(float(swap[4]) / 1024)) + 'MB'

0 comments on commit d297bbb

Please sign in to comment.