Server IP : 66.29.132.122 / Your IP : 3.128.201.40 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/opt/cloudlinux/venv/lib64/python3.11/site-packages/clsentry/ |
Upload File : |
#!/opt/cloudlinux/venv/bin/python3 -bb # 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 import platform from requests.exceptions import RequestException from clcommon import cpapi, get_lve_version from clcommon.lib.cledition import get_cl_edition_readable from clcommon.utils import get_rhn_systemid_value, get_username from clcommon.lib.network import get_ip_addr, get_hostname from clcommon.cpapi.const import UNKNOWN_CP_NAME from raven import Client from raven.transport import RequestsHTTPTransport from clsentry.utils import get_pkg_version class SafeRequestsHTTPTransport(RequestsHTTPTransport): def send(self, url, data, headers): try: super().send(url, data, headers) except RequestException: # We hide errors while sending message to Sentry in varied cases: # problems with network, Sentry server is down, incorrect firewall's rules, etc pass class UserlandClient(Client): """ Userland's sentry client with some common settings. """ def __init__(self, dsn, **options): options.update({ 'tags': self._get_user_tags(), 'ignore_exceptions': [ KeyboardInterrupt, ], 'exclude_paths': [ 'sentry', 'raven', ], 'auto_log_stacks': True, 'string_max_length': 1000, 'list_max_length': 100, 'processors': ('clsentry.processors.UserlandSanitize', ), # async transport is noisy and prints messages like # 'Sentry is attempting to send 1 pending error messages' 'transport': SafeRequestsHTTPTransport, }) super().__init__(dsn, **options) @classmethod def _get_user_tags(cls): """ Get tags for easy search :rtype: dict """ cp_description = cpapi.get_cp_description() cp_version = cp_description.get('version') if cp_description else None cp_name = cp_description.get('name') if cp_description else UNKNOWN_CP_NAME cp_product = 'WP2' if cpapi.is_wp2_environment() else None return { 'Control Panel Name': cp_name, 'Control Panel Version': cp_version, 'Control Panel Product': cp_product, 'CloudLinux version': get_rhn_systemid_value("os_release"), 'Cloudlinux edition': get_cl_edition_readable(), 'Architecture': get_rhn_systemid_value("architecture"), 'lve_version': get_lve_version()[0], # TODO: use 'include_paths' instead 'lvemanager': get_pkg_version('lvemanager'), 'alt-python27-cllib': get_pkg_version('alt-python27-cllib'), 'lve-stats': get_pkg_version('lve-stats'), 'lve-utils': get_pkg_version('lve-utils'), 'cl-end-server-tools': get_pkg_version('cl-end-server-tools'), 'cl-node-exporter': get_pkg_version('cl-node-exporter'), 'cagefs': get_pkg_version('cagefs'), 'kernel': platform.release(), 'username': get_username(), 'ip_address': get_ip_addr(get_hostname()), }