clamaz
Contributor
Contributor

alarm to start a VM if it is powered off or shut down

Hallo, I 'm trying to set up an alarm in vcenter 6.7, to start a VM if it is powered off or somebody has shutdown it.

Sometimes users shutdown this VM (used as virtual desktop win10), and than they call me to power on VM again.

I set an alarm on VM, but it doesn't work. If I shutdown this VM, than it does not  turn on again after shutdown, even if I set this alarm/rule.

I have created alarm with this options:

If  guest OS shutdown, then trigger alarm and show as warning > PowerOn VM > enable
also tried
If  VM powered off, then trigger alarm and show as warning > PowerOn VM > enable

no results. VM remains powered off.

Any idea?

Thank you

 


alarmVM.JPG

0 Kudos
10 Replies
scott28tt
VMware Employee
VMware Employee

@clamaz 

Moderator: Moved to vSphere Discussions - not specific to ESXi


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
Przemko1
Contributor
Contributor

I know that its not directly answer your question but why dont you block shutdown option via GPO ?

0 Kudos
clamaz
Contributor
Contributor

Hi Przemko,

Thank you for your suggestion, but I need to act in that way. GPO is not a solution in this case.
Sometimes it is correct that user have to shutdown VM.

But I need to control in this way. I have asked why I am not able to trigger this function via alarm.

 

 

0 Kudos
scott28tt
VMware Employee
VMware Employee

@clamaz 

I believe your alarm isn’t working as your users are not carrying out a “Guest OS shutdown” task through vSphere - they’re doing that directly through Windows and vSphere has no idea why the VM goes to a powered off state.

Perhaps the answer is to have a script running which sends a PING to the FQDN of the guest OS and it does not get a response it sends a VM power on request to your vCenter Server. This may be possible with PowerCLI, would you like me to move this thread to the PowerCLI area here? (As a moderator)

An alternative (I think) is to deploy something like Horizon and use desktop pools, it can keep track of the number of available VMs and manage them for you.

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
clamaz
Contributor
Contributor

Hi Scott,

the target is to keep this vm on, if for some reason it is powered off.

So every (simply) solution will be apreciated..

Thank you

 

 

0 Kudos
scott28tt
VMware Employee
VMware Employee

@clamaz 

I understood that, mentioned why I think your alarm isn't working, and have offered a couple of suggestions - what else are you expecting exactly?

 

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
clamaz
Contributor
Contributor

Hi Scott,

you talk about to move question to powercli area.

Maybe, somebody could help me, there.

Thank you

 

0 Kudos
clamaz
Contributor
Contributor

Just another think Scott,

alarm partially works, because it logs "warning" for shutdown or powered off VM, but.... then it doesn't start VM again, as I set in alarm rule.

1a.PNG

0 Kudos
scott28tt
VMware Employee
VMware Employee

@clamaz 

My guess is that the action cannot be carried out because the guest is still shutting down and the power state of the VM is still "on".

This should help - try changing the alarm trigger to VM powered offhttps://kb.vmware.com/s/article/1026818

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
clamaz
Contributor
Contributor

Great Scott!!!

It works with VM powered off option.

I have made a shutdown from windows 10 guest OS, and after power off, vm is started again.

but....

After this automated triggered start, if I try to shut down VM again, it shuts down but it doesn't restart automatically.

In vcenter console, I see yellow warning. I can acnowledge it or reset to green, but VM stay off.

I have to manually start it.
It seems this alarm setting, works only one time

0 Kudos