Alarm scripts FTR

"Messages of Instruction FTR" rule, by default, it does no alarm. I have configured alarm e-mail action. But I would like to configure the e-mail recipient to send the alert to different users based on the name of RDF statement. Any ideas how can I configure this?

If you try to create the copy of the rules and brought original each rule for a specific instruction, you can put the condition tab rule scope definition, remember that you will eventually have a lot of rules.

If you want to try using 1 rule for everything, what you can try to do is to define the condition on the name of the statement and try to set the variable email of the State, something like that (I have not tried but I think that it wshould work).

What you will end up with is 1 rule and many conditions on the statement name (you need to replace with the name of the statement), each a notch and the variable email differently

I hope this helps.

Golan

Tags: Dell Tech

Similar Questions

  • How to run the script with parameters such as alarm action .ps1

    Hello

    I know not how to configure alarms, I know that I can point to monitor cluster for changes (via the GUI), but... I have different groups and I would like to set an alarm by vCenter which monitors cluster for changes. Let's call it "RefreshCapacityInfoOnExternalDB".

    So, lets just say. I would like to run my script whenever a virtual computer is added, Reconfigured or ESX host are removed, added in a Cluster. The alarm would launch the .ps1 script written in turn the ability to update external db cluster info.

    Shortly said: ability to cluster values are changed

    What I need is this: run the script-> CapacityInfoRefresher.ps1 < Cluster_name_where_ReconfigEventsTookPlace >

    I guess that, first I need an environment variable (if it exists) that can be used as a parameter for the < Cluster_name_where_ReconfigEventsTookPlace > placeholder script. Right?

    Chapter 16 of the book of LucD & Friends "PowerCli reference" mentions some environment vars but I'm stuck. Anyone using these options?

    THX

    A.S.

    You can set your alarm on the node above in your vCenter tree, this way it will be active for all collections in the vCenter.

    These alarm environment variables are automatically available for your alarm script when it is triggered.

    These environment variables, you will be able to determine to which cluster the alarm was pulled.

    So I don't think that you need to pass this information as a parameter to the script.

    Perrhaps you could share what exactly alarm you want to set and what looks like the script which should trigger alarm.

    And Yes, I use these environment variables in scripts of alarm

  • Alarm to monitor the deviation from host profile

    So, I used the creation of Luc alarm script and massacred to create (hopefully) an alert when a host deviates from his profile.  However while I first thought I cracked, I clearly do not have.

    Can we see something glaring by the following:

    # Variables

    $vc = "vcsa.lab.mdb - Lab.com.

    $credential = get-Credential

    $mailto = " " [email protected] "" "

    # Connect to vCenter

    SE connect-VIServer $vc - credential $credential

    $alarmMgr = get-view AlarmManager

    $dc = "London".

    $entity = get-data center $dc | Get-View

    # Create the AlarmSpec object

    $alarm = new-Object VMware.Vim.AlarmSpec

    $alarm. Name = "Violation of the host profile.

    $alarm. Description = "home deviation of profile screens.

    $alarm. Enabled = $TRUE

    # Alarm action

    $alarm.action = new-Object VMware.Vim.GroupAlarmAction

    $trigger1 = new-Object VMware.Vim.AlarmTriggeringAction

    $trigger1.action = New-Object VMware.Vim.SendEmailAction

    $trigger1.action.ToList = $mailTo

    $trigger1.action.Subject = "not compatible with the host profile.

    $trigger1. Action.CcList = «»

    $trigger1. Action.Body = «»

    # 1A - yellow transition-> red

    $trans1a = new-Object VMware.Vim.AlarmTriggeringActionTransitionSpec

    $trans1a. StartState = "yellow".

    $trans1a. FinalState = "red".

    # Transitional 1 b - red-> yellow

    $trans1b = new-Object VMware.Vim.AlarmTriggeringActionTransitionSpec

    $trans1b. StartState = "red".

    $trans1b. FinalState = "yellow".

    $trigger1. TransitionSpecs += $trans1a

    $trigger1. TransitionSpecs += $trans1b

    $alarm.action.action += $trigger1

    # 1 compatible host expression: profile

    $expression1 = new-Object VMware.Vim.EventAlarmExpression

    $expression1. EventType = $null

    $expression1.eventTypeId = "Host" compatible with the profile

    $expression1.objectType = 'HostSystem.

    $expression1.status = "yellow".

    # 2 expression - Profile non-compliant host

    $expression2 = new-Object VMware.Vim.EventAlarmExpression

    $expression2. EventType = $null

    $expression2.eventTypeId = "not compatible with the host profile.

    $expression2.objectType = 'HostSystem.

    $expression2.status = "red".

    $alarm.expression = new-Object VMware.Vim.OrAlarmExpression

    $alarm.expression.expression += $expression1

    $alarm.expression.expression += $expression2

    $alarm.setting = new-Object VMware.Vim.AlarmSetting

    $alarm.setting.reportingFrequency = 0

    $alarm.setting.toleranceRange = 0

    # Create the alarm.

    $alarmMgr.CreateAlarm($entity.) MoRef, $alarm)

    # Disconnect the vcenter

    Disconnect-VIServer $vc - confirm: $false

    I tried first with a green status instead of yellow... but then the script will not yet create.  In its current form, I get a load of the SOAP faults page...

    Any help would be (as always) greatly appreciated.

    -Mark

    With the help of Oynx I have it fixed.  Here's what it is today:

    # Variables

    $vc = "vcsa.lab.mdb - Lab.com.

    $credential = get-Credential

    $mailto = "[email protected]".

    # Connect to vCenter

    SE connect-VIServer $vc - credential $credential

    # Get the data center

    $dc = "London".

    $entity = get-data center $dc | Get-View

    # Create the alarmspec object

    $spec = new-Object VMware.Vim.AlarmSpec

    $spec.name = 'Deviation from host profile.

    $spec.description = 'home deviation of profile screens.

    $spec.enabled = $true

    # 1 expression: profile host is non-compliant

    $spec.expression = new-Object VMware.Vim.OrAlarmExpression

    $spec.expression.expression = new-Object VMware.Vim.AlarmExpression [] (1)

    $spec.expression.expression [0] = new-Object VMware.Vim.EventAlarmExpression

    $spec.expression.expression [0] .eventType = "HostNonCompliantEvent".

    $spec.expression.expression [0] .objectType = "HostSystem.

    $spec.expression.expression [0] .status = "red".

    # Create the alarm action

    $spec.action = new-Object VMware.Vim.GroupAlarmAction

    $spec.action.action = new-Object VMware.Vim.AlarmAction [] (1)

    $spec.action.action [0] = new-Object VMware.Vim.AlarmTriggeringAction

    $spec.action.action [0] .Act = new-Object VMware.Vim.SendEmailAction

    $spec.action.action [0].action.toList = $mailto

    $spec.action.action [0].action.ccList = «»

    $spec.action.action [0].action.subject = "not compatible with the host profile.

    $spec.action.action [0].action.body = «»

    $spec.action.action [0] .transitionSpecs = new-Object VMware.Vim.AlarmTriggeringActionTransitionSpec [] (1)

    $spec.action.action [0] .transitionSpecs [0] = new-Object VMware.Vim.AlarmTriggeringActionTransitionSpec

    $spec.action.action [0] .transitionSpecs [0] .startState = "yellow".

    $spec.action.action [0] .transitionSpecs [0] .finalState = "red".

    $spec.action.action [0] .transitionSpecs [0] .repeats = $false

    $spec.action.action [0] .green2yellow = $false

    $spec.action.action [0] .yellow2red = $false

    $spec.action.action [0] .red2yellow = $false

    $spec.action.action [0] .yellow2green = $false

    $spec.setting = new-Object VMware.Vim.AlarmSetting

    $spec.setting.toleranceRange = 0

    $spec.setting.reportingFrequency = 0

    _this $ = get-view-Id "AlarmManager-AlarmManager.

    # Create alarm

    _this $. CreateAlarm($entity.) MoRef, $spec)

    # Disconnect the vcenter

    Disconnect-VIServer $vc - confirm: $false

    I am now writing a block to edit the task scheduled every hour.

    -Mark

  • Set up the alarm is triggered when the migration of VM with DRS

    Hello, I have a client who has Vmware 5.5, we have DRS setup and his works fine.  If I check the tasks and events, I can see the occasional VM being migrated.  What I want to do is to set up an alert when a VM migrates from one host to another due to the DRS, I want that it send me an email.

    Ive went through default alerts and do not see one.

    I tried to create an alert, but that's where I'm starting to get confused.

    I have create a new alarm, I choose "Monitor for specific events.

    Under triggers, I add an event

    One of the events is VM migrated - this looks like one I'd like to

    My problem is what to put for the advanced settings?

    Ill add an Argument, but I'm not sure that what to put here.  There are options like host-ID hostname, but the operator for these seem to want you to know the specific host, it's on.  But there will be moments where the VM can bounce between two different hosts.  So I don't know which host its on.  I just want to know that it has migrated and when.

    I'm sure it's very simple and im just missing something

    Thanks for the help

    Mike

    Hello Mike,.

    hope this helps:

    4 see the VM through a triggered alarm script vCenter vCenter

    http://www.v-front.de/2013/07/do-you-know-where-your-virtual-vCenter.html

    Kind regards

    P.

  • 'Command' in vCenter alarm

    Hi all

    We are recently receving bunch of vCPU alerts. We want to take these courses of the time period. So, I want to save the info to a database alert.

    I came to know the "run command" in vCenter alarm, which is great. I am able to run the powershell script example using that.

    I wonder if someone can help me on passing the parameters (green, red, metric, vCenterServer name etc.) script powershell is on my vCenterServer. I don't know that there should be a way. Any thoughts or ideas?

    My goal is to send the alarm information to the powershell script and then insert these data in databases so that we can have a story and that you can query easily.

    Thus, whenever there is a generated vCPU alert, powershell script will be executed and insert database values.

    Please let me know if there is a better way to do it.

    Thanks in advance,

    Rajesh.

    I think that the reasoning behind this folderpath and set the AppData environment variables is explained by Carter in step 1.

    These alarm scripts will run under the account of the vCenter Service service, and does not the vCenter uses environment variables.

    The non-existent folder is just a new folder you have to create yourself.

    Can you try to add a Start-Transcript (beginning of the script) and Stop-Transcript (end of the script) to your script?

    This will give you a log of what the script does.

  • Integration of active-to-end monitoring third-party tools such as HP QuickTest Pro, Rational Robot etc.

    One of our clients asked us to help. That is why I ask, whether or not it is possible to integrate the "timers" and "alerts" third-party active-to-end tracking tools, such as HP QuickTest Pro, Rational Robot etc. in Foglight (FTR)?

    Hi Claudia.

    If one of these tools can be user of a web browser, you could write scripts FTR against them just as you would for any other browser based application. If they have their own clients, you might consider using SDH advanced to build synthetic transactions that measure the performance of these tools and the activity they provide for you.

    Foglight FTR relies on its own generated scripts, so I don't think there is a way to integrate these tools directly at this level. However if these third-party tools have command-line access, or they write results for log files, you can use script Foglight agents to get the data.

    I hope this helps.

    Robert

  • How to load the function in Powershell

    Hi all

    I downloaded script is automatically securing virtual computers using a vCenter alarm (Scripts.zip)

    I want to understand is there a way to automatically load the function defined by the script.

    whenever I want to run this script, I have to load the function.

    Thanks for your help in advance,

    Hervé

    There are two ways to load such a function.

    The easiest way is to place the function in one of the profile files, it is "known" when you start the PowerCLI session like that.

  • ToStaticHTML MS IE String Cross - Site Scripting Vulnerability associated with the processing of alarms

    Hello

    I was wondering if someone else has noted an increase in false positives on the 2 following competitions:

    -Microsoft Internet Explorer toStaticHTML String Cross - Site Scripting Vulnerability related to treatment

    -Microsoft Office Excel Ghost Record analysis of arbitrary Code execution vulnerability

    Obvisouly I see these events because the signature has been introduced recently.

    But I wonder if these alarms I get are authentic (and I have a big problem), or if the signature must be "set" by Cisco to be a little less sensitive?

    Anyone who has experienced something similar or can enlighten?

    Thank you

    SEB.

    Hello Seb,

    As a result of this thread, we have identified a false positive in signature 30419 and corrected the signature. The signature change is currently under review and is likely to do the update of signature which releases next week.

    Please let me know if I can help with anything whatsoever in addition under this thread. If your question has been answered, please mark the thread as such so that it is useful to other users. Also, feel free to note this thread to take account of your experience.

    Thank you

    Blayne Dreier

    Cisco TAC team climbing

    * Please see our Podcasts *.

    TAC security show: http://www.cisco.com/go/tacsecuritypodcast

    TAC IPS Media Series: https://supportforums.cisco.com/community/netpro/security/intrusion-prevention?view=tags&tags=tac_ips_media_series

  • How to capture the data of type string with agent script and then compared to an alarm

    Hello...

    How to capture the string with agent of script data and then create a rule to compare the string data to generate alarm?

    Thank you!...

    Start here:

    http://en.community.Dell.com/TechCenter/performance-monitoring/Foglight-administrators/w/Admins-wiki/6155.custom-script-agent-1-leverage-an-existing-monitoring-script-to-push-data-into-Foglight

  • vCenter alarm action script to start a workflow vRO with curl

    I have a script that I use on the vCenter servers to launch when an alarm is triggered, and this script will use curl to start a workflow vRO.  Everything has been awesome to work until I've finished upgrading all servers in vRO to 7.x now I get this error

    Server: ~ # /root/scripts/alarmaction.sh

    * Subject to connect() to x.x.x.x port 8281 (#0)

    * Try the connected.. x.x.x.x.

    * Connected to the port x.x.x.x (x.x.x.x) 8281 (#0)

    * successfully together certificate verify locations:

    * CAfile: /etc/ssl/certs/root64.pem

    CApath: / etc/ssl/certs /.

    * SSLv3, TLS, Hello handshake customer (1):

    } [data not shown]

    * error: 140770 CF: protocol SSL routines: SSL23_GET_SERVER_HELLO:unknown

    Closing connection #0

    curl: (35): 140770 CF error: SSL routines: SSL23_GET_SERVER_HELLO:unknown

    OK, so an algorithm of encryption or something got deleted in version 7.x.  Can someone else me one that exactly and how do I add the encryption required to connect again?

    Here's my alarmAction.sh in case anyone can use something like this

    #! / bin/sh

    {vcAlarm()}

    # Create variables to store values consumed by Invoke-RestMethod command.

    Server = "x.x.x.x"

    url = » https://$server:8281/VCO/API/workflows/408d8e4d-1a95-46A4-bca6-efa3c24f81bb/executions "

    # The cmdlet runs the URL encoding.

    Cat >./alarmProps.txt < < EOF

    " <-xmlns = execution context" http://www.VMware.com/VCO "> "

    < Parameters >

    < parameter type = 'string', name = 'VMWARE_ALARM_NAME' scope = 'local' >

    < string >$ {VMWARE_ALARM_NAME} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_ID' scope = 'local' >

    < string >$ {VMWARE_ALARM_ID} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_TARGET_NAME' scope = 'local' >

    < string >$ {VMWARE_ALARM_TARGET_NAME} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_TARGET_ID' scope = 'local' >

    < string >$ {VMWARE_ALARM_TARGET_ID} < / string >

    < / parameter >

    < type parameter is 'chain' name is 'VMWARE_ALARM_OLDSTATUS' scope = 'local' >

    < string >$ {VMWARE_ALARM_OLDSTATUS} < / string >

    < / parameter >

    < type parameter is 'chain' name is 'VMWARE_ALARM_NEWSTATUS' scope = 'local' >

    < string >$ {VMWARE_ALARM_NEWSTATUS} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_TRIGGERINGSUMMARY' scope = 'local' >

    < string >$ {VMWARE_ALARM_TRIGGERINGSUMMARY} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_DECLARINGSUMMARY' scope = 'local' >

    < string >$ {VMWARE_ALARM_DECLARINGSUMMARY} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_ALARMVALUE' scope = 'local' >

    < string >$ {VMWARE_ALARM_ALARMVALUE} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_EVENTDESCRIPTION' scope = 'local' >

    < string >$ {VMWARE_ALARM_EVENTDESCRIPTION} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_EVENT_DESCRIPTION' scope = 'local' >

    < string >$ {VMWARE_ALARM_EVENT_DESCRIPTION} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_EVENT_USERNAME' scope = 'local' >

    < string >$ {VMWARE_ALARM_EVENT_USERNAME} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_EVENT_DATACENTER' scope = 'local' >

    < string >$ {VMWARE_ALARM_EVENT_DATACENTER} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_EVENT_COMPUTERESOURCE' scope = 'local' >

    < string >$ {VMWARE_ALARM_EVENT_COMPUTERESOURCE} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_EVENT_HOST' scope = 'local' >

    < string >$ {VMWARE_ALARM_EVENT_HOST} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_EVENT_VM' scope = 'local' >

    < string >$ {VMWARE_ALARM_EVENT_VM} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_EVENT_NETWORK' scope = 'local' >

    < string >$ {VMWARE_ALARM_EVENT_NETWORK} < / string >

    < / parameter >

    < parameter type = 'string', name = 'VMWARE_ALARM_EVENT_DATASTORE' scope = 'local' >

    < string >$ {VMWARE_ALARM_EVENT_DATASTORE} < / string >

    < / parameter >

    < type parameter is 'chain' name is 'VMWARE_ALARM_EVENT_DVS' scope = 'local' >

    < string >$ {VMWARE_ALARM_EVENT_DVS} < / string >

    < / parameter >

    < / Parameter >

    < / execution context >

    EXPRESSIONS OF FOLKLORE

    # Now run the Invoke-RestMethod command with all the variables in place.

    curl-s-i-l - v--/root/scripts/cert/vco.key--/root/scripts/cert/vco.crt--cacert cert /root/scripts/cert/root64.cer - H - key "accept: application/xml ' h ' content-type: application / xml; Charset = UTF-8 "h 'permission = 'Base base64pass' ' u" user: password "x POST $url d @alarmProps.txt"

    }

    vcAlarm

    RM./alarmProps.txt f

    In vRO 7.0.1 Protocol TLSv1 is disabled by default. Could you change the sslEnabledProtocols property in the /etc/vco/app-server/server.xml file to "TLSv1, 1, TLSv1.2 ' "TLSv1, TLSv1.1, TLSv1.2", reboot and try again with curl vco-Server service?

  • PowerCLI script alarms

    Hello.

    I am trying to create a script that can take all the vm that triggered a specific alarm as "the processor of the virtual machine using" with an alert and put the machine names to a csv file. so far, I found a lot of information how to do that on all the alarms but not how I define one type of alarm. Is there a simple solution to this?

    BR jorber

    -Very well, so basically you want to filter anything that contains 'use of the virtual machine CPU' in AlarmInfo attribute.

    The simple way to do this is to add a Where clause clause before heading to Export-CSV, as follows (see the changes in bold):

    $ignoreAlarms = @("Virtual machine cpu usage")
    $vm_all = Get-View -ViewType VirtualMachine
    $Report=@()
    foreach ($vm in $vm_all){
      foreach($triggered in $vm.TriggeredAlarmState){
        If ($triggered.OverallStatus -like "red" ){
          $lineitem={} | Select Name, AlarmInfo
          $alarmDef = Get-View -Id $triggered.Alarm
          $lineitem.Name = $vm.Name
          $lineitem.AlarmInfo = $alarmDef.Info.Name
          $Report+=$lineitem
        }
      }
    }
    $Report |Sort Name | Where {$ignoreAlarms -notcontains $_.AlarmInfo } | export-csv "c:\temp\VM-Red-Alarms.csv" -notypeinformation -useculture
    Invoke-item "c:\temp\VM-Red-Alarms.csv"
    

    I also added a table of alarms to ignore, this way if you have several types of alarms that you want to ignore, you can add it to the table.

    Change to 'Get-View - ViewType VirtualMachine' should give you a bit of a speed improvement as well

  • Script to export VCenter alarms to analyze.

    Does anyone know of a script, or how an exportable report of your alarms that are used in your script Vcenter?

    Want to know what thresholds have been established.

    For example, is sent by e-mail or SMNP.

    Help, please.

    James

    Hi James,

    Glad it helped

    Please select my comment as replied so people can use it!

    S

  • script to collect 'Triggered alarms' 4 VC in a single report

    Hi team,

    I'm looking for a script to collect 'Triggered alarms' 4 VC in a single report. We use ESXi 4.1 worm in the VC.

    Is it possible to collect all 4 VC triggered alarms in a report by acronym and automatically by email with an Excel report.

    Thank you

    Kind regards

    Roze

    Finally the script helped for my need below.

    Hi looking for script to collect multiple vCenters triggered alarms below:

    How to run these scripts: \Get-TriggeredAlarms - vc001, vc002 vc03 vCenters

    Location of the output file: c:\temp\alarms.csv

    Script:

    ______________________________________________________________________________

    (param

    [String []] $vCenters

    )

    Function Get-TriggeredAlarms {}

    (param

    $vCenter = $(throw "doit être spécifié un vCenter."),

    [System.Management.Automation.PSCredential] $credential

    )

    If {($credential)

    $vc = to connect-VIServer $vCenter - Credential $credential

    }

    else {}

    $vc = to connect-VIServer $vCenter

    }

    If (! $vc) {}

    Write-Host "Failure connecting to vCenter $vCenter."

    output

    }

    $rootFolder = get-file-server $vc "data centers".

    {foreach ($ta in $rootFolder.ExtensionData.TriggeredAlarmState)}

    $alarm = "" | Select-Object VC, EntityType, alarm, entity, status, time, recognized, AckBy, AckTime

    $alarm. VC = $vCenter

    $alarm. Alarm = (Get-View-Server $vc $ta.) Alarm). Info.Name

    $entity = get-view-server $vc $ta. Entity

    $alarm. Entity = (Get-View-Server $vc $ta.) Entity). Name

    $alarm. EntityType = (Get-View-Server $vc $ta.) Entity). GetType(). Name

    $alarm. Status = $ta. OverallStatus

    $alarm. Time = $ta. Time

    $alarm. Recognized = $ta. Recognized

    $alarm. AckBy = $ta. AcknowledgedByUser

    $alarm. AckTime = $ta. AcknowledgedTime

    $alarm

    }

    Disconnect-VIServer $vCenter - confirm: $false

    }

    Write-Host ('Get messages from {0}. vCenters' f - $vCenters.Length)

    $alarms = @)

    {foreach ($vCenter to $vCenters)

    Write-Host "Getting alarms from $vCenter."

    $alarms += get-TriggeredAlarms $vCenter

    }

    $alarms | Export-csv c:\temp\alarms.csv

    __________________________________________________________________

  • Create alarm "hardware monitoring" by the script?

    Hello:

    I wonder how I can create the hardware by script monitoring alarm?

    For example, I want to write a script that will create the alarm similar to the default alarm "State of other objects of host hardware.

    Follow large docs LucD Web site (http://www.lucd.info/2009/11/27/alarm-expressions-part-2-event-alarms/), I wrote the following code:

    $alarm. Name = "status of other objects of host hardware.

    $alarm. Description = "monitor other objects of host hardware."

    $alarm. Enabled = $TRUE

    $expr1 = new-Object VMware.Vim.EventAlarmExpression

    $expr1. EventType = "com.vmware.vc.cim.CIMGroupHealthStateChanged."

    $expr1. ObjectType = "HostSystem.

    $expr1. Status = 'green '.

    $expr2 = new-Object VMware.Vim.EventAlarmExpression

    $expr2. EventType = "EnteringMaintenanceModeEvent."

    $expr2. ObjectType = "HostSystem.

    $expr2. Status = "yellow".

    $expr3 = new-Object VMware.Vim.EventAlarmExpression

    $expr3. EventType = "EnteringMaintenanceModeEvent."

    $expr3. ObjectType = "HostSystem.

    $expr3. Status = "red".

    $alarm.expression = new-Object VMware.Vim.OrAlarmExpression

    $alarm.expression.expression += $expr1

    $alarm.expression.expression += $expr2

    $alarm.expression.expression += $expr3

    $alarmMgr.CreateAlarm($entity.) MoRef, $alarm)

    But now I have problem to add arguments, operator, and value to all three different events (Advanced) Condition?

    Also, I know that I have to restart VC after creating this alarm, but it is fine with me (the same 'problem' I had added when storage network/monitoring of alarms by script).

    I would really appreciate the help.

    Thank you very much!

    Okay, I think I got it.

    You must use the property of comparisons to set conditions.

    Try this

    $entity = (Get-VMHost ).Extensiondata
    $alarm = New-Object VMware.Vim.AlarmSpec
    $alarmMgr = Get-View AlarmManager
    
    $alarm.Name = "Status of other host hardware objects"
    
    $alarm.Description = "monitor other host hardware objects"
    $alarm.Enabled = $TRUE
    
    $expr1 = New-Object VMware.Vim.EventAlarmExpression
    $expr1.EventType = "EventEx"
    $expr1.EventTypeId = "com.vmware.vc.cim.CIMGroupHealthStateChanged"
    $expr1.ObjectType = "HostSystem"
    $expr1.Status = "green"
    
    $condition11 = New-Object VMware.Vim.EventAlarmExpressionComparison
    $condition11.attributeName = "group"
    $condition11.operator = "equals"
    $condition11.value = "Other"
    
    $condition12 = New-Object VMware.Vim.EventAlarmExpressionComparison
    $condition12.attributeName = "newState"
    $condition12.operator = "equals"
    $condition12.value = "green"
    
    $expr1.Comparisons += $condition11
    $expr1.Comparisons += $condition12
    
    $expr2 = New-Object VMware.Vim.EventAlarmExpression
    $expr2.EventType = "EventEx"
    $expr2.EventTypeId = "com.vmware.vc.cim.CIMGroupHealthStateChanged"
    $expr2.ObjectType = "HostSystem"
    $expr2.Status = "yellow"
    
    $expr2.Comparisons += $condition11
    $condition22 = New-Object VMware.Vim.EventAlarmExpressionComparison
    $condition22.attributeName = "newState"
    $condition22.operator = "equals"
    $condition22.value = "yellow"
    $expr2.Comparisons += $condition22
    
    $expr3 = New-Object VMware.Vim.EventAlarmExpression
    $expr3.EventType = "EventEx"
    $expr3.EventTypeId = "com.vmware.vc.cim.CIMGroupHealthStateChanged"
    $expr3.ObjectType = "HostSystem"
    $expr3.Status = "red"
    
    $expr3.Comparisons += $condition11
    $condition32 = New-Object VMware.Vim.EventAlarmExpressionComparison
    $condition32.attributeName = "newState"
    $condition32.operator = "equals"
    $condition32.value = "red"
    $expr3.Comparisons += $condition32
    
    $alarm.expression = New-Object VMware.Vim.OrAlarmExpression
    $alarm.expression.expression += $expr1
    $alarm.expression.expression += $expr2
    $alarm.expression.expression += $expr3
    
    $action = New-Object VMware.Vim.AlarmAction
    
    $action = New-Object VMware.Vim.AlarmTriggeringAction
    $action.action = New-Object VMware.Vim.SendEmailAction
    $action.action.toList = "[email protected];"
    $action.action.ccList = ""
    $action.action.subject = ""
    $action.action.body = ""
    $action.green2yellow = $false
    $action.yellow2red = $false
    $action.red2yellow = $false
    $action.yellow2green = $false
    
    $spec = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
    $spec.startState = "yellow"
    $spec.finalState = "red"
    $spec.repeats = $false
    
    $action.transitionSpecs = $spec
    
    $alarm.action = New-Object VMware.Vim.GroupAlarmAction
    $alarm.action.action += $action
    
    $setting = New-Object VMware.Vim.AlarmSetting
    $setting.toleranceRange = 0
    $setting.reportingFrequency = 0 
    
    $alarm.setting = $setting
    
    $alarmMgr.CreateAlarm($entity.MoRef, $alarm)
    

    Note that I reused the $condition11 into three expressions since it does not change.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Import/export script alarms between VC or synchronize alarms between 2 virtual centres

    Hello:

    I wonder if there is a way to sync alarms between 2 virtual centres?

    Or for example, how to export all the alarms of a VC and their import to another? Is this possible?

    Any help would be really appreciated.

    Thank you very much!

    The following script will remove all alarms on al visible features

    $alarmManager = Get-View AlarmManager
    $alarms = $alarmManager.GetAlarm($null)
    $alarms | %{
         $alarm = Get-View $_
         $alarm.RemoveAlarm()
    }
    

    Note that this does not remove the alarms on the entities hidden like data centers, the host and the vm.

    And please test in an environment out of production first!

    There is no way to recover a deleted alarm.

    ____________

    Blog: LucD notes

    Twitter: lucd22

Maybe you are looking for