Alerts are generated by OSB monitoring framework and they help to diagnose problems when they occur. Oracle Service Bus provides two types of alerts:
SLA Alerts
Pipeline Alerts
Pipeline alerts can be raised in the message flow of the proxy service. You can use alerts in a message flow for:
Detecting business errors in a message flow.
Indicating business occurrences.
SLA alerts are raised in Oracle Service Bus to indicate potential violation of the Service Level Agreements (SLAs). You can use SLA alerts for:
Monitoring and generating email notification of WS-Security errors
Monitoring the number of messages passing through a particular pipeline
Detecting the violation of service level agreements with third-party products
Detecting a non-responsive endpoint
Consider the following use case to verify the service level agreements:
Assume that a particular proxy service is generating SLA alerts due to slow response time. To investigate this problem, you must log in to the Oracle Service Bus Administration Console and review the detailed statistics for the proxy service. At this level, you can identify that a third-party web service invocation stage in the pipeline is taking a lot of time and is the actual bottleneck.
You can use these alerts as the basis for negotiating SLAs. After successfully negotiating SLAs with the third-party web service provider, you should configure alert metrics to track the web service provider's compliance with the new agreement terms.
There are different ways to add SLA alerts and Business alerts in RSB decorator projects. SLA alerts can be added from OSB console after the decorator has been deployed in a OSB server. Pipeline alerts can be added from either JDeveloper or from OSB console. It is recommended to add pipeline alerts in the OEPE and then export the decorator jar.
RSB decorator jars have a default SLA alert configured for each proxy and business service. The default alert rule name is ErrorCountRule. This alert is configured to generate an SLA alert whenever an error condition occurs in the message flow. This is just a sample SLA alert. It is recommended to delete this rule and create a new rule for the actual SLA criteria for that environment.
SLA alerts are operational settings and they can be added or modified only from OSB console. Follow the steps to delete the default alert rule and add a new rule:
Log in to OSB console and access the Projects page.
Click the project for which you want to modify SLA alert.
The steps to add or modify an SLA alert are same for both business service and proxy service. In this example, we will show steps for a business service. Browse to the business service and go to SLA Alert Rules tab of that service.
Click Create in the Change Center to create a new section.
Select the rule and click Delete. The rule is deleted.
Click add to add a new rule.
Enter appropriate values for Rule Name and Alert Summary fields. It is recommended to have a good summary of why this alert rule should be generated. Having proper description of all fields will be useful when looking at rules in RIC console and it will help better in diagnosing the issues.
For Alert Destination, click browse.
Click Search to display all alert destinations.
Select Alert Destination and click OK.
Click Next. You can build the expression which defines the criteria for alert rule on the next page.
Now in the Condition Builder area, you can build the expression for which you want to generate SLA alert. In this example, we will build an expression to generate an SLA alert whenever the response time of business service is more than one second. Click add.
Select the appropriate values in the condition and click update.
You can build more complex expression using join and split condition buttons to build the rule. After the expression is build, select the condition and click Create.
In the above page, you will see all the details about the new rule. We recommend that the condition expression is copied into the description filed as well, so that when the SLA alert is displayed in RIC, the exact condition of causing the alert is also displayed. The condition expression is not available in RIC, but the description field is available. Therefore we should have a good description for the alert. Follow the steps to copy the condition expression into the description field. To edit the rule and add the description, click edit.
Paste the condition expression into the Rule Description field and click Save.
Click Activate and then Submit to commit the changes in server.
This completes the steps to create new SLA alert rule.
Note: SLA alerts are operational settings and can be added and modified only from OSB console. If the decorator jar is re-deployed on the server, remember that all the operational settings and SLA alerts will be lost. After deploying the new decorators, the SLA alerts will need to be created again. |
Pipeline alerts are also called Business Alerts in RSB context. The reason for calling them business alerts is that they are used mostly to identify unusual business conditions or errors. For example, a customer may want to see an alert whenever a request is made with a very large amount.
Pipeline alerts can be added in proxy services only. In RSB decorators, the message flow is defined in local proxy services. Therefore any new pipeline alerts should be added in local proxy service.
In this example, we will take an oms-CustomerOrderService where a business alert needs to be raised when grand total > 500000. The following steps are for adding a new pipeline alert:
Drag the Stage component from Components windows.
Enter appropriate name for the stage.
In the stage, add a new If Then flow, drag the If Then component from the Components window to the newly added stage.
For the first If condition, select the If condition and click the <Condition> link in If properties window to access Xquery access expression builder.
In this screen, you can build the expression for the alert rule. Select the request schema element body > createCustomerOrder > CustOrderDesc > grand_total for the operation:
Click Insert into Expression to add to Expression field.
Click OK. Select Condition link from If variable window.
Click Launch Xquery expression builder link next to Operand field. Select body > createCustomerOrder > CustOrderDesc > grand_total and click Insert into Expression. Enter appropriate value in the Value field.
Click OK and then click Add to add the condition.
You can build more complex expression using the And and Or options. After building the condition expression, click OK.
Now we need to add an Alert action for this If condition.
The alert action gets added, right click the If condition added in the above steps, select Insert Into > Alert.
In the Expression field, you can enter the xml that you want to see in alert description when alert is generated. For example, you may want to see the whole SOAP body which caused the alert to be generated or a subset of the SOAP body. Click the <Expression> link in the Alert-Properties window to select the XML.
In this example, we will add CustOrderDesc element to the expression.
Drag CustOrderDesc to the Expression window.
Click OK. In the Summary field, enter an appropriate name for the alert.
Select Destination link from the Alert - Properties window for the Alert. You should select the destination that was created by default in this project.
Click OK to close the dialog box.
This finishes up the steps for adding new business alert to a message flow in a decorator.
The default alert destination created by RSB only sends alerts on OSB reporting provider JMS. The alert destination can also be configured to send email notifications; this will be useful to get immediate notifications for SLA alerts. For generating email notifications first step is to create SMTP server configuration in OSB server. You need to have a SMTP server running and URL, port number information available. Following are the steps to create SMTP server configuration using OSB console:
Create a new session in OSB console.
Go to System > SMTP Servers page.
Right click SMTP Servers and select Create > Create SMTP Server.
Create SMTP Server window is displayed.
Provide a name and URL of the SMTP server. If the SMTP server is running on localhost, then the URL will be localhost.
Enter SMTP port number, generally it is 25.
If it is secured, then provide username/password. Generally it is not required when running on localhost.
Click Save. Click Activate and Submit to commit changes to the server.
This completes the steps for creating SMTP server configuration. Following is a screenshot of this:
After creating SMTP server configuration, we need to update alert destination to use the SMTP server for sending notifications.
Create a new session in OSB console.
Go to Project Explorer tab and browse to the project for which you want to modify the alert destination. In this example, we will update cm-Customer-AppServiceDecorator project. When you click the project; it shows the list of files in that project. The default alert destination follows the naming convention as <appName>-<ServiceName>-AppServiceDecoratorAlert. So the file name here will be cm-Customer-AppServiceDecoratorAlert.
Click the alert destination to go to alert destination configuration page.
In the e-mail Recipients section, click add. In the next page, you need to provide details about senders and receivers of e-mail notifications as shown below:
Mail Recipients: This needs the email addresses of the persons who should receive email notification.
SMTP Server: Select the name of the SMTP server that was created earlier.
From Name: The name of the person on whose behalf the notification is sent.
From Address: Email address of the person on whose behalf the notification is sent.
Reply To Name: Name of the person which should show in reply-to field of the email.
Reply To Address: Email address which should show in reply-to field of email.
Click OK after entering all the values. Click Activate and Submit to commit changes to the server. This completes the steps required for setting up email notifications for alerts.