|
Server : LiteSpeed System : Linux srv104790275 5.15.0-161-generic #171-Ubuntu SMP Sat Oct 11 08:17:01 UTC 2025 x86_64 User : dewac4139 ( 1077) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/local/CyberCP/plogical/ |
Upload File : |
import platform
import os
import datetime
import math
import argparse
class SystemInformation:
now = datetime.datetime.now()
olsReport = ""
@staticmethod
def cpuLoad():
return os.getloadavg()
@staticmethod
def getOSName():
OSName = platform.platform()
data = OSName.split("-")
checker = 0
finalOSName = ""
for items in data:
if checker == 1:
finalOSName = items
break
if items == "with":
checker = 1
return finalOSName
@staticmethod
def getCurrentSystemTime():
return SystemInformation.now.strftime("%I:%M")
@staticmethod
def currentWeekDay():
return SystemInformation.now.strftime("%a")
@staticmethod
def currentMonth():
return SystemInformation.now.strftime("%B")
@staticmethod
def currentYear():
return SystemInformation.now.strftime("%Y")
@staticmethod
def currentDay():
return SystemInformation.now.strftime("%d")
@staticmethod
def getAllInfo():
OSName = SystemInformation.getOSName()
loadAverage = SystemInformation.cpuLoad()
currentTime = SystemInformation.getCurrentSystemTime()
weekDayNameInString = SystemInformation.currentWeekDay()
currentMonthName = SystemInformation.currentMonth()
currentDayInDecimal = SystemInformation.currentDay()
currentYear = SystemInformation.currentYear()
loadAverage = list(loadAverage)
one = loadAverage[0]
two = loadAverage[1]
three = loadAverage[2]
data = {"weekDayNameInString": weekDayNameInString, "currentMonthName": currentMonthName,
"currentDayInDecimal": currentDayInDecimal, "currentYear": currentYear, "OSName": OSName,
"loadAVG": loadAverage, "currentTime": currentTime, "one":one,"two":two,"three":three}
return data
@staticmethod
def getSystemInformation():
try:
import psutil
SystemInfo = {'ramUsage': int(math.floor(psutil.virtual_memory()[2])), 'cpuUsage': int(math.floor(psutil.cpu_percent())), 'diskUsage': int(math.floor(psutil.disk_usage('/')[3]))}
return SystemInfo
except:
SystemInfo = {'ramUsage': 0,
'cpuUsage': 0,
'diskUsage': 0}
return SystemInfo
@staticmethod
def cpuRamDisk():
try:
import psutil
SystemInfo = {'ramUsage': int(math.floor(psutil.virtual_memory()[2])),
'cpuUsage': int(math.floor(psutil.cpu_percent())),
'diskUsage': int(math.floor(psutil.disk_usage('/')[3]))}
except:
SystemInfo = {'ramUsage': 0,
'cpuUsage': 0,
'diskUsage': 0}
return SystemInfo
@staticmethod
def GetRemainingDiskUsageInMBs():
import psutil
total_disk = psutil.disk_usage('/').total / (1024 * 1024) # Total disk space in MB
used_disk = psutil.disk_usage('/').used / (1024 * 1024) # Used disk space in MB
free_disk = psutil.disk_usage('/').free / (1024 * 1024) # Free disk space in MB
percent_used = psutil.disk_usage('/').percent # Percentage of disk used
return used_disk, free_disk, percent_used
@staticmethod
def populateOLSReport():
SystemInformation.olsReport = open("/tmp/lshttpd/.rtreport", "r").readlines()
def main():
parser = argparse.ArgumentParser(description='CyberPanel Installer')
parser.add_argument('function', help='Specific a function to call!')
args = parser.parse_args()
if args.function == "populateOLSReport":
SystemInformation.populateOLSReport()
if __name__ == "__main__":
main()