[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: lvestats_memory_usage.py
File is not writable. Editing disabled.
# coding=utf-8 # # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENSE.TXT from __future__ import absolute_import from __future__ import division import logging import os import psutil from guppy import hpy from lvestats.core.plugin import LveStatsPlugin class LVEStatsMemoryUsage(LveStatsPlugin): def __init__(self): self.log = logging.getLogger('plugin.LVEStatsMemoryUsage') self.now = 0 # This changes in MainLoop self.period = 60 * 60 self.threshold = 512 try: self._process = psutil.Process(os.getpid()) except AttributeError: self._process = None self.log.error("Process attribute in psutil is not available. psutil.__version__=%s", psutil.__version__) self._hpy = hpy() self._hpy.setrelheap() @staticmethod def split(value): return str(value).split("\n") def execute(self, lve_data): if self._process is None: return rss = self._process.memory_info()[0] / float(1024 * 1024) self.log.debug(str(rss)) if rss >= self.threshold: heap = self._hpy.heap()[:10] result = { 'heap': self.split(heap), 'byid': self.split(heap.byid), 'byvia': self.split(heap.byvia), 'byrcs': self.split(heap.byrcs)} self.log.error("LVEStats uses too much memory", extra=result) elif rss < self.threshold/2: self._hpy.setrelheap()
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 785.46 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: N/A