Commit 655e15b3 authored by Dainius Simelevicius's avatar Dainius Simelevicius
Browse files

references #186: retrieving 'args' from error/alarm database, hotspotmailer.py filtering out alarms

parent 099554af
......@@ -18,10 +18,10 @@
// !!! Edit this line to reflect the latest package version !!!
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_VERSION_MAJOR 4
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_VERSION_MINOR 2
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_VERSION_MINOR 3
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_VERSION_PATCH 0
// If any previous versions available E.g. #define WORKSUITE_SENTINELSPOTLIGHTOCCI_PREVIOUS_VERSIONS "3.8.0,3.8.1"
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_PREVIOUS_VERSIONS "4.1.0,4.1.1"
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_PREVIOUS_VERSIONS "4.1.0,4.1.1,4.2.0"
//
......
......@@ -186,6 +186,7 @@ void sentinel::spotlightocci::Application::inject(xgi::Input * in, xgi::Output *
std::string unamespace = "urn:jobcontrol:jid";
std::string uvalue = "34";
std::string group = this->getApplicationDescriptor()->getAttribute("group");
std::string args;
cgicc::Cgicc cgi(in);
cgicc::const_form_iterator fi = cgi.getElement("identifier");
......@@ -234,6 +235,11 @@ void sentinel::spotlightocci::Application::inject(xgi::Input * in, xgi::Output *
{
uvalue = (*fi).getValue();
}
fi = cgi.getElement("args");
if (fi != cgi.getElements().end())
{
args = (*fi).getValue();
}
xcept::Exception exception1 ( "toolbox::exception::TestLowLevel", "low level", __FILE__, __LINE__, __FUNCTION__);
xcept::Exception exception2( "xoap::exception::TestMidLevel", "mid level", __FILE__, __LINE__, __FUNCTION__, exception1);
......@@ -243,13 +249,14 @@ void sentinel::spotlightocci::Application::inject(xgi::Input * in, xgi::Output *
xcept::Exception exception6( identifier, "this is an exception", __FILE__, __LINE__, __FUNCTION__, exception5);
xcept::Exception exception7( identifier, "this is an exception", __FILE__, __LINE__, __FUNCTION__, exception6);
exception7.setProperty("notifier",notifier);
exception7.setProperty("severity",severity);
exception7.setProperty("urn:xdaq-application:class",className);
exception7.setProperty("tag",tag);
exception7.setProperty("urn:xdaq-application:instance",instance);
exception7.setProperty(unamespace,uvalue);
exception7.setProperty("notifier",notifier);
exception7.setProperty("severity",severity);
exception7.setProperty("urn:xdaq-application:class",className);
exception7.setProperty("tag",tag);
exception7.setProperty("urn:xdaq-application:instance",instance);
exception7.setProperty(unamespace,uvalue);
exception7.setProperty("urn:xdaq-application:group",group);
exception7.setProperty("args",args);
repository_->store(exception7);
......
......@@ -1801,7 +1801,7 @@ toolbox::TimeVal sentinel::spotlightocci::DataBase::lastStoredEvents
// make a full precision time comparison afterwards
selectCatalogStmt << "select * from (select event.*,dateTime,identifier,occurrences,notifier,severity,message"
<< ",schema,sessionid,tag,version,class,instance,lid,context,groups,service,zone,uuid"
<< ",schema,sessionid,tag,version,class,instance,lid,context,groups,service,zone,uuid,args"
<< " from event left join catalog on (event.exception=catalog.uniqueid)"
<< " left join xdaq_application on (catalog.uniqueid=xdaq_application.uniqueid)"
<< " where storeTime>" << std::fixed << std::setprecision(6) << (double)since << " ORDER BY storeTime) where rownum <= " << scatterReadNum_;
......
......@@ -304,7 +304,8 @@ void sentinel::spotlightocci::Repository::lastStoredEvents
*out << "{\"key\":\"notifier\", \"type\":\"string\"},";
*out << "{\"key\":\"context\", \"type\":\"string\"},";
*out << "{\"key\":\"message\", \"type\":\"string\"},";
*out << "{\"key\":\"class\", \"type\":\"string\"}";
*out << "{\"key\":\"class\", \"type\":\"string\"},";
*out << "{\"key\":\"args\", \"type\":\"string\"}";
*out << "],";
// rows (data)
......
......@@ -72,7 +72,7 @@ while 1:
print("response.status = " + response.status, "response.reason = " + response.reason)
exit()
connection.close()
events = json.loads(result)
lastStoreTime = events["lastStoreTime"]
print("lastStoreTime = '" + lastStoreTime + "'")
......@@ -86,22 +86,24 @@ while 1:
exit()
connection.close()
exception = json.loads(result)
severity = row["severity"]
severity_icon = ""
if severity in severity_icons:
severity_icon = severity_icons[severity] + " "
message_text = urllib.parse.unquote(row["message"])
message = MIMEMultipart("alternative")
message["Subject"] = severity_icon + severity + ": " + message_text
message["From"] = local_address
message["To"] = egroup_address
body = MIMEText(display_exception_to_html(exception), "html")
message.attach(body)
email_server = SMTP("cernmx.cern.ch", 25)
email_server.starttls()
email_server.sendmail(local_address, egroup_address, message.as_string())
email_server.quit()
args = row["args"]
if args != "alarm":
severity = row["severity"]
severity_icon = ""
if severity in severity_icons:
severity_icon = severity_icons[severity] + " "
message_text = urllib.parse.unquote(row["message"])
message = MIMEMultipart("alternative")
message["Subject"] = severity_icon + severity + ": " + message_text
message["From"] = local_address
message["To"] = egroup_address
body = MIMEText(display_exception_to_html(exception), "html")
message.attach(body)
email_server = SMTP("cernmx.cern.ch", 25)
email_server.starttls()
email_server.sendmail(local_address, egroup_address, message.as_string())
email_server.quit()
time.sleep(10)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment