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

Tags: VMware

Similar Questions

  • After reinsalling firefox, I tried to transfer the info from old profile to new profile according to the instructions, but am unable to do so. I'm not computer literate

    Firefox crashed while refreshing but created a folder "old data of firefox. I have so I restarted and then deleted reinsalled firefox. I'd like to have my old favorites available have tried the info on help with copying the files between the profiles but does not seem to work. I can access the old and the new profile, but when I right click on Places.sqlite on the old profile and select copy, then there is no paste option on new file. I'm not computer literate and an ODP so would like to simple step by step instructions. Any help would be appreciated. Thank you.

    You can try to restore a .jsonlz4 compressed in the bookmarkbackups folder in the "Old data Firefox" folder on the desktop in the current profile.

    • Bookmarks > show all bookmarks > import and backup > restore > choose file
  • VMotion using the connection from host to host Teddy

    If I have 2 guests can I set up a vmotion network by connecting directly 1 bear on host A to an another Teddy on host B?

    My hope is to keep network traffic related to move the files to the virtual machine in this regard all the while keep my communications different vCenter and host on another to a teddy bear.

    I expect the 2 hosts would be the only visible devices on this network of vmotion. My reason is to allow a small configuration allow to separate the traffic of transfer vm other network connections

    VMotion is a vmkernel, with Ip configuration port just to migrate the States of memory and processors:

    http://www.VMware.com/files/PDF/VMware-VMotion-DS-en.PDF

    It's not virtual machine configuration, only on the vmkernel port configuration and other configuration settings you need to have (CPU compatibility, etc...)

  • Where is stored the photo from my profile

    I have had no luck trying to find the location and do not have this picture on laptop there more but want to get it back.  Any ideas?

    MSN Live Messenger (version 2009).  Go to Tools / Options / display picture / modify photo / travel and your Messenger picture will be in the list (even if it will be weak because you used a small image to publish on the site).  There may be more than one image (if you have tried several before selecting the final choice).  You can do a right click on the file and select copy and then paste it where otherwise you want to store.

    I hope this helps.

    Good luck! Lorien - a - MCSE/MCSA/network + / A +.

  • How to configure the local and logging remotely using the host profiles, not with advance options

    Help, please

    Hello

    Local and remote syslog feature can be configured for a cluster of similar hosts using the host profiles.

    For more information, see guide installation and Set Up Syslog of the section of the Interface of host profiles in vSphere Installation.

    Connect the Server vCenter by using the vSphere Client.

    Click home.

    Under the administration section, click host profiles.

    Create a new profile or modify an existing profile.

    In the Edit Profile dialog box, set one or more of the five configuration options.

    If you configured using esxcli or advanced syslog configuration options and this has captured a host of reference, 5 configuration options are already visible in the Advanced Configuration option section.

    If syslog has not been previously configured, right-click the section of Advanced Configuration options and add a profile for each of the five configuration options.

    Save the profile and assign it to the hosts.

    For more information please see the documentation Center: (Documentation Centre of vSphere 5.5 )

  • Cannot create host profiles. "

    Just started a new job and I'm trying to clean up the mess...

    When you create profiles of the host, I get this message and the creation of host profile fails.

    Call 'HostProfileManager.CreateProfile' of object "HostProfileManager" on vCenter Server 'vcentername.domain.com' failed.

    Configuration of the parameter cannot be an empty string

    The VPXD. Table of NEWSPAPER reports:

    2014 11-15 T 09: 29:24.100 - 05:00 [09188 info "Default" opID = A1964820-00002139-3 a] [VpxLRO] - ERROR task-943884 - host-5858 - vim.profile.ProfileManager.createProfile: vmodl.fault.SystemError:

    -> Result:

    -> (vmodl.fault.SystemError) {}

    -> dynamicType = < unset >

    -> faultCause = (vmodl. NULL in MethodFault),

    -> faultMessage = (vmodl. [LocalizableMessage)

    -> (vmodl. LocalizableMessage) {}

    -> dynamicType = < unset >

    -> key = "com.vmware.vim.profile.host.UpdateError.ParameterEmptyString.label"

    -> arg = (vmodl. [KeyAnyValue)

    -> (vmodl. KeyAnyValue) {}

    -> dynamicType = < unset >

    -> key = "paramName",.

    -> value = "config."

    -->             }

    -->          ],

    -> message = 'config parameter cannot be an empty string.

    -->       }

    -->    ],

    -> right = ""

    -> msg = «»

    ->}

    -> Args:

    ->

    Neither the messages seem to be very useful...

    Found the problem... I had been watching this walk and stop for a few weeks in the middle of all my other tasks and finally decided to take this weekend to resolve. Thought I'd share what I found while others might benefit from...

    list of vib /etc/init.d # esxcli software | grep-i qlogic

    Brocade-esx55-bcu-plugin 3.2.5.0 - 03 QLogic PartnerSupported 2014-11-15

    hostprofile-bfaConfig 3.2.5.0 - QLogic VMwareAccepted 2014-11-15 1OEM.1331820

    IMA-qla4xxx 500.2.01.31 - 1vmw.0.3.040121 QLogic VMwareCertified 2014-02-14

    NET-bna 3.2.5.0 - QLogic VMwareCertified 2014-11-15 1OEM.550.0.0.1331820

    NET-qlcnic 5.5.164 - 1OEM.550.0.0.1198611 QLogic VMwareCertified 2014-02-14

    qlnativefc 1.1.7.0 - 1OEM.550.0.0.1198610 QLogic VMwareCertified 2014-02-14

    SCSI-qla4xxx 634.55.20.0 - 1OEM.550.0.0.1198610 QLogic VMwareCertified 2014-02-14

    Both modules highlight seem to be used for the FC interfaces (we use iSCSI...) are so more than likely is not necessary. the Hostprofile-bfaconfig module is to extend the host configuration for the CF settings profiles, which would of course empty in our case since we use only.

    Detective Conan.

  • where is the option Net.UseHwTSO host profile?

    I have a host profile I want to apply to a host, but there are some issues that need to be ironed out. I get the error of compliance "Net.UseHwTSO options have been modified by their default values expected", but I can't find Net.UseHwTSO in the tree of the policy of home options. If I could, I would just disable the policy for him. Or, maybe I could add a customization because only two machines have this different from others. No idea how to find it?

    vCenter Server 5.1, 5.1 ESXi

    OK, now I thought to myself. I decided to create a separate for machines with this problem profile (because they also have other issues).

    Change the profile of the host (with vSphere client): right-click right the advanced configuration option > choose Add profile > expand the new profile option created > click Advanced option and choose to set up a permanent option in the menu drop-down (see the other options if you don't want to do it this way) > enter the name of the option as specified in the option name and the value in the value box. To find out what should be the value, look at the configuration options of the non-compliant host.

  • 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

  • Reset used, bad results. ALL copied from old profile to the new file, &amp; FF file now takes 100% of CPU. I can take off safely profile folder?

    Audio delayed or does not stop when you run a video. So I used RESET. Lost bookmarks & homepage & ADBLOCK and who knows what else. So I just copied ALL the files from the old profile on my desk in the new found under troubleshooting. Put everything back, but now FF use 100% CPU when running. I'm sure that I messed up by copying everything but little, I freaked out when I saw that I had lost so much. What can delete the current profile safely folder? (Yes, I feel like a fool and I regret just is go with my screws upward, but I really need help with this).

    I didn't know how to find your answer to what earlier. In the meantime, I used back once again, & found printed the info that I need to copy ONLY the files that I need between previous & new. (Not done yet). But this time, my favorites return. (YAY! "I have a ton of bookmarks). The CPU usage is now reasonable.

    Thank you all for your answers!

  • problems after upgrading firefox. reset this is ugly. created the new profile, but can not recover data from old profile.

    I use firefox on a MacBook pro. Mac OS X version 10.7.5. There was an update of firefox on a day or 2 ago. Since this was done, I was getting 'syntax error' 5 times, each time that a page has been loaded. Some research has suggested that an application or a plug-in called "social fixer" might be the problem but I could not understand how to get rid of it so decided to try to reset Firefox. Minutes passed and a message was on the screen saying the old files of firefox have been been "cleaned" or something, but it seems to be 'stuck' because the progress bar was little jerky. Doesn't it usually doesn't. So I clicked on "Cancel". After that, I couldn't even firefox to start. Looks like my profile is unavailable or inaccessible. Following the instructions found on the support site, I created a new profile and I thought I copied the files from the previous firefox on the new profile, but when I run firefox, it's a blank slate. None of my bookmarks or passwords are there. It must be here somewhere, but I can't seem to understand.

    Looks like there was a problem with updating the profiles.ini file.

    You can try to remove the current profiles.ini file to force Firefox to create a new default profile where Firefox has not done that.
    You can check if there is a profile folder with a number of attached time stamp and in this case, you can set the location of a profile created in this folder.

    If you need to recover data from an older profile, always in the default location, or as a folder of old data of Firefox on the desktop then see:

  • Where to get the cable from the monitor to Satellite C660-1TK

    I have a portable satellite c660-1tk and I have problems with the monitor, it turns out that the problem is the cable from the monitor. I went everywhere looking for a monitor cable, but I couldn't find one.

    My question: where can I get one?

    I thought to order it online, but can't find anything.

    Hello

    You can order these parts of the Toshiba authorized service provider that is available in your country.

    Here is a list of all FSA available worldwide:
    http://www.Toshiba.EU/innovation/generic/ASP_SUPPORT/

    I put t think it should be a problem to get such cable.

  • Unable to play videos from Windows media player in the RDP using RemoteFx session on the RD session host server

    I have deployed according to the steps in the next document in the RD session host server

    http://www.Microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=d90e841f-d84c-4746-B0F3-3c16e71d1ed1

    From a client I machine RDP to the server using RemoteFx. I don't play to Windows media video player in the RDP session. It just freezes.

    All solutions?

    Your question of Windows 7 is more complex than what is generally answered in the Microsoft Answers forums.
    It is best suited to the audience the TechNet forums.

    Please ask your question in forum Windows Server Remote Desktop listed below.
    http://social.technet.Microsoft.com/forums/en-us/winserverTS/threads

    Sincerely,

    Marilyn

  • When I start RCT3, I can hear the sound of the game, but the image disappears. It's almost as if the monitor is disconnected from the computer. This could be the cause?

    Original title: race Roller Coaster Tycoon 3

    When I start RCT3, I can hear the sound of the game, but the image disappears. It's almost as if the monitor is disconnected from the computer. This could be the cause?

    Hi Redbaron666,

    Have you checked if the game works the clean boot?

    I see that Rollercoaster Tycoon 3 is not compatible with Windows 7 which could be the cause of this problem:

    Windows 7 Compatibility Center

    Method 1: You can run the game in compatibility mode and then check

    Make older programs in this version of Windows

    http://Windows.Microsoft.com/en-us/Windows7/make-older-programs-run-in-this-version-of-Windows

    Thanks and greetings

    Ajay K

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

  • Try to move the content from the old profile to the new profile of corrupt, but do not know what are the permissions to use

    I already followed the procedure to copy the files from the old profile to the new up to a certain point, but the "destination folder access denied" message for 9 elements.  When I go to change the permissions, I don't know which ones to use.  Any help would be much appreciated.  It took to run the computer all night and part of a day to get to this day it is so slow now.  Thank you.

    Discussions were merged.

    Duplicate deleted not.

    Kindly, don't start another pursuit of the Thread, you have already running on the same problem.

    ABSG dear,

    Welcome to the MSFT support community.

    Try to start your system in safe mode and disable/uninstall the game for now. If the uninstallation of this game is everything to normal, you will need to install it again. If this is not the case, try another solution.

    Create a new user profile and delete the two accounts as there is a high risk user accounts has been corrupted. Heads up here learn more on how you can fix a damaged user profile and create a new:

    http://Windows.Microsoft.com/en-us/Windows/fix-corrupted-user-profile

    Good luck!

  • Monitor the physical host computers

    How to control the physical hosts with vFoglight 6.6?

    The cartridge of the infrastructure offers you the ability to monitor the physical host computers

    http://eDOCS.quest.com/vFoglight/66/doc/wwhelp/wwhimpl/common/HTML/frameset.htm?href=cartridge/InfrastructureCartridge/index.php

    The process of creating agents and add hosts can be seen here

    http://eDOCS.quest.com/vFoglight/66/doc/cartridge/InfrastructureCartridge/UsingTheCartridge.02.3.php#416085

    Golan Shem-Tov

Maybe you are looking for

  • 7.0 Debian Skype crashed by calling

    When you make a call on Skype on Debian 7.0 it crashes, I ran from the command line and managed to do plant again and it produces the following output... ALSA lib conf.c:3314snd_config_hooks_call) cannot open the shared library libasound_module_conf_

  • E0K41UAR #ABA: pointer jump around.

    When I type, the pointer jump around.  It wasn't like this when I bought it.  In fact it just started.

  • Lexmark Z2310 printer

    HEB inktcartridge vervangen. Plots herkent mijn computer niet meer printer. Eveneens is het stuurprogramma onherkenbaar. Wat kan ik doen? Wie kan mij helpen?

  • Create sequences of the model

    Hi all! I develop a test using Teststand 2.0 application (which is required by the customer, so I can't upgrade), I need to create a new sequence or a resulting set of sequnces of the pre written templates. Adding a voice in the Tools menu that creat

  • HP Color LaserJet 4600n page not available

    I was looking for a 64-bit driver for one of our desktop printers: HP Color LaserJet 4600N device. But the page is no longer available. This corrected soon? The url no longer works: http://h20564.www2.hp.com/portal/site/hpsc/public/psi/swdHome/?lang=