Create alarms by script?

Hello:

I try to create alarms by script and would really like to see that any help.

Right now I'm writing the script that will create the base alarms (for example, host memory status) which will send SNMP trap if memory join specific parameters...

Is this possible?

If you have scripts that will create other alarms and could share I really appreciate it... (I found little and do not have too much of them).

Thank you

qwert

Of course, the following script will send an SNMP trap when the ESX host is in maintenance mode.

$esxName = 

$alarmMgr = Get-View AlarmManager
$entity = Get-VMHost $esxName | Get-View

# AlarmSpec
$alarm = New-Object VMware.Vim.AlarmSpec
$alarm.Name = "My new alarm"
$alarm.Description = "My alarm description"
$alarm.Enabled = $TRUE

#Action
$alarm.action = New-Object VMware.Vim.GroupAlarmAction

$trigger = New-Object VMware.Vim.AlarmTriggeringAction
$trigger.action = New-Object VMware.Vim.SendSNMPAction

# Transaction
$trans = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
$trans.startstate = "yellow"
$trans.finalstate = "red"
$trans.repeats = $false

$trigger.transitionspecs += $trans

$alarm.action.action += $trigger

# Expression
$expression = New-Object VMware.Vim.EventAlarmExpression
$expression.EventType = "EnteringMaintenanceModeEvent"
$expression.ObjectType = "HostSystem"
$expression.Status = "red"

$alarm.expression = New-Object VMware.Vim.OrAlarmExpression
$alarm.expression.expression += $expression

$alarm.setting = New-Object VMware.Vim.AlarmSetting
$alarm.setting.reportingFrequency = 0
$alarm.setting.toleranceRange = 0

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

Tags: VMware

Similar Questions

  • 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

  • Create alarm "Network redundancy lost" by the script?

    Hello:

    I'm trying to write a script that will create the alarm in order to monitor the redundancy of the lost network (I know manually there) on the host.

    I know how to create alarm for additional exhibit the ' basic' event (LucD - thank you for your help) and I know that I have for alarm 'Lost network redundancy' to use 'vprob.net.redundancy.lost' instead of 'EnteringMaintenanceModeEvent' (as in my example); but I still struggle to combine...

    Can someone help me please?

    Thank you

    qwert

    I don't have a particular script fantasy with the settings and all the rest, but I can show you the steps to filter alarms by name and remove the desired one.

    alarm #retrieve Manager

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

    #Get the entity that contains the alarm that you want to remove. I'll do it for a virtual machine

    $entityView = get-Vm-name MyVm | Get-View

    #get all MoRefs alarm

    $alarmMoRefList = $alarmManager.GetAlarm($entityView.MoRef)

    #Retrieve tha alarm views from the MoRefs

    $alarmViewList = $alarmMoRefList | foreach (Get-view $_)

    #Now filter the name alrams

    $alarmToDelete = $alarmViewList | where {$_.Info.Name - eq "AlarmToDelete"}

    #Finally remove alarms

    $alarmToDelete.RemoveAlarm)

    It shouldn't be hard to put this in a script or function reussable. If you have problems with this, I'll be happy to help you again!

  • Is it possible to create alarms using CLI?

    Hello:

    I wonder if it is possible to create alarms (with specific parameters) on VC using thorugh CLI commands (script). Is this possible? Are there examples?

    I know it's very easy to manually create alarms (with specific parameters), but I want to distribute the script and create the same alarms (maybe delete all existing detectors before) on all my very quick VCs.

    Please let me know if you have any ideas where I should start.

    Best regards

    Olegarr

    No problem, you are more than welcome

  • The terminal on condition of some wiring time loop created by the script of LabVIEW

    Hello

    I've written a VI creating a VI scripted that contains a while loop. So far so good. The problem is that I want to connect a Boolean control to this while loop conditional Terminal. I thought I could do that is by using a property or an invoke node, but I couldn't find a way to access the machine.

    Anyone know how to access the conditional terminal using a node or have another idea to solve the problem?

    Kind regards

    Steffen.

    Hi no87,.

    attached, you will find a complete example.

    Hope that help.

    Best regards

    Mencef

  • I created a Javascript script that adds a watermark on the document action "paper print".  This works in Acrobat Pro, but does not work in the drive.

    I created a Javascript script that adds a watermark on the document action "paper print".  This works in Acrobat Pro, but does not work in the drive.  I am a novice using Javascript, so what am I doing wrong?

    Cannot use either addWatermarkFromFile or addWatermarkFromText methods of document with player as shown in the documentation. You can hide/display the form fields and the existing layers, so consider this approach.

  • How to create an installation script to support objects

    Guys please help with this I have been through Google all day but with no luck, I moved that the workspace to the production environment and application as well, but the thing is the tables using the app has not been moved with the application. On the assumption of the objects in the application page, I selected Yes in the include supporting objects option. Does anyone know how I could create an installation script to create the tables as well. ?

    rhisingh,

    Read documentation Application Deployment

    See also related book ORACLE APPLICATION EXPRESS SUPPORTING OBJECTS

  • Created a Java Script but the need in Spanish

    In Adobe Standard X, I created the following Script for a dynamic buffer

    Event.Value = util.printd (a-mmm-yyyy ", new Date()");

    That would show

    January 5, 2015

    How to say the same thing but in Spanish. I want to display

    5 January-2015

    Windows 7 x 64

    Remove the options to Format selected for this field.

  • Added keyboard shortcuts for menu items created by the script. Is this possible?

    Hi all

    I wanted to create a custom script menu and assign (on the numeric keypad) shortcuts to the menu items so that I could run a script with small changes rather than change a few (currently seven) scripts separated and assign a shortcut to each of them. But now, I realized that the custom menus are not visible in the "Keyboard shortcuts" dialog box (What a disappointment!)

    Am I missing something here? Or is there a workaround?

    1.jpg


    My idea was to trigger the main script - floating Tables.jsx - from the Manager menu item from the menu title as an argument.

    var tableMenu = app.menus.item("$ID/Main").submenus.item("Table");
    
    // "Floating Tables" sub-menu
    try {
        var subMenu = tableMenu.submenus.item("Floating Tables");
        subMenu.title;
    }
    catch(err) {
        var subMenu = tableMenu.submenus.add("Floating Tables", LocationOptions.AT_END);
    }
    
    var topLeftAction = app.scriptMenuActions.add("Top Left");
    var topLeftListener = topLeftAction.eventListeners.add("onInvoke", FloatingTablesHandler);
    var topLeftMenuItem = subMenu.menuItems.add(topLeftAction);
    
    var topCenterAction = app.scriptMenuActions.add("Top Center");
    var topCenterListener = topCenterAction.eventListeners.add("onInvoke", FloatingTablesHandler);
    var topCenterMenuItem = subMenu.menuItems.add(topCenterAction);
    
    var topRightAction = app.scriptMenuActions.add("Top Right");
    var topRightListener = topRightAction.eventListeners.add("onInvoke", FloatingTablesHandler);
    var topRightMenuItem = subMenu.menuItems.add(topRightAction);
    
    var bottomLeftAction = app.scriptMenuActions.add("Bottom Left");
    var bottomLeftListener = bottomLeftAction.eventListeners.add("onInvoke", FloatingTablesHandler);
    var bottomLeftMenuItem = subMenu.menuItems.add(bottomLeftAction);
    
    var bottomCenterAction = app.scriptMenuActions.add("Bottom Center");
    var bottomCenterListener = bottomCenterAction.eventListeners.add("onInvoke", FloatingTablesHandler);
    var bottomCenterMenuItem = subMenu.menuItems.add(bottomCenterAction);
    
    var bottomRightAction = app.scriptMenuActions.add("Bottom Right");
    var bottomRightListener = bottomRightAction.eventListeners.add("onInvoke", FloatingTablesHandler);
    var bottomRightMenuItem = subMenu.menuItems.add(bottomRightAction);
    
    var backToTextAction = app.scriptMenuActions.add("Back to Text");
    var backToTextListener = backToTextAction.eventListeners.add("onInvoke", FloatingTablesHandler);
    var backToTextMenuItem = subMenu.menuItems.add(backToTextAction);
    
    function FloatingTablesHandler(event) {
        var args = [event.parent.title];
        app.doScript(mainScriptFile, ScriptLanguage.JAVASCRIPT, args, UndoModes.ENTIRE_SCRIPT, "\"" + scriptName + "\" Script");
    }
    
    
    
    
    
    
    
    
    
    
    


    The main script reads the argument as follows:

    alert("The argument -- " + args[0]);
    
    


    If my memory is good, of Rorohiko's APID ToolKit can create "Assignable shortcut" menus I don't know this for sure at the moment because these menus a long time ago.

    BTW, the question was asked here, but he has failed.

    Kind regards

    Kasyan

    Hi Kasyan,

    If what you're asking, is if it is possible to assign a keyboard

    shortcut in the usual way with a menu created by a script item and then

    of course, of course you can.

    Add the menu item and then assign some k.shortcut you want-

    you will find your menu items in the 'Scripts' category in the keyboard

    Shortcuts dialog box.

    Ariel

  • 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?

  • After you create the action script for the creation of user Oracle DB - connector DBUM

    Hello

    After we have set up a user of IOM in the database on the target system, you must insert the same user in the RLS_USER_GROUPS table. (INSERT INTO CAMPDB. The VALUES of RLS_USER_GROUPS ('DV < user name >', RLS_DEV');  )

    The requirement is available to the user of multiple databases (different values of SID). But, the user to insert in a table to a database (DB1).

    If I write an after create a file of Action with action script, it will fire for all databases?  How to trigger this script only on the DB1 database?

    (2) in the literature, it is mentioned as below

    (Q) I installed the connector only in IOM (there is no connector server). Thus, in the 3rd and 5th stage, what should I mention

    Key code?

    Decode?

    Please suggest

    Thank you

    This query has worked well.

    INSERT INTO CAMPDB. RLS_USER_GROUPS (USERNAME, GROUPNAME) VALUES ({__NAME__}, "RLS_DEV")

  • How to remove an object (created by a script) element of the project?

    For example:

    TempNull = app.project.activeItem.layers.addNull ();

    .

    .

    .

    Use somehaw

    .

    .

    .

    TempNull.remove ();

    It will remove the object model

    But how the remove project (newly created element Null in folder "Solids")

    I want to keep the structure of the project the same as before the execution of the script.

    var comp = app.project.activeItem;
    var par = comp.pixelAspect;
    
    var layer = comp.selectedLayers[0];
    var rect = layer.sourceRectAtTime(0,false);
    var lpos = layer.position.value;
    var x = rect.left + rect.width/2+lpos[0];
    var y = rect.top + rect.height/2+lpos[1];
    
    app.beginUndoGroup("Centroid");
    
    center = comp.layers.addNull();
    center.name = "CENTROID";
    center.position.setValue([x, y]);
    
    var SceneScaleNull = comp.layers.addNull();
    var SceneScaleNullSource = SceneScaleNull.source; // grab null's source
    SceneScaleNull.name = "fixPAR";
    
    center.parent = SceneScaleNull;
    
    SceneScaleNull.property("Scale").setValue([100/par,100]);
    
    SceneScaleNull.remove();
    SceneScaleNullSource.remove(); // and remove it
    
    app.endUndoGroup();
    
  • Alarm configuration scripting

    Hello

    I am a beginner with PowerCLI but with the help of www.lucd.info and the VI Api, I am writing a script to automate the configuration of my alarm for vCenter.

    My script is intended to:

    -remove all measures for all alerts

    -rename some alerts with a prefix to notice the

    -Configure the same alerts with special values that we use in our structure

    the structure of the script is as follows (I wasn't able to join the script to this topic when posting...):

    #listing I target all alerts

    ...

    $alarmMgr = get-view AlarmManager

    $alarms = $alarmMgr.GetAlarm ($null)

    $alarms | %{

    + $alarm = get-view $_ +.

    + $spec = New-Object VMware.Vim.AlarmSpec #Ecrasement of the old shares (SNMP,...) +.

    + $spec. Action = New-Object VMware.Vim.GroupAlarmAction #Copie of the unchanged characteristics +.

    + $spec. Expression = $alarm.Info.Expression +.

    + $spec. Definition of = $alarm.Info.Setting +.

    + $spec. Name = $alarm.Info.Name +.

    + $spec. Enabled = $alarm.Info.Enabled +.

    + $spec. Description = $alarm.Info.Description +.

    +     +

    + If ($tgtAlarmName - contains $alarm.Info.Name) {+

    + $spec. Name = 'RBS'$alarm.Info.Name

    + $alarmTrigger = new-Object VMware.Vim.AlarmTriggeringAction +.

    + $alarmTrigger.Action = new-Object VMware.Vim.SendEmailAction +.

    + $alarmTrigger.Action.toList = $cibleMail +.

    + $alarmTrigger.Action.CcList = $cibleMailCopie +.

    + $alarmTrigger.Action.Subject = $objetMail$spec. Name

    + $alarmTrigger.Action.Body = "alert vCenter \n\n problem with the monitor:"$spec. "" Name'etat\n of the son check \n\n ' +.

    +          +

    + #here certain conditions block the forward different configuration +.

    +          ......+

    + $spec. Action.Action = $alarmTrigger

    +     }+

    + $alarm. ReconfigureAlarm ($spec) +.

    }

    The unit test worked fine, but when I run my script with the values of wright for the final test, I always get an error:

    "Exception calling 'ReconfigureAlarm' with '1' or the arguments: ' not initialized: vim.alarm.alarmAction [] action..." »

    line 203 of my script, and that occur the same number of times, the number of alarms I in vCenter.

    As the declaration of the VMware.Vim.AlarmSpec object is not in a block of air conditioning, I can't understand why I get these error

    As anyone thoughts on that?

    PS: Excuse my bad English, if one of my sentences was not quite clear, is fell free to re - ask

    Likewise, my comments on the script is in french, but if you need I can translate some lines

    Of course, I've PM - ed you my e-mail address.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Create the Java script function

    Hello

    I try to create the following java script function to retrieve a character string:

    String.prototype.left = function (findWhat)

    {

    try

    {

    var = this.search (findWhat) position;

    If (position > - 1).

    Return this.substr (0, position);

    }

    catch (e)

    {

    / / alert (e.message);

    }

    return "";

    };

    var text = "myText-description";

    var separator = "-";

    In this example, I try to extract the word on the left before the "-" delimiter (mtText)

    But I get the following error message: failed to add a property to an object sealed: left

    My question is how can I create a simple js function in the Orchestrator in the following example

    Thank you

    Hello

    You can try the code to retrieve a string from left to right below the delimiter.

    
    searchstr();
    
    function searchstr() {
       try{
       var str = "angela.soni"
       var pos = str.indexOf("."); // Currently this is hard coded, you can pass delimiter as an input parameter.
       if(pos>-1) {
          var substr = str.substring( 0, pos );
          System.log(substr);
       }
       else {
          System.error("Delimiter not found");
       }
      }
      catch (e) {
       System.error("Search failed: " + e);
      }
    }
    

    I hope this would help you.

    Thank you!

    Angela

  • Create hyperlinks with script, without increase of large size and treatment of the BP reqs resulting?

    Quick Summary: I have a script as part of a process involving a lengthy document of data merge base that creates hyperlinks by using doc.hyperlinkURLDestinations.add (). The script is simply extracted from text into clickable hyperlinks.

    The problem is, the final PDF files that emerge from this process are 300% the size of a PDF file without the running script and are very slow to deal with. Most of that extra weight from an increase of 740 000% crazy (!) in the amount of data used for "info-Structure" (and that's after you run the version with hyperlinks through the Acrobat PDF Optimizer).

    The amount of the data structure in the PDF files with hyperlinks ends up being more than twice the size of the entire file PDF files without hyperlinks added. There is also a substantial increase in the size of the "the cross reference Table.

    This sharp increase in weight becomes a quick and simple process which takes a few minutes in a slow winding which takes hours, to the creation of files with a very slow pace inflated in a process that is prone to crashing and not.

    I hope for another way to create hyperlinks that adds all this weight.

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

    Details: Here is my current process. It works fine except step 2 causes the final size of the PDF file and the time required for the execution of other processes to increase massively. I know there are different ways to implement hyperlinks in a PDF document - I hope that there is a different approach, that I can use to step 2 which avoids this massive expansion.

    The goal is to create 600 2 PDF pages from an indesign template using the fusion of data, with each PDF with a file name that reflects reviews and live hyperlinks which vary from one record to the next. Here is my current process (for analysis comparative, the machine is a Mac Pro, Lion, CS6, with RAM 6gbs, and all files are on a disk HARD space, no transfer of data on all networks):

    1. Implement an INDD 2 pages with placeholders for merging data and spreadsheet.
    2. Create merged INDD, import hypertext links and other content as text, then run this script in InDesign that makes hyperlinks using live doc.hyperlinkURLDestinations.add ()
    3. Export a PDF to 1 200 PDF page - file > export if step 2 was made, or the merger of data tool if it wasn't.
      • Without step 2: the PDF file is about 110mbs and takes a few minutes to create.
      • Step 2: the PDF file is about 170mbs and takes over an hour and a half to create - I do not know exactly how long I ended up leaving running from one day to the next, but he had already run 1: 20 p.m. when I left and doesn't look close to finishing.
    4. Run this script in Acrobat to chop the PDF into segments of 2 pages with names based on worksheet data.
      • Without step 2: the process takes about quarter of an hour, slightly faster than a secondcreation of PDF files, and PDF files are 700kbs.
      • Step 2: the process crashes after about 10 PDF files and takes minutes to produce each one. Even if it did not freeze, it should be about 25 hours to do all of them.
      • In step 2 and then reducing the PDF to 45mbs through optimizer PDF Acrobat and 'save in reduced format' to cut, backward, compatibility, the process takes about 4 hours, producing a PDF every 20-30 seconds, and PDF files are around 3 MB each. Through to watch the process, almost all of the extra time taken comes from step "backup PDF... "for each of them.

    Each PDF 2 pages has 14 or 15 of the hyperlinks. I do not understand how the 14 and 15 of the hyperlinks can translate into an additional 2mbs of "" and something like the processing time of more than 3500% to create each PDF file.

    Can someone suggest modifications to the script in step three, which could avoid all this overhead? Here's the complete script for convenience:

    app.findGrepPreferences = app.changeGrepPreferences = null;

    var doc = app.activeDocument;

    app.findGrepPreferences.findWhat = '(http://.*$|https://.*$)';

    var objs = doc.findGrep();

     

    for (var i = 0; i < objs.length; i++) {

        var currTarget  = objs[i];

        var lnkDest = doc.hyperlinkURLDestinations.add(currTarget.texts[0].contents);

        var lnkSrc = doc.hyperlinkTextSources.add(currTarget);

        var lnk = doc.hyperlinks.add(lnkSrc, lnkDest);

    }

    alert('Processed '+objs.length+' hyperlinks');

    Edit - Here is a side-by-side comparison of the "Use of space Audit" tool optimizer based on CSSTidy Acrobat PDF, showing where the hyperlinks add volume. I scored two sharp increases in red...

    acrobat-audit.png

    .. .so there is a massive increase going crazy in the size of the info "Structure", a tiny mbs 0.000238 to 1.76 MB - two and a half times the size of the original file, just on 'info Structure. It's a 740 000% increase...

    There is also a strong increase in fat in the cross reference table, 0,0046 mbs to 0.427 mbs - table of cross-references in the PDF with hyperlinks is more than half the size of the original file.

    The only differences between two files PDF's, we have 14 clickable hyperlinks attached to existing excerpts of the text (the "hyperlinks" are from a PDF file that comes with living aggressive optimization PDF and images are so much smaller).

    So it turns out the source of the problem was the document tags.

    Make sure that the PDF file is not created as a PDF by InDesign Tagged, and it behaves. I don't know what is it about hyperlinks and marking that makes it swell massively, but it does.

Maybe you are looking for