Skip to content
Snippets Groups Projects
Commit 2bc67ce3 authored by Brian Moe's avatar Brian Moe
Browse files

Separate Test events alerts email list / ping give host name

parent 2cf5e184
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,12 @@ def issueAlert(event, location): ...@@ -14,6 +14,12 @@ def issueAlert(event, location):
issueEmailAlert(event, location) issueEmailAlert(event, location)
def issueEmailAlert(event, location): def issueEmailAlert(event, location):
if event.group.name == 'Test':
fromaddress = settings.ALERT_TEST_EMAIL_FROM
toaddress = settings.ALERT_TEST_EMAIL_TO
else:
fromaddress = settings.ALERT_EMAIL_FROM
toaddress = settings.ALERT_EMAIL_TO
subject = "[gracedb] %s event. ID: %s" % (event.get_analysisType_display(), event.graceid()) subject = "[gracedb] %s event. ID: %s" % (event.get_analysisType_display(), event.graceid())
message = """ message = """
New Event New Event
...@@ -33,23 +39,20 @@ def issueEmailAlert(event, location): ...@@ -33,23 +39,20 @@ def issueEmailAlert(event, location):
event.wikiurl(), event.wikiurl(),
event.submitter.name, event.submitter.name,
location) location)
fromaddress = settings.ALERT_EMAIL_FROM send_mail(subject, message, fromaddress, toaddress)
to = settings.ALERT_EMAIL_TO
send_mail(subject, message, fromaddress, to)
def issueXMPPAlert(event, location): def issueXMPPAlert(event, location):
# XXX awful! # XXX awful!
# Need a good way to know which things to send out to lvalert.
# Currently, only Test/* and CBC/MBTAOnline get alerts.
if event.analysisType != 'MBTA' and event.group.name != 'Test': if event.analysisType != 'MBTA' and event.group.name != 'Test':
return return
env = {} env = {}
env["PYTHONPATH"] = ":".join(sys.path) env["PYTHONPATH"] = ":".join(sys.path)
if event.analysisType == 'MBTA' and event.group.name == 'CBC': nodename = "%s_%s"% (event.group.name, event.get_analysisType_display())
nodename = "cbc_mbta_online" nodename = nodename.lower()
else:
nodename = "%s_%s"% (event.group.name, event.get_analysisType_display())
nodename = nodename.lower()
null = open('/dev/null','w') null = open('/dev/null','w')
p = Popen( p = Popen(
...@@ -74,22 +77,6 @@ def issueXMPPAlert(event, location): ...@@ -74,22 +77,6 @@ def issueXMPPAlert(event, location):
else: else:
break break
#def issueAlertX(event, location):
# username = "gracedb"
# server = "lvalert.phys.uwm.edu"
# resource = "sender"
# password = "w4k3upal1ve"
# node = "cbc_mbta_online"
# voevent = createPayload(event.graceid(), location)
#
# myjid=JID(username+"@"+server+"/"+resource)
# recpt=JID("pubsub."+server)
#
# s=MyClient(jid=myjid, password=password, recpt=recpt)
# s.connect()
# s.send_myevent(voevent, node)
# s.loop(1)
def createPayload (uid, filename): def createPayload (uid, filename):
template = """<?xml version='1.0' encoding='utf-8'?> template = """<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE LIGO_LW SYSTEM "http://ldas-sw.ligo.caltech.edu/doc/ligolwAPI/html/ligolw_dtd.txt"> <!DOCTYPE LIGO_LW SYSTEM "http://ldas-sw.ligo.caltech.edu/doc/ligolwAPI/html/ligolw_dtd.txt">
...@@ -105,52 +92,3 @@ def createPayload (uid, filename): ...@@ -105,52 +92,3 @@ def createPayload (uid, filename):
""" """
return template % { 'uid': uid, 'filename': filename } return template % { 'uid': uid, 'filename': filename }
## pubsub import must come first because it overloads part of the
## StanzaProcessor class
#from glue.lvalert import pubsub
#
#from pyxmpp.all import JID, TLSSettings
#from pyxmpp.jabber.all import Client
#
#
#class MyClient(Client):
# def __init__(self, jid, password, recpt):
# # if bare JID is provided add a resource -- it is required
# if not jid.resource:
# jid=JID(jid.node, jid.domain, "sender")
# self.myrecpt = recpt
#
# # we require a TLS connection
# t=TLSSettings(require=True,verify_peer=False)
#
# # setup client with provided connection information
# # and identity data
# Client.__init__(self, jid, password, \
# auth_methods=["sasl:GSSAPI","sasl:PLAIN"], tls_settings=t)
#
# def stream_state_changed(self,state,arg):
# """This one is called when the state of stream connecting the component
# to a server changes. This will usually be used to let the user
# know what is going on."""
# pass
#
# def session_started(self):
# self.stream.set_response_handlers(self.pspl, \
# self.pspl.generic_result,self.pspl.create_error,\
# self.pspl.create_timeout)
# self.stream.send(self.pspl)
#
# def idle(self):
# if self.stream and self.session_established:
# self.disconnect()
# time.sleep(2)
#
# def post_disconnect(self):
# raise Disconnected
#
# def send_myevent(self, voevent, node):
# self.pspl=pubsub.PubSub(from_jid = self.jid, to_jid = self.myrecpt, stream = self, stanza_type="get")
# self.pspl.publish(voevent,node)
# vi: sts=4 et sw=4
...@@ -3,6 +3,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound ...@@ -3,6 +3,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.template import RequestContext from django.template import RequestContext
from django.core.urlresolvers import reverse, get_script_prefix from django.core.urlresolvers import reverse, get_script_prefix
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.contrib.sites.models import Site
from django.views.generic.list_detail import object_detail, object_list from django.views.generic.list_detail import object_detail, object_list
...@@ -161,7 +162,8 @@ def log(request): ...@@ -161,7 +162,8 @@ def log(request):
return response return response
def ping(request): def ping(request):
ack = request.POST.get('ack', None) or request.GET.get('ack','ACK') ack = "(%s) " % Site.objects.get_current()
ack += request.POST.get('ack', None) or request.GET.get('ack','ACK')
response = HttpResponse(mimetype='text/plain') response = HttpResponse(mimetype='text/plain')
response.write(ack) response.write(ack)
response['Content-length'] = len(ack) response['Content-length'] = len(ack)
......
...@@ -4,19 +4,26 @@ DEBUG = True ...@@ -4,19 +4,26 @@ DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
ADMINS = ( ADMINS = (
# ('Your Name', 'your_email@domain.com'), ('Brian Moe', 'bmoe@gravity.phys.uwm.edu'),
) )
MANAGERS = ADMINS MANAGERS = ADMINS
ALERT_EMAIL_FROM = "root@archie.phys.uwm.edu" ALERT_EMAIL_FROM = "Gracedb Alert <root@archie.phys.uwm.edu>"
ALERT_EMAIL_TO = ["patrick@gravity.phys.uwm.edu", ALERT_EMAIL_TO = ["patrick@gravity.phys.uwm.edu",
"larry@gravity.phys.uwm.edu", "larry@gravity.phys.uwm.edu",
"bmoe@gravity.phys.uwm.edu", "bmoe@gravity.phys.uwm.edu",
'Frederique Marion <marionf@lapp.in2p3.fr>', 'Frederique Marion <marionf@lapp.in2p3.fr>',
"Benoit MOURS <mours@lapp.in2p3.fr>", "Benoit MOURS <mours@lapp.in2p3.fr>",
"Jonah Kanner <jkanner@umd.edu>",
] ]
ALERT_TEST_EMAIL_FROM = "Gracedb TEST Alert <root@archie.phys.uwm.edu>"
ALERT_TEST_EMAIL_TO = ["patrick@gravity.phys.uwm.edu",
"larry@gravity.phys.uwm.edu",
"bmoe@gravity.phys.uwm.edu",
]
DATABASE_ENGINE = 'mysql' DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'gracedb' DATABASE_NAME = 'gracedb'
DATABASE_USER = 'gracedb' DATABASE_USER = 'gracedb'
......
...@@ -4,17 +4,22 @@ DEBUG = True ...@@ -4,17 +4,22 @@ DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
ADMINS = ( ADMINS = (
# ('Your Name', 'your_email@domain.com'), ('Brian Moe', 'bmoe@gravity.phys.uwm.edu'),
) )
MANAGERS = ADMINS MANAGERS = ADMINS
ALERT_EMAIL_FROM = "bmoe@uwm.edu" ALERT_EMAIL_FROM = "Dev Alert <root@moe.phys.uwm.edu>"
ALERT_EMAIL_TO = [ ALERT_EMAIL_TO = [
"Brian Moe <bmoe@gravity.phys.uwm.edu>", "Brian Moe <bmoe@gravity.phys.uwm.edu>",
"bmoe@uwm.edu", "bmoe@uwm.edu",
] ]
ALERT_TEST_EMAIL_FROM = "Dev Test Alert <root@moe.phys.uwm.edu>"
ALERT_TEST_EMAIL_TO = [
"Brian Moe <bmoe@gravity.phys.uwm.edu>",
]
DATABASE_ENGINE = 'mysql' DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'gracedb' DATABASE_NAME = 'gracedb'
DATABASE_USER = 'gracedb' DATABASE_USER = 'gracedb'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment