PowerCLI - clear alarm

Hi all

Recently, we found that our guests have been sensitive to this issue.  After you apply update vCenter to address this going forward, we went through all affected with script PowerCLI from VMware virtual machines.  The result is that each unique VM fixed by this script now has an alarm "vSphere HA machine virtual failover impossible" triggered.

I thought it would be pretty easy to write a script to run through all our virtual machines and turn off the alarm if the date of call or alarm type matching certain criteria.

I highly recommend to expose this functionality via PowerCLI.  I am quite surprised that we will need to manually clear these alarms - was trying to force me to not to use the GUI.

Thank you!

On a side note, it might be interesting to update the post found here:

http://communities.VMware.com/message/1869541

The code lacks a line break:

$alarmMgr = Get-View AlarmManager Get-VM | where {$_.ExtensionData.TriggeredAlarmState} | %{
    $vm = $_
    $vm.ExtensionData.TriggeredAlarmState | %{
        $alarmMgr.AcknowledgeAlarm($_.Alarm,$vm.ExtensionData.MoRef)
    }
}

Should be

$alarmMgr = Get-View AlarmManager #note the previous code missed a line break here

Get-VM | where {$_.ExtensionData.TriggeredAlarmState} | %{
    $vm = $_
    $vm.ExtensionData.TriggeredAlarmState | %{
        $alarmMgr.AcknowledgeAlarm($_.Alarm,$vm.ExtensionData.MoRef)
    }
}

I updated the code, thanks for finding this.

The clearing of the triggered alarms unfortunately use private API.

Tags: VMware

