change the setting of the alarm (action)

Hello:

I need to change the settings for my existing alarm by script.  I need add SNMP specific alarm action (I know how to filter by name).

Can anyone help me please with it?

Thank you

qwert

I tested with an alarm which has 1 action (send an email) and the adapted below script seems to work.

$entity = Get-View (Get-Folder -Name "Datacenters").ID
$alarmMgr = get-view AlarmManager

$tgtAlarmName = "Test Alarm"

$alarms = $alarmMgr.GetAlarm($null)
$alarms | % {
     $alarm = Get-View $_
     if($alarm.Info.Name -eq $tgtAlarmName){
          $spec = New-Object VMware.Vim.AlarmSpec
          $spec.Expression = $alarm.Info.Expression
          $spec.Setting = $alarm.Info.Setting
          $spec.Name = $alarm.Info.Name
          $spec.Enabled = $alarm.Info.Enabled
          $spec.Description = $alarm.Info.Description

          $spec.Action = New-Object VMware.Vim.GroupAlarmAction
          $action = New-Object VMware.Vim.AlarmTriggeringAction
          $action.Action = New-Object VMware.Vim.SendSNMPAction
          $trans = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
          $trans.StartState = "yellow"
          $trans.FinalState = "red"
          $action.TransitionSpecs += $trans

          $spec.Action.Action = $alarm.Info.Action.Action
          $spec.Action.Action += $action

          $alarm.ReconfigureAlarm($spec)
     }
}

Note 1: you need not do the LoadWithPartialName more since 1.5 VITK

Note 2: for the AlarmManager Get-view has a direct pointer. No need to go through ServiceInstance more.

Note3: first I copy the existing stock of $alarm.Info.Action and then I add the new $action

Tags: VMware

Similar Questions

  • How can I change the default action of record?

    My laptop with Windows vista has curently explores as the default action (because it does not open in a new window which is my chosen prefrence) and opened as the next option. How can I change the default action to open?

    Hello Nekora,
     
    Thanks for posting on the Community Forums of Microsoft Vista.

    Note: to set Windows Explorer to open in a new window, you must have the disabled Navigation pane.

    To Turn Off the Navigation pane, follow the steps.

    1. click on the toolbar button organize in Windows Explorer.
    2. click on page layout.
    3. Turn Off the Navigation pane - click Navigation pane to turn off highlight the icon.

    Later the value folder always options open the folder in a separate window.

    1. access control panel.
    2. open the Folder Options.
    3. Select the option "open each folder in its own window.
    4. click on apply and Ok.
    5. close the Folder Options and Windows Explorer window when finished.

    Restart the computer and check if it opens in a new window.

    It will be useful.

    Thank you and best regards,

    Srinivas
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Pass String [] (String Array) type of a parameter in 'change the binding Action.

    Hello

    We hope that you do very well. It is very important for me, kindly help me in this beyond.
    I have a scenario where I pass a parameter of type String [] that have a value of {'name'} to a Web service that returns values.

    I created a datacontrol WS, dragged and decreased the value of return on a jspx, then it asks me to give the entry value

    How he move to the setting in "change the binding Action"?
    When I say new String() {'name'}, it gives me the following error
    Failed to create an object of type: [Ljava.lang.String; of type: java.lang.String with value: new String() {'name'}]

    Similarly, I hard-coded this value in a managedBean added to requestScope/applicationScope and questioned using the #{applicationScope.AppCreationBean.epsName}
    But this time, it is said, the value is null. I guess that the value is not updated correctly initialized. But if I hardcode the value in the Get accessor method, I again get the error as above.

    Someone said to me how to pass an array of type String (IE, String []) with a value of 'Name' in the Wizard "Change the binding Action" is?

    Concerning
    RaviKiran

    Hello

    refer to a property of the managed bean that returns an object. Then in the Get method / create the array and return it

    Frank

  • How can I change the alarm sounds?

    The default sound is so annoying in the morning. Is there a way to change the sound of the alarm? I watched a few videos on the sound of the alarm of the Apple Watch on youtube and they had the best sounds. I guess Apple has changed with WOS 2

    Hello

    I fear that it is not currently possible to change the alarm sound on Apple Watch.

    If you want to suggest that Apple considers adding this as a new feature, you can do it here:

    https://www.Apple.com/feedback/watch.html

    All submissions are read (even if you do not expect to receive a response).

  • Changing the default action when you click on an icon.

    When double clicking on a folder icon that opens a search window.  If you right click it, it opens a menu as only normal 'search' at the top, is "BOLD".  How can I change the default action to 'open '?

    Finally got an answer to this one.  A friend, I called did.  In windows Explorer, click Tools, and then select the folder options.

    Under the tab "File Types", select "File Folder", then click "Advanced".

    This will allow you to change the settings of the menu file type.

  • How can I change the default actions of what made the PC when I connect a camera, USB key, etc.?

    How can I change the default actions of what made the PC when I connect a camera, USB key, etc.. My Samsung intensity II is what I need it for; I want to shoot to the top of this window asking me what to do when I plug in, but one day, I was not thought and press on 'No Action' with the "always perform this action for this device" (or said something like that) checkbox checked.

    Once it is connected, go to my computer, and your camera photo or anything else that should be there.  If is isn't, it is a completely different issue.  It's done, right-click on it and select Properties.  Click the AutoPlay tab.  There is a version of dialogue enough of this "window asking me what to do."  You can figure out what to do from there.

  • OAF Page expand to change the button action

    Hello

    We have a standard page of the OPS in iProcurement, where there are a standard change request button, which redirects to another standard page. We want to change the button action to call another custom OAF page. Please let me know how to do the same.

    Attached screenshot for reference

    Follow the steps below to create a button through customization.

    1. click on customize page where you want to create an element.

    2. find the area where you want to create

    3. click on Create icon, which opens a new window.

    4. Select the style of the item as button and give the values for the element.

    Browse link below

    Oracle concepts for you: Add a button to a Page of the OFA

    Also paste the error if you get none after following steps above.

    BR, FLS

  • is it possible to dynamically change the industrial action.

    Hi friends,

    I have a scheduler job to call the shell script. Is it possible to dynamically change the industrial action (IE change the name of the shell script based on requirement).

    My basic idea is to have a scheduler job to call different shell scripts based on requirement.

    Thanks in advance
    Jeeva.

    You can try using DBMS_SCHEDULER. SET_SCHEDULER_ATTRIBUTE with:

    attribute => 'JOB_ACTION'
    
  • How can I change the default action of the folder Explorer 'explorer' when a cd/dvd drive is selected.

    For some reason, the default value is "install or run. I found this in the registry, but can't make any sense of the entries accompanying.

    Now, I understand what you want to do and I think also it can be done with changes to the registry, but I have no idea of what they are (and can find no references or articles about it).

    One thing you could do would be to go to start / Control Panel / Default programs / change AutoPlay settings / set autoplay on (yes I know you turned it off) and change ALL the options to "open folder to view files using Windows Explorer".  While happen automatically every time that you have inserted a CD - making it an automatic default (instead of a manual using the context menu).  I don't think that would change the option in the context menu by default or the default when action a double-click on the CD in Windows Explorer, but it can get you closer to what you want to be the case.

    I would suggest repost you your request in the Technet Forums: http://social.technet.microsoft.com/Forums/en-US/itprovistasetup/threads where they are a little more technical nature that we are here and that you know the registry tweak to achieve your goals.

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Can we change the binding action of defination of page during execution

    Hi my probel is I want to change the action ExecuteWithPrams IterBinding according to the drop-down list value selected by the user. How can it be done please say.

    While this problem I'll start with a simple test case, and then move up to the more complex use cases.

    Suppose you have 2 bind params for each VO.

    (1) create new web page
    (2) remove your VO ADF, the 2 bind params table and the executeWithParams on the page such that the bindings are created behind the scenes
    (3) create a support for your page bean.
    (4) add 2 inputText unrelated to the page fields, and then map their attribute value string with getter/Setter in the bean that you created
    (5) add 1 commandButton unrelated to the page
    (6) card the actionListener commanButtons to a new method in the bean
    (7) in the actionListener method, enter the values for the 2 channels of #4 and write their values to the param #2 programmatically bind bindings
    (8) always in the actionListener method, run the connection programmatically executeWithParams
    (9) test, once working, hind the params to bind and the executeWithParams button on the screen (or remove them, but make sure the links are removed)

    Now on the case more of a VO

    (9) place another VO, is to link params, executeWithParams on the screen
    (10) also add a selectOneChoice with hard coded values for each VO, link it to your bean
    (11) change #7 above this code works on which VO #10, then written to correct string values bind them params for VO
    (12) change #8 above this code works on which #10 VO, and then calls executeWithParms good link programmatically

    Jakub Pawloski and Edwin Biemond have useful blogs on usage links programmatically:
    http://Kuba.zilp.pl/?id=721
    http://Biemond.blogspot.com/2009/03/some-handy-code-for-backing-beans-ADF.html

    Overall, your question requires a lot of code to be written for a post on the forum, so try and break down the problem solvable one-step at one time as others can help you without having to spend much of their time too much.

    CM.

  • Change the alarm tone

    Hello. I use the Sony Xperia L smartphone and I've had trouble with change my ringtone of the awakening. Once I go to the "beeper" option and click on it, I can choose between all the tones the phone already provides me, but not a song of my own gallery. I watched it and I found that it is supposed to be a note at the top on the right, which takes you to the gallery. It used to be like that on my phone too, but after a few updates, it no longer exists. Could someone help me find a way to choose a song from my Gallery and my alarm? Please and thank you.

    If you are missing the note when you pick ringtones, I suggest that you go into settings > apps > all > storage media > clear default values. Restart your phone and try again.

  • 'Disable the alarm action' for a virtual machine

    Hello

    I want to disable all actions for a virtual machine alarm, while I have to disable FT to clone a virtual machine. My script are ready for cloning but I have a solution to disable the actions of alarm for a virtual machine via PowerCLI to can´t. Someone knows a solution for PowerCLI 5.1R1?

    Thank you

    Michael

    -Entity parameter requires an inventory of PowerCLI as value object and does not have the names. You can try it like this:

    Get-AlarmActionState-entity (Get-VM-name VMTEST1) - Recurse: $false

  • Why can't I change the action of double-tap by default for a file extension?

    With Windows XP, it was possible to change the default action for a file 'type' (IE file extension, because Windows 7 has no notion of a file "type" Despite other operating systems supporting these things for the last 20 years).

    Why is it not possible under Windows 7?

    Because it was designed by a guy named 'Me', which obviously has not used a computer or visited planet Earth recently, if ever?

    Why are all the MS support dumb people on this issue?

    Because they would have to admit they lied to their customers when they said Windows 7 was better than XP?

    Its opening called with, no?

    No, it isn't. This isn't what he's talking about.

    Freqy: Try this:

    http://Icrontic.com/Forum/showthread.php?t=85241

    Alternatively, you can try this freeware:

    http://www.NirSoft.NET/utils/file_types_manager.html

  • Change the link of Action dialog box

    I'm following this tutorial ( Oracle JDeveloper 11 g Release 2 tutorials - creating a Web Application using EJB, JPA, and JavaServer Faces ) and step 2: create a workflow defined with two Pages JSF, step 21. In the dialog box change the binding Action, in the value field, enter #{pageFlowScope.sal} I'm lost - I do not know how to open the link Action Edit dialog. I looked on the internet and it seems that it should open automatically after the addition of data control, but it did not happen or I missed it somehow... How should I open this dialog box?

    User, please tell us your jdev version!

    If you do not get the dialog box (don't know why you don't get it) you can open it yourself. Switch to the links tab (the tab is below the editing area in jdev). You find the action, you need to edit on the left side in the section "links". Select the link of action that you want to change (getEmployeesFindBySal in your case) and click on the pencil icon on the top right. This opens the dialog box you are looking for.

    Timo

  • PowerCLI: Enable / disable alarm on the hosts Actions / clusters

    Hi all

    I did some serious research on Google and am about to accept that it is not possible through PowerCLI.

    But I wanted to make a last effort by asking you guys.

    For the ESXi host interview, I want to use a PowerCLI script that does this:

    1. -Disable alarm on Cluster actions
    2. -Disable alarm on the hosts actions

    3. -maintenance (can be anything, but will include the host reboots)

    4. -turn on the alarm of the actions on the hosts
    5. -activate the alarm actions on Cluster

    Because we have 300 + hosst ESXi, you can imagine that I want to cela scripted.

    Is it possible to toggle alarm actions via PowerCLI?

    Thank you and best regards,

    Harold

    OK, it seems we are talking about two different things.

    What you want to do can be done from a script PowerCLI.

    Something like that

    $alarmMgr = Get-View AlarmManager $cluster = Get-Cluster MyCluster # To disable alarm actions $alarmMgr.EnableAlarmActions($cluster.Extensiondata.MoRef,$false)
    
    # To enable alarm actions $alarmMgr.EnableAlarmActions($cluster.Extensiondata.MoRef,$true)
    

    The same can be done for a host ESX (i)

    $alarmMgr = Get-View AlarmManager $esx = Get-VMHost MyEsx
    
    # To disable alarm actions $alarmMgr.EnableAlarmActions($esx.Extensiondata.MoRef,$false)
    
    # To enable alarm actions $alarmMgr.EnableAlarmActions($esx.Extensiondata.MoRef,$true)
    

    Sorry for the confusion

Maybe you are looking for