标签:
@ 最近测试 open-falcon.
@ 首先得准备报警接口.
method: post
params:
falcon将这样调用该接口:
url=您公司提供的http邮件接口
curl -X POST $url -d "content=xxx&tos=xxx@gmail.com,user@example.com&subject=xxx"
(r‘^monitor/mail$‘, views.mail),
def mail(request):
content = request.POST.get("content")
tos = request.POST.get("tos")
subject = request.POST.get("subject")
try:
send_mail(subject, content, ‘xxxx@xxx.com‘, [‘%s‘%tos], fail_silently=False)
log = {"log":"ok"}
return HttpResponse(json.dumps(log),content_type=‘application/json‘)
except Exception,e:
error = {"error": e}
return HttpResponse(json.dumps(error),content_type=‘application/json‘)
标签:
原文地址:http://www.cnblogs.com/fengjian2016/p/5515521.html