superset警报与报告

Superset配置

参考官网进行配置

Alerts and Reports | superset dochttps://superset.apache.org/docs/installation/alerts-reports

 贴上我的superset_config.py配置,仅供参考

from superset.typing import CacheConfig
from celery.schedules import crontab

FEATURE_FLAGS = {
    "THUMBNAILS": True,
    "THUMBNAILS_SQLA_LISTENERS": True,
    "DASHBOARD_NATIVE_FILTERS": True,
    "DASHBOARD_CACHE": True,
    "ALERT_REPORTS": True,
}

CACHE_CONFIG = {
    'CACHE_TYPE': 'redis',
    'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 3,
    'CACHE_KEY_PREFIX': 'superset_',
    'CACHE_REDIS_HOST': 'localhost',
    'CACHE_REDIS_PORT': 6379,
    'CACHE_REDIS_DB': 0,
    'CACHE_REDIS_URL': 'redis://localhost:6379/0'
}

DATA_CACHE_CONFIG = {
    'CACHE_TYPE': 'redis',
    'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 3, # 1 day default (in secs)
    'CACHE_KEY_PREFIX': 'superset_results',
    'CACHE_REDIS_URL': 'redis://localhost:6379/0',
}

# Async selenium thumbnail task will use the following user
THUMBNAIL_SELENIUM_USER = "admin"
THUMBNAIL_CACHE_CONFIG: CacheConfig = {
    'CACHE_TYPE': 'redis',
    'CACHE_DEFAULT_TIMEOUT': 3*60*60,
    'CACHE_KEY_PREFIX': 'thumbnail_',
    'CACHE_NO_NULL_WARNING': True,
    'CACHE_REDIS_URL': 'redis://localhost:6379/0'
}

class CeleryConfig(object):
    BROKER_URL = "redis://localhost:6379/0"
    CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks", "superset.tasks.thumbnails",)
    CELERY_RESULT_BACKEND = "redis://localhost:6379/0"
    CELERYD_PREFETCH_MULTIPLIER = 10
    CELERY_ACKS_LATE = True
    CELERY_ANNOTATIONS = {
        'sql_lab.get_sql_results': {
            'rate_limit': '100/s',
        },
        'email_reports.send': {
            'rate_limit': '1/s',
            'time_limit': 600,
            'soft_time_limit': 600,
            'ignore_result': True,
        },
    }
    CELERYBEAT_SCHEDULE = {
        "cache-warmup-hourly": {
            "task": "cache-warmup",
            "schedule": crontab(minute=0, hour="*"),  # hourly
            "kwargs": {
                "strategy_name": "top_n_dashboards",
                "top_n": 5,
                "since": "7 days ago",
            },
        },
        'reports.scheduler': {
            'task': 'reports.scheduler',
            'schedule': crontab(minute='*', hour='*'),
        },
        'reports.prune_log': {
            'task': 'reports.prune_log',
            'schedule': crontab(minute=0, hour=0),
        },
    }
CELERY_CONFIG = CeleryConfig

SCREENSHOT_LOCATE_WAIT = 100
SCREENSHOT_LOAD_WAIT = 600

# Email configuration
SMTP_HOST = "smtp.163.com" #change to your host
SMTP_STARTTLS = True
SMTP_SSL = False
SMTP_USER = "lz********@163.com"
SMTP_PORT = 25 # your port eg. 587
SMTP_PASSWORD = "***************"
SMTP_MAIL_FROM = "lz******@163.com"

# The webdriver to use for generating reports. Use one of the following
# firefox
#   Requires: geckodriver and firefox installations
#   Limitations: can be buggy at times
# chrome:
#   Requires: headless chrome
#   Limitations: unable to generate screenshots of elements
WEBDRIVER_TYPE = "chrome"

# Additional args to be passed as arguments to the config object
# Note: these options are Chrome-specific. For FF, these should
# only include the "--headless" arg
WEBDRIVER_OPTION_ARGS = [
    "--force-device-scale-factor=2.0",
    "--high-dpi-support=2.0",
    "--headless",
    "--disable-gpu",
    "--disable-dev-shm-usage",
    "--no-sandbox",
    "--disable-setuid-sandbox",
    "--disable-extensions",
]

# The base URL to query for accessing the user interface
WEBDRIVER_BASEURL = "http://localhost:8088/"

# On Redis
from cachelib.redis import RedisCache
RESULTS_BACKEND = RedisCache(
    host='localhost', port=6379, key_prefix='superset_results')

邮箱配置

        *邮箱以163举例

  • 首先开启163邮箱SMTP

  • 拿到授权码

 

  • 编写SMTP配置

 

 SMTP_PASSWORD 授权码

SMTP_USER        你的163邮箱

SMTP_MAIL_FROM  你的163邮箱

端口号

 非SSL 

SMTP_STARTTLS = True
SMTP_SSL = False

配置完成。


 启动superset

我的运行方式与官方不同,是单容器运行的。Superset安装与汉化https://blog.csdn.net/LeeZed/article/details/121223218https://blog.csdn.net/LeeZed/article/details/121223218?spm=1001.2014.3001.5502

重启superset容器,进入容器后

启动redis

nohup redis-server > ./redis.log &

启动celery beat

nohup celery --app=superset.tasks.celery_app:app beat > ./celery_beat.log &

启动celery worker 

nohup celery --app=superset.tasks.celery_app:app worker --pool=prefork  --max-tasks-per-child=128 -O fair -c 4 > ./celery.log &

celery相关可自行搜索相关知识,相关连接参考superset缩略图https://blog.csdn.net/LeeZed/article/details/121223296https://blog.csdn.net/LeeZed/article/details/121223296?spm=1001.2014.3001.5502

警告与报告

  • 警报与报告

  •  根据需求添加警报与报告

  • 查看运行日志

 

错误(535, b'Error: authentication failed') 是SMTP配置问题,如果出现,检查相关配置。 

测试通过

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值