Raising Alerts and Notifications from Process Servers
Process server alert sources raise alerts when process servers change status. Likewise, process alert sources raise alerts when processes reach a specific status.
They match on two criteria:
- A pattern matching the name of the process server or process.
- The new status of the process server or process.
Alerts will be raised if both Name and Statuses criteria match. Glob matching is done, so the wildcards *
and ?
can be used, just like in Microsoft Windows or UNIX.
Operator message and reply expressions
The operator message to use is specified as an expression that allows substitution parameters. The message can be specified at the alert source level, and overridden per status. If no message is specified at any level, the default message is Acknowledge.
The reply expression works the same way as the reply expression for the System_OperatorMessage process definition. This can be specified at the alert source level, and overridden per status. If no reply expression is specified, the default reply expression is Acknowledge.
Escalation
Escalations send operator messages and emails (via Email Alert Gateways). When a specific condition does not have an escalation, no operator message is sent and the condition is ignored.
When nobody has resolved the alert in a timely fashion, you can escalate the alert to another operator. This is done with escalations.
Process server alert sources use two rules to determine the alert escalation to use:
- An expression to determine a dynamic escalation name. This expression supports
${variable}
substitutions and the Redwood Expression Language syntax for expressions. - A default alert escalation
The expression is always evaluated first. If the escalation returned by the expression exists, then it is used. If it does not exist, then the default is used. This allows the escalation used to be dynamic.
For example, different escalation paths can be defined depending on the new status of a process server:
- Match Name: PS_PRD*
- Expression: PS_PRD_
${newStatus}
- Default: PS_PRD_Alert
- Statuses: Connecting, PartiallyRunning, Shutdown, Unknown
- The following alert escalations are defined: PS_PRD_Connecting, PS_PRD_Shutdown, PS_PRD_Alert
If the new status of a process server named PS_PRD_EMEA_DB2, for example, is:
- Connecting - PS_PRD_Connecting will be tried, found and used.
- Unknown - PS_PRD_Unknown will be tried, but not found, so PS_PRD_Alert will be used.
- Shutdown - PS_PRD_Shutdown will be tried, found and used.
- Running - no alert will be raised.
Customizing Alert Emails
You can customize emails on the Alert Source Email tab, using the following two constructs:
- conditional evaluation
- REL expressions (without the equals (
=
))
Conditional Evaluation
[?if test="expression"?]
text
[?endif?]
REL Expressions
[?=expression?]
Example
<html>
<head><title>Email</title></head>
<body>
Link <a
href="http://prd1.example.com:50200/redwood/api-permalink/show?link-objecttype=[?=alertSourceType?]&link-uniqueid=[?=alertSourceUniqueId?]">alert source</a>
</body>
</html>
Matching Process Servers
You match process servers to fire alerts by specifying patterns. The following patters are available:
Exact
- case-sensitive and case-insensitive exact match.GLOB
- case-sensitive and case-insensitive GLOB match, supports?
and*
wildcards like Windows GLOB, no character ranges, such as[0-9]
or[A-Za-z]
are supported, use regex instead.Regex
- case-sensitive and case-insensitive regular expression (regex) match; uses Java regex.
In regex, you can use positive and negative look ahead expressions (all look ahead expressions in an expression must be met). The general syntax is <expression>[|<expression>]*
where <expression>
is a combination of includes (?=.*(<pattern1>[|<pattern2>]*))
and excludes (?!.*(<pattern1>[|<pattern2>]*))
. The |
is a logical OR.
See Regex Patterns for more information. Note that in the syntax, the backslash character in patterns must be escaped. For example, if you want to use the POSIX alphanumeric character class \p{Alnum}
you specify \\p{Alnum}
.
Regex Examples
For simplicity reasons, these examples use case-sensitive regex, a case-insensitive regex matching abc
, for example, matches abc
, ABC
, AbC
, and so forth.
^(?!.*(abc|def|ghi)).*
- (negative look ahead, an exclude) matches any process server name that does not containabc
,def
, orghi
. The last.*
outside of the brackets defines where the match is done -.*
matches the whole process server name.^(?=.*(jkl|mno|pqr)).*
- (positive look ahead, an include) matches any process server that hasjkl
,mno
, orpqr
in its name and ONLY those. The last.*
outside of the brackets defines where the match is done -.*
matches the whole process server name.^(?=.*(abc|def|ghi))(?!(abcd|defg|ghij)).*
- (positive and negative look ahead) matches any process server that containsabc
,def
, orghi
in its name, except process servers that containabcd
,defg
, orghij
in their names; all look ahead expressions must be met. The last.*
outside of the brackets defines where the match is done -.*
matches the whole process server name.^(?!.*(abc|def|ghi)).*|^(?=.*abc).{1,5}
- (negative look ahead and, alternatively, a positive look ahead in the first 5 characters) excludes any process server that containsabc
,def
, orghi
in its name in the first part of the expression, a second part has been added that includesabc
if it is in the first 5 characters, this will indeed match process servers withabc
in the first 5 characters of the name because it comes after the|
(logical OR).
Procedure
- Navigate to "Alerting > Process Server Alert Sources".
- Choose New Process Server Alert Source from the context-menu.
- Fill in a name into the Name field and a pattern into the Name Pattern field.
- On the Statuses tab, choose Add and select a status in the Status drop-down.
- Repeat the previous step for all required statuses.
- Choose Save & Close.
Example
Raise alerts when any process server enters the Shutdown
, PartiallyRunning
, or Connecting
status.
- Navigate to "Alerting > Process Server Alert Sources".
- Choose New Process Server Alert Source from the context-menu.
- Fill in a name into the Name field and
*
into the Name Pattern field. - On the Sources tab, choose Add and select
Shutdown
in the Status drop-down. - Repeat the previous step for statuses
PartiallyRunning
andConnecting
. - Choose Save & Close.
Raise alerts when process servers whose names start with Finance enter the PartiallyRunning
or Connecting
status.
- Navigate to "Alerting > Process Server Alert Sources".
- Choose New Process Server Alert Source from the context-menu.
- Fill in a name into the Name field and
Finance*
into the Name Pattern field. - On the Sources tab, choose Add and select
Shutdown
in the Status drop-down. - Repeat the previous step for statuses
PartiallyRunning
andConnecting
. - Choose Save & Close.
Alert Source Action to ignore process server PR3_PorcessServer, which is undergoing maintenance
{
// Get the alert information
Alert alert = jcsAlertSourcePostAlertContext.getAlert();
OperatorMessage oMessage = alert.getOperatorMessage();
SchedulerEntity sEntity = oMessage.getSenderObject();
//Check if the process server is PR3
if ("Process Server PR3_ProcessServer".equals(sEntity.getErrorNameEN()))
{
//Optional log entry
jcsOutLog.info(sEntity.getErrorNameEN()+ " was shut down, ignoring alert.");
//Reply to operator message
oMessage.setReply("Acknowledge");
//Set status of alert to acknowledged
alert.setStatus(AlertStatus.Acknowledged);
}
}
note
In the above example, getErrorNameEN()
is used to retrieve the name of the process server because the method is available on SchedulerEntity. However, since it is mainly used for error messages, it has an object type prefix, which we have to take into consideration when we compare the strings. You could look up the business key of the process server and retrieve the name from the ProcessServer class, instead.
See Also
- Triggering Alerts
- Process Alert Sources
- Raising Alerts and Notifications from Processes
- Process Server Alert Sources
- Ad Hoc Alert Sources
- Sending Ad Hoc Alert Sources
- Monitor Alert Sources
ProcessServerAlertSource