- 01 May 2018
- 4 Minutes à lire
-
Impression
-
SombreLumière
-
PDF
Azure API Apps
- Mis à jour le 01 May 2018
- 4 Minutes à lire
-
Impression
-
SombreLumière
-
PDF
In this article, we will take a detailed look at 2 different scenarios of setting up monitoring of an API app.
- Scenario 1 - Check for the Expected State
- Scenario 2 - Check Endpoint availability
Scenario 1 - Check for the Expected State
Let's say we have an API app that is up and running in the Azure Portal. The API app has multiple URL endpoints associated. You can set up monitoring only on the API app and get updates from BizTalk360 when the API app is in a different state (disabled). Follow the steps as shown below to monitor the health of the API app.
- Log in to the BizTalk360 application
- Click 'Monitoring' in the navigation panel
- Click the expand button against 'Manage Mapping' tab and select the 'Azure Services' link
- Select the Alarm name (Creating an alarm) from the drop down for which you would like to associate the alerts
- Choose the Azure subscription from the drop down
- Select the API Apps tab. This will list the API Apps that are created under the selected subscription
- Let's say, we want to monitor the BT360ApiAppsDemo API app from the list of available API Apps
- Select the check box against the BT360ApiAppsDemo API app. From the Expected State drop down, choose the expected state of the API app in order to set up monitoring. Let's say, we expect the API app to be Enabled at all time.
Setting the expected state will automatically start monitoring the API app. BizTalk360 monitoring service will automatically compare the current state of the API app with the expected state and display the status (as Healthy or Error). If the expected state matches with the current state, you will notice the status of the API app as Healthy (in green color). If there is a state mismatch, the status of the API app will be displayed as Error (in red color).
In order to receive email notifications from BizTalk360 on the threshold violation alerts (and auto correction alerts), you need to configure the SMTP settings under BizTalk360 Settings. Follow the steps in this article to be able to configure the SMTP settings in BizTalk360. You will receive an email notification with the exact details of the status of the API app.
- The monitoring dashboard will reflect the health of the Azure services as shown in the image below
Scenario 2 - Check Endpoint availability
For this scenario, lets monitor the API based on the return code and response time alerts. If the API endpoint is in a healthy state, the URL will return a 200 return code. If we do not get the 200 return code, the status of the monitoring will be displayed as Error. Let's set a warning alert if we do not receive the response from the endpoint in 2 seconds and an error alert if we do not receive the response from the endpoint in 7 seconds.
For the above scenario, lets assume the following results vs. the actual values.
Return Code Setting | Returned Value | Set Value |
---|---|---|
Return Code Alerts | 200 | 200 |
Response Time Alerts | < 2 seconds |
Follow the steps as shown below to monitor API app endpoints.
- Log in to the BizTalk360 application
- Click 'Monitoring' in the navigation panel
- Click the expand button against 'Manage Mapping' tab and select the 'Azure Services' link
- Select the Alarm name (See Creating an alarm) from the drop down for which you would like to associate the alerts
- Choose the Azure subscription from the drop down
- Select the API Apps tab. This will list the API Apps that are created under the selected subscription.
- Let's say, we want to monitor the BT360ApiAppsDemo API app from the list of available API Apps
- Select the check box against the corresponding API of the BT360ApiAppsDemo API app, say, /api/Dev/. Click the Configure API App Endpoints button. This will open a new blade.
The Friendly Name and Endpoint URL fields will automatically be pre-populated with the information about the API. Enable Monitoring (by toggling the Enable Monitoring toggle bar) for the API app web endpoint.
- Click Next to navigate to the next section. In the Configuring API App Endpoints - Optional Details blade, since the API requires a payload input (for the "id" field), let's define the payload information in the Payload section. Enter the key as id and value as 1. This means that were are executing the API to retrieve (GET) the first record from the list of values.
Click Next to navigate to the Response alert configuration screen Choose the response format as JSON. Toggle the Return Code Alerts to active state. Set the return status code to 200, expected status to must be Present, and Else to throw Error. The Response Time Alerts will be enabled by default. You can leave it to the default values of 2 seconds (warning) and 7 seconds (error) respectively, or you can modify the values based on your requirement. As per our scenario (since it matches the default setting), let's leave it in the default setting.
- Click OK to start monitoring the endpoint
- The monitoring dashboard will reflect the health of the Azure services as shown in the image below
In this case, the Current Status of the web endpoint will be displayed as Healthy. This is because the return code value matches the set value and the response time was well within the warning and error level. The endpoint summary will display the state as Healthy for both Return Code Alerts and Response Time Alerts.