mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
bug fix top processes
This commit is contained in:
@@ -580,6 +580,8 @@ def topProcessesStatus(request):
|
|||||||
|
|
||||||
## Memory
|
## Memory
|
||||||
|
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(str(memory))
|
||||||
|
|
||||||
if memory[3].find('+') > -1:
|
if memory[3].find('+') > -1:
|
||||||
memoryFinal = memory[3].split('+')[0]
|
memoryFinal = memory[3].split('+')[0]
|
||||||
else:
|
else:
|
||||||
@@ -587,6 +589,7 @@ def topProcessesStatus(request):
|
|||||||
|
|
||||||
data['totalMemory'] = str(int(float(memoryFinal) / 1024)) + 'MB'
|
data['totalMemory'] = str(int(float(memoryFinal) / 1024)) + 'MB'
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
if memory[5].find('free') > -1:
|
if memory[5].find('free') > -1:
|
||||||
@@ -594,6 +597,7 @@ def topProcessesStatus(request):
|
|||||||
else:
|
else:
|
||||||
data['freeMemory'] = str(int(float(memory[5]) / 1024)) + 'MB'
|
data['freeMemory'] = str(int(float(memory[5]) / 1024)) + 'MB'
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
if memory[7].find('used') > -1:
|
if memory[7].find('used') > -1:
|
||||||
@@ -601,13 +605,21 @@ def topProcessesStatus(request):
|
|||||||
else:
|
else:
|
||||||
data['usedMemory'] = str(int(float(memory[7]) / 1024)) + 'MB'
|
data['usedMemory'] = str(int(float(memory[7]) / 1024)) + 'MB'
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
if memory[9].find('buff') > -1:
|
if memory[9].find('buff') > -1:
|
||||||
data['buffCache'] = str(int(float(memory[8]) / 1024)) + 'MB'
|
data['buffCache'] = str(int(float(memory[8]) / 1024)) + 'MB'
|
||||||
else:
|
else:
|
||||||
data['buffCache'] = str(int(float(memory[9]) / 1024)) + 'MB'
|
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
|
## Swap
|
||||||
|
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(str(swap))
|
||||||
|
|
||||||
|
|
||||||
data['swapTotalMemory'] = str(int(float(swap[2]) / 1024)) + 'MB'
|
data['swapTotalMemory'] = str(int(float(swap[2]) / 1024)) + 'MB'
|
||||||
data['swapFreeMemory'] = str(int(float(swap[4]) / 1024)) + 'MB'
|
data['swapFreeMemory'] = str(int(float(swap[4]) / 1024)) + 'MB'
|
||||||
|
|||||||
Reference in New Issue
Block a user