• Print
  • Share

Azure API Apps

  • Updated on 01 May 2018
  • 5 minutes to read
  • Contributors

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

BizTalk360-Monitoring-Azure-Services-API-Apps.png

  • Choose the Azure subscription from the drop down

If there are no Azure subscriptions mapped to your environment, you will see a warning message as "No Azure Subscriptions Found/Enabled". In that case, you can go to Settings to Add/Enable an Azure subscription

  • Select the API Apps tab. This will list the API Apps that are created under the selected subscription

BizTalk360-Monitoring-Azure-Services-API-Apps-tab-page.png

  • 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.

BizTalk360-Monitoring-Azure-Services-API-Apps-Set-Expected-State.png

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).

BizTalk360-Monitoring-Azure-Services-API-Apps-Current-State-is-Expected-State.png

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.

BizTalk360-Monitoring-Azure-Services-API-Apps-E-mail-Notification.png

  • The monitoring dashboard will reflect the health of the Azure services as shown in the image below

BizTalk360-Monitoring-Azure-Services-API-Apps-Monitoring-Dashboard.png

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

BizTalk360-Monitoring-Azure-Services-API-Apps.png

  • Choose the Azure subscription from the drop down

If there are no Azure subscriptions mapped to your environment, you will see a warning message as "No Azure Subscriptions Found/Enabled". In that case, you can go to Settings to Add/Enable an Azure subscription

  • Select the API Apps tab. This will list the API Apps that are created under the selected subscription.

BizTalk360-Monitoring-Azure-Services-API-Apps-tab-page.png

  • 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.

BizTalk360-Monitoring-Azure-Services-API-Apps-Configure-API-App-Endpoints.png 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.

BizTalk360-Monitoring-Azure-Services-API-Apps-Enable-Endpoint-Monitoring.png

  • 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.

BizTalk360-Monitoring-Azure-Services-API-Apps-Endpoint-Details.png

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.

BizTalk360-Monitoring-Azure-Services-API-Apps-Endpoint-Details2.png

  • Click OK to start monitoring the endpoint

BizTalk360-Monitoring-Azure-Services-API-Apps-API-App-Endpoint-Summary.png

  • The monitoring dashboard will reflect the health of the Azure services as shown in the image below

BizTalk360-Monitoring-Azure-Services-API-Apps-Monitoring-Dashboard2.png

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.