!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/5.6.40 

uname -a: Linux cpanel06wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.80.el6.x86_64 #1 SMP Thu Sep 24
01:42:00 EDT 2020 x86_64
 

uid=851(cp949260) gid=853(cp949260) groups=853(cp949260) 

Safe-mode: OFF (not secure)

/opt/alt/python37/lib/python3.7/site-packages/lvestats/lib/chart/   drwxr-xr-x
Free 233.41 GB of 981.82 GB (23.77%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     dbgovchartmain.py (4.5 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# 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
from builtins import range
from lvestats.lib import lveinfolib_gov
from lvestats.lib.chart import ChartMain
from lvestats.lib.commons import dateutil, sizeutil

VERSION = '0.10'


def _io_units(v):
    """
    Get string representation of value;
    :param int v: value in megabytes
    :return str: humanized value

    >>> _io_units(1)
    '1MB'
    >>> _io_units(1024)
    '1GB'
    """
    return sizeutil.convert_bytes_for_graph(v * 1024 * 1024)


class DbGovChart(ChartMain):
    def __init__(self, config=None):
        super(DbGovChart, self).__init__('dbgovchart',
                                         'Creates a chart representing usage pattern for LVE/user',
                                         config)

    @staticmethod
    def get_version():
        return VERSION

    def get_chart_data(self, engine, from_ts, to_ts, server, user_id=None, show_all=False):
        utc_from = dateutil.local_to_gm(from_ts)
        utc_to = dateutil.local_to_gm(to_ts)

        dt = utc_to - utc_from
        period_sec = dt.total_seconds()
        show_columns = ('ts', 'cpu', 'lcpu', 'read', 'lread', 'write', 'lwrite')
        data = lveinfolib_gov.HistoryShowDBGov(
            engine,
            utc_from,
            utc_to,
            uid=user_id,
            server_id=server,
            show_columns=show_columns,
            cfg=self.cfg
        ).history_dbgov_show()
        data_collected = DbGovChart.convert_dbdata_to_dict(data, show_columns)
        times = data_collected['ts']
        del data_collected['ts']
        return data_collected, times, period_sec

    def customize_parser(self, parser):
        parser.add_argument('--user',
                            help='mysql username',
                            dest='user_name',
                            required=True)
        return parser

    def add_graphs(self, renderer, data_collected, times, lve_version, show_all, is_user=False):
        if any(data_collected['lcpu']) or show_all:
            if is_user and self.is_normalized_user_cpu:
                # Magnify aCPU, lCPU to 100%
                # New user's data and limits
                a_cpu_new = []
                l_cpu_new = []
                for idx in range(0, len(data_collected['lcpu'])):
                    l_cpu = data_collected['lcpu'][idx]
                    a_cpu = data_collected['cpu'][idx]
                    # New limit
                    l_cpu_new.append(100.0)
                    # New average
                    a_cpu_new.append(a_cpu * 100.0 / l_cpu)
                # Store new data
                data_collected['lcpu'] = l_cpu_new
                data_collected['cpu'] = a_cpu_new
            renderer.add_graph(data_collected, 'CPU Usage',
                               legend={
                                   'cpu': ('CPU', 'green', int),
                                   'lcpu': ('limit', 'red'),
                               }, x_values=times, min_y=0, max_y=100, unit='%', y_legend_converter=int)
        if any(data_collected['lread']) or show_all:
            renderer.add_graph(data_collected, 'Read Usage',
                               legend={
                                   'read': ('READ', 'green',),
                                   'lread': ('limit', 'red'),
                               }, x_values=times, min_y=0, y_legend_converter=_io_units, unit='/s')
        if any(data_collected['lwrite']) or show_all:
            renderer.add_graph(data_collected, 'Write Usage',
                               legend={
                                   'write': ('WRITE', 'green',),
                                   'lwrite': ('limit', 'red'),
                               }, x_values=times, min_y=0, y_legend_converter=_io_units, unit='/s')

        if not show_all and not any(data_collected.values()):
            # if no data available draw text box
            renderer.add_text_box("No data")

        renderer.add_common_x_legend(times, 6)

# Uncomment this if you want to test it.
# if __name__ == "__main__":
#     DbGovChart(config_for_debug={
#         'db_type': 'sqlite',
#         'sqlite_db_path': '/home/shaman/workspace/cloudlinux/dbgovdb/lvestats2.db',
#         'server_id': 'localhost',
#     }).main('--from', '2015-03-12 00:00', '--to', '2015-04-01 00:00', '--user', 'mysqldd', '--output', '/tmp/1.svg')

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.1893 ]--