Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
jaskisin
Participant
0 Kudos
This is in continuation of my previous Article Auto Scaling of SAP Systems on Azure - Part VI

4.7 Create Alert Rule


4.7.1 Create Alert Rule for Scale Out


As we have setup the Action group for Scaling out of SAP System, now we need to setup the alert rules for the same.

Todo the same we need to goto Log Analytics Workspace à Logs à Run below query and then click on New Alert Rule


Now we need to specify the Condition about the Alert by clicking on Add Condition


Here we need to specify the Alert Logic and Evaluation based on settings which is responsible for tuning the triggering the alert to actions groups and click on Done


Once the Condition has been met then we can see the Green tick button on the with the condition description


Now we need to add the action groups to the alert so that action can be taken by the Azure Monitor. To do so click on Add action groups


It will show all the action groups that can be assigned to the alert, here we have created the alert for the Scaling out of the SAP system, hence we need to select the action group for Scale out and then click on Select



We need to further specify the details of the scale-out alerts and then click on Create alert rule


Once the Alert rule is created and active then we can see the below screen.


Now our Scale-out alert with Actions group is in place to perform the Scaling-out of SAP system.

4.7.2 Create Alert Rule for Scale down


Similar like the scale out setup, we need to do the same for the scale down of the SAP system, to do so we need to goto the Log Analytics WorkscapeàLogsàspecify the query and then click on New Alert Rule


Then it will open a window on which we need to fill the details on the alert that we need to specify and then click on Condition


Specify the Alert Logic and Evaluation settings for the Alert and click on Done


We can see the green tick once the condition has been completely set.


Now we need to click on Add Action group and then specify the Scale down action group


Specify the other details of the Alert rule for SAP Scale down and then click on Create Alert Rule


We can see that Alert rule has been created for scaling down of SAP System


Now, our Alert rule for Scaling Down of SAP system is ready

4.8 Deploying Azure Automation Runbooks


Now we need to deploy the Azure Automation Runbooks which will be called for the performing Auto Scaling of the SAP system according to the situation.

4.8.1 SAP Scale Out


We need to create one Runbooks which will be responsible for performing various actions which will do the Scale out of SAP system. To do the same we need to open Azure Automation Account à Runbooks and then click on Import a runbook


Specify the details which are required for importing the Runbook and then click on Create


Runbook File -- The file must be a PowerShell Workflow (.ps1), PowerShell script (.ps1), graphical runbook (.graphrunbook) or Python script (.py) smaller than 1 MB. You can use any language, we are using ps1 here

Name – A runbook name can contain only letters, numbers, underscores, and dashes, and must begin with a letter

Runbook Type – Need to select the type of runbook we want to create, We are choosing PowerShell runbooks as they are text runbooks based on Windows PowerShell. We can choose any type according to our language

We have specified the attached ps1 file and clicked on create, once the runbook is published then it will be seen as below: -


We can see/edit the script using Edit Option in Runbooks: -


Below are the tasks which will be taken care by this automation runbook: -

  • Authenticate the execution with the Azure Run as connection for performing actions

  • Read configuration table settings which is stored in the storage account. Parameters mentioned in the table will used going forward

  • Check if current application count is less than the max count mentioned in the table

  • Deploy additional VM which will act as application server for SAP system using below details: -

    • VNet details will be fetched from configuration table

    • VM size, image id, NIC etc. will be fetched from the template parameter json file which is placed in storage account

    • ARM template uri file will be fetched from the storage account for VM deployment

    • ARM template parameter uri file will be fetched from the storage account for VM deployment



  • Run Custom script using Azure VM Extension, responsibility for the script is below: -

    • Backup of current home directory for sidadm

    • Renaming the environment variable files from old to new hostname

    • Backup of sapservice file and change hostnames to it

    • Backup of sap profile file and change hostnames to it

    • Stop the SAP Service using sapcontrol utility

    • Start the SAP Service and wait for the service to start properly using sapcontrol utility

    • Start SAP application and wait for the application to start properly using sapcontrol utility



  • Update the current count of application servers back to the configuration table in account storage

  • Call Logic app with request URI for adding server to the logon groups and server groups


4.8.2 SAP Scale Down Un-Register


Now we need to create another automation runbook which will be responsible for unregistering the AAS system from PAS. This runbook will not stop SAP system on the AAS. Using this Runbook we can stop users from using the AAS.

We have specified the attached ps1 file and clicked on create, once the runbook is published then it will be below: -


We can see/edit the script using Edit Option in Runbooks: -


Below are the tasks which will be taken care by this automation runbook: -

  • Authenticate the execution with the Azure Run as connection for performing actions

  • Read configuration table settings which is stored in the storage account. Parameters mentioned in the table will used going forward

  • Check if current application count is more than the min count mentioned in the table

  • Call Logic app with request URI for removing system from the logon groups and server groups

  • According to the timeout parameter mentioned in the configuration table schedule the delete run book to be executed


4.8.3 SAP Scale Down Delete


Now we need to create another automation runbook which will be responsible for deleting the resources which were used by the AAS server. As user are already restricted by the Unregister Runbook, hence this runbook will not stop SAP system on the AAS. Delete all the resources from the Azure infrastructure associated with AAS host

We have specified the attached ps1 file and clicked on create, once the runbook is published then it will be below: -


We can see/edit the script using Edit Option in Runbooks: -


Below are the tasks which will be taken care by this automation runbook: -

  • Authenticate the execution with the Azure Run as connection for performing actions

  • Run Custom script using Azure VM Extension, responsibility for the script is below: -

    • Stop SAP System using sapcontrol utility on host

    • Wait for the application to be completely stopped



  • Remove VM from the Resource group

  • Remove NIC which are associated with the VM from the Resource Group

  • Remove Public IP(if any) which is associated with the NIC from the Resource Group

  • Remove Disks which are associated with the VM from the Resource Group

  • Update the configuration table with the new application server count

  • Remove the schedule of the delete runbook from Azure Automation


This is end of Part – VII, in next part Auto Scaling of SAP Systems on Azure - Part VIII of his article you can find more information about Deployment and Configuration of Testing, Logs and Troubeshooting of this Solution.
  • SAP Managed Tags:
Labels in this area