Mini Shell
#!/opt/cloudlinux/venv/bin/python3 -bb
# coding=utf-8
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2020 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENCE.TXT
import logging
import sentry_sdk
from clcommon.utils import get_rhn_systemid_value
from version import VERSION as PKG_VERSION
SENTRY_DNS = 'https://9e8970e72aa44adb892b3f651e2f0860@cl.sentry.cloudlinux.com/33'
def setup_logger(logger_name):
logging.basicConfig(filename='/var/log/cl_wmt.log',
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
datefmt='%Y.%m.%d %I:%M:%S %p')
return logging.getLogger(logger_name)
def get_package_version(pkg_version=None):
"""
Strips platform-dependent part of package version.
"""
pkg_version = pkg_version or PKG_VERSION
try:
version = pkg_version.split(".el")
release = version[0]
is_developer = not version[1].endswith('cloudlinux')
except IndexError:
release = pkg_version
is_developer = True
return release, is_developer
def init_wmt_sentry_client():
version, is_development = get_package_version()
sentry_sdk.init(SENTRY_DNS, release=version)
sentry_sdk.set_tag('CloudLinux version', get_rhn_systemid_value('os_release'))
sentry_sdk.set_tag('Architecture', get_rhn_systemid_value('architecture'))
sentry_sdk.environment = 'Development' if is_development else 'Release'
sentry_sdk.set_tag('Version', version)
sentry_sdk.set_tag('Project', 'web-monitoring-tool')
systemid = get_rhn_systemid_value('system_id') or 'unknown'
sentry_sdk.set_user({'ID': systemid})
sentry_sdk.set_tag('full_version', PKG_VERSION)
Zerion Mini Shell 1.0