Skip to content

Commit d297bbb

Browse files
committed
bug fix top processes
1 parent b20af73 commit d297bbb

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

serverStatus/views.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,34 +580,46 @@ def topProcessesStatus(request):
580580

581581
## Memory
582582

583+
logging.CyberCPLogFileWriter.writeToFile(str(memory))
584+
583585
if memory[3].find('+') > -1:
584586
memoryFinal = memory[3].split('+')[0]
585587
else:
586588
memoryFinal = memory[3]
587589

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

592+
590593
##
591594

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

600+
597601
##
598602

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

604-
if memory[9].find('buff') > -1:
605-
data['buffCache'] = str(int(float(memory[8]) / 1024)) + 'MB'
606-
else:
607-
data['buffCache'] = str(int(float(memory[9]) / 1024)) + 'MB'
608+
609+
try:
610+
if memory[9].find('buff') > -1:
611+
data['buffCache'] = str(int(float(memory[8]) / 1024)) + 'MB'
612+
else:
613+
data['buffCache'] = str(int(float(memory[9]) / 1024)) + 'MB'
614+
except:
615+
logging.CyberCPLogFileWriter.writeToFile(memory[8])
616+
data['buffCache'] = str(int(float(memory[8].split('+')[0]) / 1024)) + 'MB'
617+
608618

609619
## Swap
610620

621+
logging.CyberCPLogFileWriter.writeToFile(str(swap))
622+
611623

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

0 commit comments

Comments
 (0)