VMware Cloud Community
Jamison618
Contributor
Contributor
Jump to solution

Enable / Disable vCenter Alarm Actions on an ESXi Host

Hello,

I'm building a workflow that I need to temporarily disable alarm actions on a host.  Would someone be kind enough to post a code snippet that I could create an action with?  I have a PS script I made but I'm a noob with JavaScript. 

The input being esxHost (VC:HostSystem)

Thanks in advance!

Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Here is some code to enable / disable alarm actions on a host:

// Disable alarm actions on 'host'

var alarmMgr = host.sdkConnection.alarmManager;

alarmMgr.enableAlarmActions(host, false);

// Enable alarm actions on 'host'

var alarmMgr = host.sdkConnection.alarmManager;

alarmMgr.enableAlarmActions(host, true);

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

Was it helpful? Let us know by completing this short survey here.

View solution in original post

2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Here is some code to enable / disable alarm actions on a host:

// Disable alarm actions on 'host'

var alarmMgr = host.sdkConnection.alarmManager;

alarmMgr.enableAlarmActions(host, false);

// Enable alarm actions on 'host'

var alarmMgr = host.sdkConnection.alarmManager;

alarmMgr.enableAlarmActions(host, true);

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

Was it helpful? Let us know by completing this short survey here.

rkuechler
Enthusiast
Enthusiast
Jump to solution

Post updated:

I asked for an action which queries if ESXi host alarm action are enabled?
I think, this could work:

 

 

 

var sdkConnection = [VC:HostSystem].sdkConnection;
return sdkConnection.alarmManager.areAlarmActionsEnabled([VC:HostSystem]);

 

 

 

 

 

Reply
0 Kudos