Similar Questions

  • Clear alarm ROL

    Hello everyone.

    I'm trying to give permission to a user with the role of operator permission to clear alarms. I found in foglight function that disables the button to clear and by default, only users with the role of advanced operators can clear alarms, I tried to change the parameters of the function for the role of the operator can delete alarms, but I could not, someone has a idea how to make this change.

    The function is in the module of alarms, and the name is disable alarm clear action.

    Thanks for your help.

    Hi Alexander,.

    The buttons clear and recognition are hung in a script called "currentUserHasAdvancedOperatorRole". Change that, it should be:

    -implementation of a different authorization script that checks for a role different (for example "alarmAdmin" in the cartridge seal)

    -find all the places in the UI where the alarms can be eliminated (or acquitted) and modify it to use the new script

    The challenge with the second part is that changes to out-of-the-box dashboards can be overwritten in an upgrade of the FMS, so these updates should be repeated periodically.

    The same goes for change the Builder and Manager reports Service dashboards so that they are not accessible to the 'advanced operator', but these changes can be simpler...

    The seal cartridge that contains the 'checkUserHasalarmAdminRole' script is not tested and is completely not supported.

    Kind regards

    Brian Wheeldon

  • PowerCLI remove alarm

    Hello

    I have run tests in order to move one vcenter to another alarm and got a little bug I think.

    I copied an alarm, and I do not see it in the client gui or web. I couldn't find any powercli method to remove an alarm?

    I can't see because it of a alarm this object data center monitor and I copied on a vm folder.

    I can see from powershell using get-alarmdefinition and I know it's in my vm folder, but I don't know how to remove it.

    Thanks for any help

    Is - that do the trick?

    $alarmName = "MyAlarm.

    $alarmMgr = get-view AlarmManager

    $alarm = get-View ($alarmMgr.GetAlarm ($null)). where {$_.Info.Name - eq $alarmName}

    $alarm. RemoveAlarm()

  • Recovery of vSphere PowerCLI with alarms

    Hello

    Can you please help me write a PowerCLI script that would recover the vSphere alarms?

    I want the script to show only alarms last 24 hours only if not acknowledged or deleted.

    Example:

    Get-VIEvent - MaxSamples 10 | Select Fullformattedmessage # this command shows me the last 10 events

    Win01 from green to Red alarm # the script "MyAlarm" should show me this alarm

    win01 on esx1.company.pri in Lodz is turned off

    win01 on esx1.company.pri in Lodz stops

    Task: Stop virtual machine

    win01 on esx1.company.pri in Lodz is turned on

    Message on win01 on esx1.company.pri in Lodz: running VMware ESX in a virtua...

    starts win01 on the host esx1.company.pri in Lodz

    Task: Power on virtual machine

    Task: Initialize turn

    Alarm"monitor the health status"on changed from yellow to green data centers.

    Help, please.

    If the alarm was not recognized and authorized, it should still show.

    You can see these alarms with

    $dc = get - file - name of data centers

    $dc. ExtensionData.TriggeredAlarmState |

    Select @{N = 'Entity'; E = {Get-view-Id $_.} Entity | {{Select - ExpandProperty name}}.

    OverallStatus,

    @{N = "alarm"; E = {(Get-View-ID $_.)} Alarm). Info.Name}}

    -What are you looking for?

  • 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

  • How to plan to clear all alarms in Foglight on a specific date and time?

    Here's what I want to accomplish informing a group of people that all alarms will be erased and then foglight removes all the weapons on a specific date and time

    ..

    1

    I'd like to be able to plan / create a rule or any other option available to use... to be able to send an email through foglight or notification to a specific group of people telling them that all messages will be deleted.

    2nd

    What I'm looking for must be able to clear all alarms in Foglight to a date and a specific time.

    I just noticed this has not had a response.

    I hope that you could see the information contained in the KB, some items may have been written there so I recommend for anyone who wants to use it to test on a test server or check with the support, if there are recent scripts.

    How to purge the alarms? How to program the purge of alarms? (40651)

    Clear the alarms then X days (74729)

    How to clear alarms command line? How to program the clearing of alarms? (51324)

    Is there a way to clean only certain rules specific alarms? (73003)

    How to accuse reception/Clear old messages older then X number of days automatically (72146)

    Regarding the sending of notifications on a schedule, I think the simplest if to set that plan and create a rule with a true value, which is only applicable to this annex (annex rule or rule that is valid on a precise timetable) and has the action to send the notification to users on the alarms about to be cleared/purged.

    Hope this helps

    Golan

  • Clear recognized as alarms

    Does anyone know the trick to clear alarm States that get 'stuck' for a virtual machine? I have a number of VMs who have launched alarms in the last two months, and even after the virtual machine goes out of the State of the alarm AND the alarm has been recognized (there is no other options, i.e. Remove alarm), the virtual machine continues to show in VCenter as being in a State not nominative.

    Of course, this kind of 'false positive' is pretty boring, causing waste of time trying to figure out if it's a real question or "crying wolf".

    ——

    Jim Millard

    Kansas City, MO, USA

    Hello.

    I was able to clear these by disabling the alarm and then the reactivation.

    Good luck!

  • 8.0 questions about alarms

    Test 8.0 and really like the performance so far. I get this message in the console and can't find any doc respond to this message. Has anyone else got this with 8.0 before I go and open a ticket. Is there a task to do this?

    The number of alarms stored in the Foglight database exceeded 10000.0. There is more 35456,0 alarms have been cleared for more than a week. Please consider compensation.

    Message and help

    Hello

    I think that this is related to the following (I copy and paste part of the text).

    Motivation
    A lot of the information presented in the browser interface is derived from alarms (alarm counties, States of topology objects and so on). If the rules are configured in evil, this can lead to the creation of a very large number of alarms within the system. The server is a default limit of 10000 alarms which can be displayed and used to calculate the States of objects. When the Server enforces this limit, it gives preference to the current alarms so that objects are presented in the correct state.
    Symptom
    Browser interface performance is poor (that is, it responds slowly), in particular when displaying the table of alarms.
    Diagnosis / audit
    The server is not overloaded and is still in processing.
    CPU utilization on the server is high it provides alarm information.
    Threads may clog for a few seconds, intermittently, when you attempt to load the alarm details.

    It is not only a question of performance Foglight it is also a question of ' can you really manage an environment that has so many alarms?
    You probably want to clear alarms.
    You can also change alarms by individually turning off loud alarms, change of thresholds or disabling levels of warning alarm (different environment to run with different settings and parameters of the box may correspond to some but not all environments.)

    You can also go to the VMWare environment dashboard > Administration (tab) > Set alarm Sensetivity level and switch to critical alarms.

    I hope this helps.

    Golan

  • Clear all alrmes 3 months.

    Hello

    is it possible to erase all the alarms of the last 3 months in one and not select page by page on Foglight 5.6.4?

    Thank you.

    It's easier using groovy code in the script editor.  The rule "Clear old LogFilter alarms" is a good example to start.  The code should be amended to include all the alarms and if you want to only 3 months, not all, you will need to change the time interval.  Here's the code for the original rule.

    def alarmSvc is server. AlarmService;

    def alarms = alarmSvc.getCurrentAlarms ();

    def now = new Date();

    def cut = now - @daysToKeep;

    (alarm in alarm) {}

    If (@reporterRuleID is {alarm.getRuleID ()})

    If ((alarm.getCreatedTime ()) .before (cutoff)) {}

    alarmSvc.clearAlarm (alarm.getID ());

    }

    }

    }

    You do not want to change: break def = now - @daysToKeep;  in the time range desired.

    In addition, you would remove the "if (@reporterRuleID == alarm.getRuleID ()) ' in order to clear alarms for all types of rules."

    You do not want to be careful with that, but if you want to clear all alarms, there is not much risk.  If you want to delete only the aspecific alarms or time specitif, then you will need to make sure to get good logic for the time range.

    I hope this helps.

    Jeff

  • Restore default alarm / problem with 2 of them

    Hello everyone!

    I create a script to restore vCenter alarm on the default state.

    In fact, it's almost over because it works for 35 of them,

    but I am having problems with 2 of them who do not want to create.

    you can find the current version of my script here: http://ghostus.free.fr/Projet/PowerCLI/default-alarm.ps1

    (I commented the alarm two that do not work, then the rest of the code works)

    the part of the code that do not work is:

    Use of #Datastore to disk

    New 'or' 'Use of data to drive store' 'default alarm to monitor the datastore disk usage"

    7500 0 8500 metexpr 0 "Datastore" 147

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

    and:

    #Host State of connection and power supply

    New 'and' 'connection host and power status' "default alarm to monitor connection status and power.

    statexpr «isEqual"«notResponding" «runtime.connectionState"«HostSystem ' «»

    statexpr «isUnequal"«standBy" «runtime.powerState"«HostSystem ' «»

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

    but as it is the function of myself I'm not someone to see any error in there, except

    However, I wonder if some of you guys still managed create specially one of these 2 alarm using a script?

    And if yes, can you tell me, what type of event counter/expression/etc... have you used?

    Any thoughts on that would be appreciated = D

    I think I found the problem.

    It's in the way that the system will wait for the red and yellow conditions to be specified.

    If you don't want to test a specific condition, you must leave it as he got out of the constructor.

    If you change your statexpr like that function, it works.

    function statexpr([string]$operator,[string]$red,[string]$path,[string]$type,[string]$yellow){
    #Ajout d'un moniteur(expression) d'état(state) à une alarme
         $global:expr = New-Object VMware.Vim.StateAlarmExpression
         $global:expr.Operator = $operator
         if($red -ne ""){
              $global:expr.Red = $red
         }
         $global:expr.StatePath = $path
         $global:expr.Type = $type
         if($yellow -ne ""){
              $global:expr.Yellow = $yellow
         }
         $global:alarm.expression.expression += $global:expr
    }
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Automatic and alert acknowledgement claire

    Expert Hi

    I have approx vsphere 5.1.

    Last week the ESXi host restarts occur 2 times.

    1, draw attention to occur and monitoring system received the alert message.

    2nd monitoring system could not get the alert message, because I forgot to delete alert vCenter.

    So I want to remove automatic for every day.

    Could you tell me auto clear script using PowerCLI?

    Thank you

    Hiro

    You can recognize an alarm, see Re: reset and clear alarms for VMSRe: reset and clear alarms for VMS

    But restore to 'green' is not in the public API as far as I know.

  • Create the circuit of the STS - V between 2 15454 SONET with CE100T

    Hi all

    I have a problem that I can't find documentation for.

    I create an ethernet point to point circuit between 2 15454 SONET with CLC ver 8.5 knots.  The circuit will carry you a VLAN not routed between switches, Cisco 4948 in 2 data centers.  I use CE100T-8 cards which the ethernet 100/full value, checked the Frother.  The POS is configured with a GFP - F frame and 32-bit CRC.  Type of circuit is a single STS - V STS to 50Mbit of bandwidth.

    The switch ports are configured as access ports on the VIRTUAL LAN set to 100/full.  At the end of B, the connection between the switch and the port of THIS is a straight through cable.  End is a crossover.  switch ports are configured as such:

    switchport access vlan 512

    switchport mode access

    switchport nonegotiate

    Speed 100

    full duplex

    Problem I have is that end A "Transport Layer failure" alarm to end and end B has the 'Carrier loss on the LAN' alarm near end.  No end shows an ethernet connection

    Wiring has been tested, I've tried other ports on the CE and have deleted and recreated the circuit board.

    What simple step/setting I'm missing?

    Thank you in advance,

    Jim Bowen

    [email protected] / * /.

    Jim,

    It seems that your problem is by your side B that has the loss of carrier on the LAN. The failure of Transport layer will be on the end node in these cases.

    You mentioned that the end B is a straight through cable from the switch to the CE card but the side is cross. The first thing you can try is to put a cable on the side B as well because it looks like the side of A working very well (doesn't have the loss of carrier on LAN).

    I don't remember if cards of IT have an option to hardcode the speed and duplex but if they can only so if the suggestion of cable does not work. If this does not work, you can try setting autonegotiation on switch and the map of THIS to see if it solves your problem. Once the loss of the carrier and LAN to clear alarm you should be up and running.

    Also, I can't remember if the EC supports the loopback test, but if you can try try to put a Terminal loop on the B side (it's optical to) your end should appear and your switch should appear/maximum looping. I would like to know how things work out for you. Looks like you're almost there a few tweaks should get running.

    Thank you.

    Ryan

  • VCS CLUSTER PROBLEM

    Need an idea to fix a few alarms on my cluster configuration two VCS.

    VCS are running X8.5.1

    Had five alarms on the my resume

    1. the replication is no longer available.  Systems have 4ms between them.

    2 lost all Admin user accounts less?   Strange... Newspapers reported that no one was in the VCS

    3. admin VCS Master on the master account was returned to the TANDBERG default?   (Alarm has stated that this was the case).

    Changed the admin password and recreated my admin on the master account.

    4 approves. it 2 (slave) lost all VCS user account, but the admin password reset not and does not have that I have listed.

    My partner has been able to connect to the peer 2 VCS, even if his account is not listed in the list of users?

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

    After the captain restart now, I have three alarms

    a. unexpected software error has been detected in ClusterDB: unknown reason on the slave?

    b. There is a port conflict between the media (36000-47999) port range and the range of ports UDP ephermeral (40000-49999) on Master

    c. Core dump mode has been changed, but a reboot is required before this takes effect on Master

    1. any ideas what could have caused the user accounts to disappear on the page?  I think that they are still in the VCS configured just cannot see them.

    2 will be restarting on the master clear alarms b and c?

    3. a reboot on the peer 2 (slave) would open the ClusterDB alarm?

    I can't restart until later tonight that calls are up on both.

    Oh finally where one or even any changes a core dump mode?

    Thank you

    Connect to the VCS via Telnet/SSH/series and log in as 'root '.

    use the command 'selectsw' to see what partition software he's using now, then, if image1 is active, allows the command "selectsw image2" switch to the other, or vice versa, and then restart your computer.

    Wayne
    --
    Remember the frequency responses and mark your question as answered as appropriate.

  • Extract alarm VCenter via PowerCLI

    Nice day!

    I have a script which collects VCenter alarms and inform me by e-mail. It collects the alarm of VM, host, the data centers with clusters, etc. But I had the alarm to the VCenter. I can't find how to extract using PowerCLI. Invites, who face this problem.

    vmware.png

    Level vCenter alarms can normally be recovered through the folder hidden data centers.

    Use the entity returned by 'Get-file-name data centers'

  • PowerCLI to configured alarms report

    Hello

    I'm looking for a way to draw a report on alarms that we have configured in vCenter. For example, it would be nice to receive the information below.

    NameTriggerAction
    Redundancy Uplink lost networkNetwork connectivity lostE-mail: [email protected]

    Is there an easy way to get this information?

    Thank you

    Scott

    Figured it out.

    vSphere PowerCLI > Get-AlarmAction | where {$_.to - eq "[email protected]'" "} | Select alarmdefinition, actiontype, to trigger | FL

Maybe you are looking for