|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ebay.carad.os.vitalsigns.listeners.AbstractReportingListener com.ebay.carad.os.vitalsigns.listeners.EmailAlertListener
public class EmailAlertListener
Report listener that can send email alerts for ReportingExceptions and for data that is recorded that is out of the expected range.
Field Summary | |
---|---|
private float |
lastObservedValue
|
private float |
mDataLevel
|
private java.lang.String |
mErrorType
|
private java.text.Format |
mExceptionMessageFormat
|
private java.lang.String |
mFromAddress
|
private java.text.Format |
mLevelMessageFormat
|
private java.lang.String |
mMailServer
|
private java.lang.String |
mMessageSubject
|
private java.lang.String[] |
mToAddresses
|
private boolean |
rememberValues
|
Constructor Summary | |
---|---|
EmailAlertListener()
|
Method Summary | |
---|---|
void |
alert(java.lang.String msg)
|
private java.lang.String |
getExceptionString(ReportingException exception)
|
private java.lang.String |
getLocalMachineName()
|
private boolean |
isAlertNeeded(IDashboardReport report)
|
void |
reportingException(ReportingException exception,
IReportingListenerContainer agent,
IDashboardReport report)
Receives parameters: |
void |
reportRan(IDashboardAgent agent,
IDashboardReport report)
Receives parameters: |
void |
setErrorType(java.lang.String errorType)
|
void |
setFromAddress(java.lang.String address)
Sets the address that mail alerts will appear to come from. |
void |
setMailServer(java.lang.String server)
Sets the address of the SMTP relay to use. |
void |
setRememberValues(boolean rememberValues)
If true, the listener will only send an email if the currently observed value is outside the threshold, AND is "worse" than the last observed value. |
void |
setSubject(java.lang.String inSubject)
Sets the subject line for alerts sent by this handler. |
void |
setThreshold(float dataLevel)
|
void |
setToAddresses(java.lang.String[] inToAddresses)
Sets the addresses that mail alerts will be sent to. |
Methods inherited from class com.ebay.carad.os.vitalsigns.listeners.AbstractReportingListener |
---|
reportingComplete, reportingPreStart |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private float mDataLevel
private java.lang.String mErrorType
private java.text.Format mExceptionMessageFormat
private java.text.Format mLevelMessageFormat
private java.lang.String mMailServer
private java.lang.String[] mToAddresses
private java.lang.String mFromAddress
private java.lang.String mMessageSubject
private boolean rememberValues
private float lastObservedValue
Constructor Detail |
---|
public EmailAlertListener()
Method Detail |
---|
public void setRememberValues(boolean rememberValues)
rememberValues
- if true, emails will only be sent when values got "worse" than last observationpublic void setMailServer(java.lang.String server)
server
- IP address or hostname of SMTP relaypublic void setFromAddress(java.lang.String address)
address
- the address to send frompublic void setToAddresses(java.lang.String[] inToAddresses)
inToAddresses
- the "to" e-mail addressespublic void setSubject(java.lang.String inSubject)
inSubject
- subject line for alertspublic void alert(java.lang.String msg)
public void reportingException(ReportingException exception, IReportingListenerContainer agent, IDashboardReport report)
{ 0 : report.getPreviousData(), 1 : report.getThisRunData(), 2 : report.getTitle(), 3 : report.getID(), 4 : exception.getMessage(), 5 : full exception details, including stack trace, as string 6 : new Date().toString() }
reportingException
in interface IReportingListener
reportingException
in class AbstractReportingListener
public void reportRan(IDashboardAgent agent, IDashboardReport report)
{ 0 : report.getPreviousData(), 1 : report.getThisRunData(), 2 : this.errorType (i.e. WARNING / ERROR), 3 : report.getTitle(), 4 : report.getID(), 5 : this.dataLevel 6 : new Date().toString() }
reportRan
in interface IReportingListener
reportRan
in class AbstractReportingListener
private java.lang.String getLocalMachineName()
private boolean isAlertNeeded(IDashboardReport report)
private java.lang.String getExceptionString(ReportingException exception)
public void setErrorType(java.lang.String errorType)
public void setThreshold(float dataLevel)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |