A script for the e-mail notifications to all detectors of vCenter device 54 default works as expected, however it ends with an error.

Hello

We test the automatic configuration of alerts by email of all the alarms of 54 by default since version 5.0 of the device of vCenter.

Since this is something that we intend to do on all the installations/upgrades, it can be a time-consuming task having to manually set each alarm set on each vCenter so I indicated to an article in the blog of VMpros which appears to address a similar task and who suggests using PowerCLI script to take care of this:

http://blog.vmpros.nl/2011/07/04/VMware-change-alarm-actions-with-PowerCLI/

I fixed the script from its original version because it shouldn't change certain actions of alarm to send alarm notifications at a different e-mail once a week. Instead, we will propose a one-time activity.

After configuring vCenter server connection information and change the e-mail addresses, I have successfully tested the custom script to add notifications by e-mail to a test alarm (named "Test alarm") to a simple action, that I had created earlier (turn on/off a virtual computer in our laboratory). The added script notifications by e-mail to our alarm test as expected without error.

Before you change the script to add e-mail notifications to all 54 defect detectors as needed, I decided to test the custom script against one of the predefined alarms (named 'Host the status of material power'). While the script added notifications by e-mail to the alarm 'Material receiving power status' as expected, he finished with errors.

I just want to make sure that our custom script contains no script errors before using it on all the installations/upgrades (any suggestion or criticism is welcome).

I pasted the error resulting from the prompt of Windows PowerShell commands below.

Thank you and best regards,

Massimiliano

==================================================

PowerCLI D:\ >.\Change_Alarm_Datacenter.ps1

Action Type Trigger

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

SendEmail...

SendEmail...

SendEmail...

New-AlarmActionTrigger: 21/05/2012-16:35:11 new-AlarmActionTrigger A

specified parameter was incorrect.

D:\Change_Alarm_Datacenter.ps1:37 car: 82

+ Get-AlarmDefinition-name '$actAlarm1 ' | Get-AlarmAction | New-AlarmActionTri

walking landing < < < < - StartStatus 'green' - EndStatus "yellow."

+ CategoryInfo: NotSpecified: (:)) [-AlarmActionTrigger] new, Inva)

lidArgument

+ FullyQualifiedErrorId: Client20_AlarmServiceImpl_NewAlarmActionTrigger_

ViError, VMware.VimAutomation.ViCore.Cmdlets.Commands.Alarm.NewAlarmActionT

rigger

UID: /VIServer=administrator@vcenter5:443/Alarm=Alarm-alarm-17/SendEma

ilAction = 1508771755/AlarmTriggeringActionTransitionSpec =-83030421

6.

StartStatus: Green

EndStatus: yellow

Repeat: false

AlarmAction: SendEmail

UID: /VIServer=administrator@vcenter5:443/Alarm=Alarm-alarm-17/SendEma

ilAction =-1903891658/AlarmTriggeringActionTransitionSpec =-8303042

16.

StartStatus: Green

EndStatus: yellow

Repeat: false

AlarmAction: SendEmail

UID: /VIServer=administrator@vcenter5:443/Alarm=Alarm-alarm-17/SendEma

ilAction =-1765994019/AlarmTriggeringActionTransitionSpec =-8303042

16.

StartStatus: Green

EndStatus: yellow

Repeat: false

AlarmAction: SendEmail

==================================================

Okay, I think I found the problem.

You set 3 actions on this alarm (3 x Email).

This means that it

Get-AlarmDefinition -Name "$actAlarm1" | Get-AlarmAction

Returns 3 objects (one for each action).

Unfortunately, the New-AlarmActionTrigger cmdlet wants 1 as input Action, not a table object.

The solution is to select the Action of explictely for which you want to change the trigger.

Something like that

Get-AlarmDefinition -Name "$actAlarm1" | Get-AlarmAction | Select -Index 0 | New-AlarmActionTrigger -StartStatus "Green" -EndStatus "Yellow" Get-AlarmDefinition -Name "$actAlarm1" | Get-AlarmAction | Select -Index 1 | New-AlarmActionTrigger -StartStatus "Red" -EndStatus "Yellow" Get-AlarmDefinition -Name "$actAlarm1" | Get-AlarmAction | Select -Index 2 | New-AlarmActionTrigger -StartStatus "Yellow" -EndStatus "Green"

Beware, the script does not remove the old triggers, so you will end up having several triggers for actions.

First use the remove-AlarmActionTrigger to remove any existing triggers.

Tags: VMware

Similar Questions

  • How do I opt for the e-mail notification when someone responds

    How do I opt for email notification when someone answers one of my questions?

    I see now that the email notice enter my btinternet spam box. You can see that they go to my Inbox. Thank you.

  • Filter_condition in the e-mail notification of the Scheduler cannot get attributes of objects EVENT_INFO twice

    Where can I use the following script for the definition of notification by email
    BEGIN

    () DBMS_SCHEDULER.add_job_email_notification

    job_name = > 'SCH_UPDATE ',.

    recipients = > ' [email protected] ',

    events = > "job_failed"

    filter_condition = > ': event.error_code <>20001 OR EXTRACT (HOUR OF THE CAST (: event.event_timestamp TIMESTAMP)) > 6');

    END;

    /


    The email can not be filtered by the condition clause and show the error msg
    filter_condition ": event.error_code <>20001 OR EXTRACT (HOUR OF THE CAST (: event.event_timestamp TIMESTAMP)) > 6"failed with the error-1008.
    ORA-01008: not all variables

    However, the scripts will work if I separate two condition, two of them run without errors

    BEGIN

    () DBMS_SCHEDULER.add_job_email_notification

    job_name = > 'SCH_UPDATE ',.

    recipients = > ' [email protected] ',

    events = > "job_failed"

    filter_condition = > ': event.error_code <>20001');

    END;

    /

    BEGIN

    () DBMS_SCHEDULER.add_job_email_notification

    job_name = > 'SCH_UPDATE ',.

    recipients = > ' [email protected] ',

    events = > "job_failed"

    filter_condition = > ' EXTRACT (HOUR OF THE CAST (: event.event_timestamp TIMESTAMP)) > 6');

    END;

    /

    My workplace DB is 11.2.0.4
    Does anyone have the same problem? Is there a any restriction on the use of the object of event binding?

    Hello

    Filter_condition parameter can contain only 1 condition, not multiple ones. This is explained in the following note:

    Filter_Condition in DBMS_SCHEDULER. ADD_JOB_EMAIL_NOTIFICATION does not (Doc ID 1592124.1)

    The documentation is confusing but, to, looks like you can have a GOLD of the example described condition.

  • How do I just get messages from the Inbox to show the new mail notification?

    I install Thunderbird with Gmail and it works like a charm. The only complaint I have is that the new mail notification seems to grasp a selection of emails unread from different folders and often it does not show the new relevant emails in my Inbox. ESP. the all mail folder seems to provoke the doubling of message notifications, but this isn't the only one.

    All I want is my Inbox for new e-mail notifications. Is there anyway to change the current behavior?

    And there is no solution to limit the mail in a particular folder Inbox or other, so I suggest ur stuck.

    This add-on could help https://addons.mozilla.org/en-US/thunderbird/addon/xnotifier/?src=search , but I have really no idea.

  • Script for the conversion of the hyperlinks to the buttons?

    Hello!

    Does anyone know if West a script for the conversion of the hyperlinks to buttons with the action of going to the URL with the same URL, which has been used with hyperlink?

    Here it is:

    /* Copyright 2012, Kasyan Servetsky
    November 29, 2012
    Written by Kasyan Servetsky
    http://www.kasyan.ho.com.ua
    e-mail: [email protected] */
    //======================================================================================
    var scriptName = "Convert hyperlinks to buttons - 1.0";
    
    Main();
    
    //===================================== FUNCTIONS  ======================================
    function Main() {
        var hyperlink, source, sourceText, destination, page, arr, outlinedText, gb, button, behavior,
        barodeCount = 0,
        hypCount = 0;
        if (app.documents.length == 0) ErrorExit("Please open a document and try again.", true);
        var startTime = new Date();
    
        var doc = app.activeDocument;
        var layer = doc.layers.item("Buttons");
        var swatch = doc.swatches.item("RGB Yellow");
        var hyperlinks = doc.hyperlinks;
    
        var progressWin = new Window ("window", scriptName);
        progressBar = progressWin.add ("progressbar", undefined, 0, undefined);
        progressBar.preferredSize.width = 450;
        progressTxt = progressWin.add("statictext", undefined,  "Starting processing hyperlinks");
        progressTxt.preferredSize.width = 400;
        progressTxt.preferredSize.height = 30;
        progressTxt.alignment = "left";
        progressBar.maxvalue = hyperlinks.length;
        progressWin.show();
    
        for (var i = hyperlinks.length-1; i >= 0; i--) {
            hyperlink = hyperlinks[i];
            source = hyperlink.source;
            sourceText = source.sourceText;
            destination = hyperlink.destination;
            page = sourceText.parentTextFrames[0].parentPage;
    
            barodeCount++;
            progressBar.value = barodeCount;
            progressTxt.text = "Processing hyperlink " + hyperlink.name + " (Page - " + page.name + ")";
    
            arr = sourceText.createOutlines(false);
            outlinedText = arr[0];
            gb = outlinedText.geometricBounds;
            outlinedText.remove();
    
            button = page.buttons.add(layer, {geometricBounds: gb, name: hyperlink.name});
            button.fillColor = swatch;
            button.fillTint = 50;
            button.groups[0].transparencySettings.blendingSettings.blendMode = BlendMode.MULTIPLY;
            behavior = button.gotoURLBehaviors.add();
            behavior.url = destination.destinationURL;
    
            hyperlink.remove();
            source.remove();
    
            hypCount++;
        }
    
        var endTime = new Date();
        var duration = GetDuration(startTime, endTime);
        progressWin.close();
    
        alert("Finished. " + hypCount + " hyperlinks were convertted to buttons.\n(time elapsed: " + duration + ")", scriptName);
    
    }
    //--------------------------------------------------------------------------------------------------------------------------------------------------------
    function GetDuration(startTime, endTime) {
        var str;
        var duration = (endTime - startTime)/1000;
        duration = Math.round(duration);
        if (duration >= 60) {
            var minutes = Math.floor(duration/60);
            var seconds = duration - (minutes * 60);
            str = minutes + ((minutes != 1) ? " minutes, " :  " minute, ") + seconds + ((seconds != 1) ? " seconds" : " second");
            if (minutes >= 60) {
                var hours = Math.floor(minutes/60);
                minutes = minutes - (hours * 60);
                str = hours + ((hours != 1) ? " hours, " : " hour, ") + minutes + ((minutes != 1) ? " minutes, " :  " minute, ") + seconds + ((seconds != 1) ? " seconds" : " second");
            }
        }
        else {
            str = duration + ((duration != 1) ? " seconds" : " second");
        }
    
        return str;
    }
    //--------------------------------------------------------------------------------------------------------------------------------------------------------
    function ErrorExit(error, icon) {
        alert(error, scriptName, icon);
        exit();
    }
    
  • New AOL e-mail: one quarter of the screen is blank on the right side, reducing the space for the e-mail subject line. Resize attempts do not work on the right side, so I can't expand the e-mail subject line

    The new AOL E-mail look, which yesterday began a quarter of the screen is blank on the right side, thus reducing the space for the e-mail subject line, which limits its usefulness. Resize attempts do not work on the right side, so I can't expand the e-mail subject line? Running XP pro and Mozilla Firefox 5. No problem with I.E.

    Thank you, these settings were already in place. AOL said now erase the cache, cookies and history... to solve, which worked. (I deleted the cache and a story time.)

  • How can I change the filter settings for the e-mail account of my child?

    How can I change the filter settings for the e-mail account of my child?

    Hi Schaefle,

    May I know if you refer to web filtering? If Yes please visit this link to learn how to change the filter settings.

    Note: for to work in web filtering settings, you must install and configure the filter of family security on each computer your child uses.

    For more information on parental controls, please visit http://windows.microsoft.com/en-US/windows-live/essentials-help-center

    Thank you!

  • remote desktop hang at 'Please wait for the system event notification' during logoff

    When I disconnect a remote connection, sometimes the GET logoff screen stuck at "Please wait for the system event notification" next time I try to open a session.
    This can also happen if that I disconnect the user, but the user seems to weigh on this same screen as well.

    There is a particular difficulty for this?  I can connect as long as administrator to another account, I can't kill connection attached somehow to be registered in the next time?

    Thank you

    Hello

    I suggest you to take a look at the answer in this thread and check if it helps.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-security/Sens-could-not-connect-to-the-system-event/4e5a04e9-88f8-4017-9416-2ca67c5ce7c5

    Hope this helps,

  • Is there a unique ID for the e-mail messages in the Inbox

    Hello

    Is there a unique ID for the e-mail messages in the Inbox as a ToDo

    do we read the ID unique to

    String UniqueID = todo.getString (ToDo.UID, ToDo.ATTR_NONE); where todo is a ToDo

    getMessageID?

  • Script for the Configuration DVSwitch

    Hello

    Someone at - it a script for the information of VDS on the level of the host which nic is connected to what uplink?

    Also to remove all Exchange created in the VDS switch for the host and then recreate the exchanges as they were after the connection to the host to a vCenter diff?

    Also any script to copy the resource through VCenter pools?

    Thank you

    Suraj Rawat

    The following script will export information of VDS for uplink, the port they are in and what Teddy is used by node ESXi.

    $report = {foreach ($dvSw in Get-VDSwitch)

    foreach ($esx in (Get-View-id $dvSw.ExtensionData.Summary.HostMember)) {}

    $proxy = $esx.Config.Network.ProxySwitch | where {$_.} {DvsUuid - eq $dvSw.ExtensionData.Uuid}

    $pnicTab = @ {}

    $proxy. Spec.Backing.PnicSpec | %{

    $pnicTab.Add ($_.) UplinkPortKey, $_. PnicDevice)

    }

    $proxy. UplinkPort |

    Select @{N = "vdSwitch"; {E = {$dvSw.Name}}.

    @{N = "$vmhost"; E = {$esx. Name}},

    @{N = "vNIC"; E = {$pnicTab [$_]} Key]}},

    @{N = "Uplink"; E={$_. Value}},

    @{N = 'Port'; E={$_. Key}}

    }

    }

    $report | Export Csv C:\dvSw-Uplink.csv - NoTypeInformation - UseCulture

  • I bought adobe illustrator and waiting for the e-mail so I can download it but it does not appear

    I bought adobe illustrator and waiting for the e-mail so I can download it but it does not appear

    Hello

    I don't see no active membership/registration under the Adobe Id on the forums.

    Please confirm if there is any other Adobe Id in which you may have subscribed.

    Kind regards

    Sheena

  • How should be written the script for the use of the maximum memory of the guest operating system ever?

    How should be written the script for the use of the maximum memory of the guest operating system ever?

    Please teach the name of the object and the type and order, etc.

    You should be able to do it with the cmdlet Get-Stat .

    Something like that

    Get-Stat -Entity (Get-VM $vmName) -Stat mem.usage.maximum -Start (Get-Date).AddDays(-7) | Measure-Object -Property value -Maximum | Select Maximum
    

    This will return the maximum percentage in the last 7 days for the guests, whose name is stored in the variable $vmName.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • script for the murder of session

    Hello
    I prepare a script for the murder of session and I use the following command to generate the script for large number of users. The syntax for the murder of the session is ALTER SYSTEM KILL SESSION * "SID, SERIAL #" * IMMEDIATE. I want my output with SID, SERIAL # values within the single quots *('SID,SERIAL#') *. can someone help me on this?


    Select "ALTER SYSTEM KILL SESSION ' |" SID | «, » || SERIES # | ' IMMEDIATE '. « ; » FROM V$ SESSION WHERE BLOCKING_SESSION IS NOT NULL




    Thanks in advance

    Published by: 793097 on December 14, 2010 05:53
    select 'ALTER SYSTEM KILL SESSION '''||SID||','||SERIAL#||''' IMMEDIATE'||';' FROM V$SESSION WHERE BLOCKING_SESSION IS NOT NULL
    

    Nicolas.

  • How can I pay for the reservation of memory on all virtual machines to "0"?

    I am trying to write a script that will pay for the reservation of memory on all virtual machines that are invited in a cluster to '0 '.  We have book too much memory, and this setting should allow VMWare facilities manage reserves memory for me.  I have hundreds of virtual machines to update, so I can't do it by hand.  I hope that it is possible via the CLI.

    Can someone help me with this please?

    Matt example work certainly, and I'm sure that he was going to follow up with something similar to this after having confirmed if it worked or not because it is much more serious on the optimization of code for speed, but I'll (try to) save the effort. To test its extract on a cluster of 45 VMS, it took more than four minutes to complete.  The excerpt below took about 25 seconds.  The difference is of course to use the cmdlet "Get-View" and that it can run asynchronously so (it begins a vCenter task and immediately passes the following).  Of course, this will also put more of a strain to your vCenter server, so keep that in mind.

    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.memoryAllocation = New-Object VMware.Vim.ResourceAllocationInfo
    $spec.memoryAllocation.Reservation = 0
    Get-Cluster "YOUR_CLUSTER" | Get-VM | Get-View -Property Config.MemoryAllocation | %{$_.ReconfigVM_Task($spec)}
    
  • I can't change my PDF even if I pay for the plan of creative cloud. It seems that it has stopped working over the weekend.  Someone knows why?

    I can't change my PDF even if I pay for the plan of creative cloud. It seems that it has stopped working over the weekend.  Someone knows why?

    I worked on it. For some reason, he opened my PDF in Adobe Reader DC and DC Pro not Adobe.  Once I have it open as a Pro it works beautifully and I could edit.

Maybe you are looking for

  • Apple Watch display problem

    I have the problem since a few weeks now, after having used the watch for more than a day without turn it on, the screen turns into a blue light, but everything is still visible, but as I said, with a slight blue tint over everything. If I disable th

  • Media player shortcuts keyboard does not work with Windows Media Player 11

    Salvation; I upgraded my version of player 10 or windows media 11. Now my keys does not work. I was wondering if there is a way to solve this problem.

  • Satellite A300 goes into sleep mode - it starts again

    My Toshiba Satellite A300 simply refuses to sleep - sleep (bright yellow lights up and the screen is blank) and after about 10 seconds, all the lights come back and the fan starts going. This occurs when the laptop is plugged in and running on batter

  • T60 no audio; No HDA audio bus driver

    Hi all I have a T60 with a fresh install of XP Pro. Everything seems to work well except for audio. Audio controls XP show no audio device. I reloaded the audio driver (77a224ww.exe) files. When I try to complete the process by running Setup.exec in

  • Server 2003 - out of disk space on the partition of 12 GB

    I have a Dell PowerEdge 1800 server with Server 2003 R2 SP2 standard. 'Windows' resumes Go 9.51 to a 12 GB partition that has been installed and installed with the o/s by Dell. Now I have less than 2% left open (267 MB) and I don't know how to get mo