cancel
Showing results for 
Search instead for 
Did you mean: 

SAP LVM Automation

JayConnell
Discoverer
0 Kudos

We have a monthly maintenance window where we patch and reboot all of our SAP instances running on Windows both physical and virtual.

I was checking out SAP LVM 2.0 to see how I could automate the stopping of SAP and rebooting of the servers.

I have created a server reboot script and can execute it from operations tab with no problems.

When I setup an automated task the only options I have is to stop/start/restart SAP.

How can I add my server reboot script as an automation task?

I'm hoping I can setup an automations task to run at a scheduled time where I can stop all my instances, reboot the servers and then start them back up at a scheduled time.

Thanks

Jay

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member193371
Participant
0 Kudos

Hello Jay,

here is an intrduction to the customization options for LVM.

The right approach would be a custom hook, that gets executed after the stop of the instance is finished,

as part of a restart operation.

Michael

amandeep_ghotra
Discoverer
0 Kudos


Hi Michael,

I am also having same requierment as original post here. To reboot the server after the SAP instance is stopped.

I tried the approach mentioned by you and was able to run the custom hook. And as a post Hook I ran a command "Shutdown -r -f -c Server will be rebooted -t 600" and it worked as expected. After Instance was stopped this Script ran on the server and server was rebooted.

But it is not robust as this hook will just run the script and no feedback or return code will be checked by LVM. to see if the custom hook have restarted the server and have ran successfully or not.

So, I am looking for option if in Automation of Custom hook can we read the response and LVM task is then set as successfull or unsuccessfull accordingly.

Regards,
Amandeep

Former Member
0 Kudos
Former Member
0 Kudos
amandeep_ghotra
Discoverer
0 Kudos

Hi Christof,

In the meantime I was able to fetch the data from the Custom Hooks.LVM is designed to readt teh response of the cistom hooks. Just you have to be consiuos on the parameters you are using in this hooks to get the response. Follow the SAP note 1396981 - Custom Services Configuration for ACC 7.3/SAP LVM to understand the key words and how to use it.

For example,

the SAPHOSTAGENT configure file should contain the parameters like:

Mode: Sync

ResultConverter: hook

This will make your hook to get the details back to LVM. And in the Script make sure the output somehow mention the keywords (Like RESULT).

For example; Output= System running fine

then in echo you have to mention the result;

echo [RESULT]:%output%

Then the LVM will be able to interpret it as result and shows you in execution log of this script. And somehow you say that if teh script didn't ran correctly and the output should be error.So, somehow you have to add in the echo or output read by the LVM logs the key word. Something like:
echo [ERROR]:Error occurred while rebooting the server.

Here [ERROR] is the key word and your LVM will understand it and in the logs it writes this as log and your the task will go into error. In this way you will be sure whether script executed correctly.

Regards,
Amandeep

Former Member
0 Kudos

Hello Amandeep,

thanks for your feedback and hint. We will try this out as soon

as our LVM ist upgraded to V. 2.0 SP6.

Kind regards

Christof

Former Member
0 Kudos

Jay,

you can define any specific action as a so-called custom hook to be triggered during the process.

For details, see online help.

Dieter

j_bayrhammer
Participant
0 Kudos

Hello Dieter,

I created a provider implementation definition via Setup - Extensibility.

For this defintion I created a custom operation.

But in Automation - Tasks I can not find my defined operation.

I also defined some hooks which I can see in Operations - Hosts in tab Details at Custom Operations.

But how can I use them automated?

We are on Version Enterprise Edition 2.0 SP04_3.

Regards,

Julia

former_member193371
Participant
0 Kudos

Hello Julia,

you find custom operations under the "operations" section of LVM under the instance.

Here you can take a look at where to find them:

As for hooks, they are executed as part of an existing process, e.g. when you do a copy and defined a hook for the clone step, the hook will be executed as part of the clone operation.

Take a look at the above document and linked videos.

Kind Regards

j_bayrhammer
Participant
0 Kudos

Hello Michael,

thanks for your reply and the mentioned hints.

I read your link and I had a look into the youtube videos -> very informative.

But I'm looking for a solution to use own scripts in area automation, which is provided in LVM.

In operation section I can just choose between Start, Stop and Restart. Is it possbile to store own scripts here:

Regards,

Julia

former_member193371
Participant
0 Kudos

Hello Julia,

no, this is not possible. The only way would be to define a hook for an existing function that would get executed as part of an overall process. e.g. you could modify the start/stop function with a hook and then select start/stop in the automation list. Keep in mind to use constraints to restrict the execution of the hook, otherwise your modified start/stop routine will be used on every start/stop operation.

Michael

j_bayrhammer
Participant
0 Kudos

Hello Michael,

for Custom Provisioning Processes I can add Hooks via Setup - Extensibility - Custom Provisioning Processes. Here I can add customized hooks to the given labels (Storage Clone, e.g. Restore Backup (Target System)).

But there I don't find a start/stop function. I can just edit functions for Storage Clone or System Rename.

Where do I modify this start/stop function with a hook?

Regards,

Julia

former_member193371
Participant
0 Kudos

what are you trying to do ? Create a custom provisioning or modify an existing function ?

an existing function can be modified with a hook under setup/custom hook.

Custom provisioning is meant to replace the clone functions of LVM and can be  defined under custom provisioning.

j_bayrhammer
Participant
0 Kudos

Hello Michael,

ok, if I understand your answer correct process would be as following:

I create a hook via Setup - Extensibility - Custom Hook with hook type "Pre Hook" and Entity Type "Host". There I add a constraint "Process Type (static)" with Operator "=" and Value "Start" (for security reasons I should add constraint Network (static) with value of my operating system, that action is performed only with this system).

If I create a an automation now which uses a sequential operation task with operation type "normal" and operation "Start", my hook will be executed before?!

Regards,

Julia

former_member193371
Participant
0 Kudos

Hi,

generally yes. BUT 😉 you should define as many constraints as possible. Keep in mind this is the global start function used in every procedure inside LVM so when you modify it your modifications will apply to "EVERY" start operation. To avoid problems, define  very restrictive constraints. also please test it in a non productive environment.

Good luck

j_bayrhammer
Participant
0 Kudos

Hello Michael,

I will try this.

Thank you for your assistance,

Regards,

Julia