目前,创建警报策略时在文档字段中指定的消息显示在 Stackdriver 警报电子邮件的文档字段中。我想用我的自定义内容覆盖整个电子邮件正文。如何使用自定义消息覆盖 Stackdriver Alert 电子邮件的消息正文?有没有其他解决方法可以做到这一点?
我正在尝试使用此处给出的说明在 nginx 后面设置 Airflow。
气流.cfg 文件
base_url = https://myorg.com/airflow
web_server_port = 8081
.
.
.
enable_proxy_fix = True
Run Code Online (Sandbox Code Playgroud)
nginx配置
server {
listen 443 ssl http2 default_server;
server_name myorg.com;
.
.
.
location /airflow {
proxy_pass http://localhost:8081;
proxy_set_header Host $host;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Proto "https";
}
}
Run Code Online (Sandbox Code Playgroud)
Airflow Web 服务器和调度程序已启动并作为 systemd 运行。当我尝试访问https://myorg.com/airflow/时,它给出了 Airflow 404 = 很多圆圈。
可能出什么问题了?非常感谢您为运行此程序提供的帮助。
我已经使用 on_success_callback 和 on_failure_callback 实现了关于成功和失败的电子邮件警报。
根据气流文档,
上下文字典作为单个参数传递给此函数。
如何将另一个参数传递给这些回调方法?
这是我的代码
from airflow.utils.email import send_email_smtp
def task_success_alert(context):
subject = "[Airflow] DAG {0} - Task {1}: Success".format(
context['task_instance_key_str'].split('__')[0],
context['task_instance_key_str'].split('__')[1]
)
html_content = """
DAG: {0}<br>
Task: {1}<br>
Succeeded on: {2}
""".format(
context['task_instance_key_str'].split('__')[0],
context['task_instance_key_str'].split('__')[1],
datetime.now()
)
send_email_smtp(dag_vars["dev_mailing_list"], subject, html_content)
def task_failure_alert(context):
subject = "[Airflow] DAG {0} - Task {1}: Failed".format(
context['task_instance_key_str'].split('__')[0],
context['task_instance_key_str'].split('__')[1]
)
html_content = """
DAG: {0}<br>
Task: {1}<br>
Failed on: {2}
""".format(
context['task_instance_key_str'].split('__')[0],
context['task_instance_key_str'].split('__')[1],
datetime.now()
)
send_email_smtp(dag_vars["dev_mailing_list"], subject, html_content)
default_args …Run Code Online (Sandbox Code Playgroud) 我是yii的新手.我很难设置yii2.0高级并试图运行简单的hello程序.
我在后端/ Controllers/SiteController.php中添加了以下代码
public function actionSay($message = 'Hello')
{
return $this->render('say',['message' => $message]);
}
Run Code Online (Sandbox Code Playgroud)
然后,我使用以下代码在backend/views/site /中创建了say.php文件
<?php
use yii\helpers\Html;
?>
<?= Html::encode($message) ?>
Run Code Online (Sandbox Code Playgroud)
我输入../yii2hello/backend/web/index.php?r=site/say&message=Hello+World浏览器来访问该页面.
我收到了403错误 "you are not allowed to perform this action."
谁能告诉我问题出在哪里?