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?

Tags: VMware

Similar Questions

  • Shell script to start a Terminal session with environment from

    Hi all

    I installed 12.1.1 on OEL 5.
    As I install it with a single user, I will need to switch between the application and db layer.
    I would like to create two scripts, one that opens a Terminal Services session and the env app of the sources file and another that opens the Terminal Server session and the env sources db file.

    Someone has he done something like this before?

    Thank you

    Hello

    In this case, you can create two files env (one called apps.env and the other a db.env called) under the home directory of the user (for example, / home/oracle), and in each file env you source the env to application/database file. So, every time you login, you have the source of the two files manually to set the variables approx.

    Thank you
    Hussein

  • How can I reproduce a field in JavaScript, including its action script?

    Hello

    I saw ways to reproduce effectively the value of a field in JavaScript.  The following code is from a JavaScript for Acrobat API document:

    f = this.getField ("myField");

    for (var I in f) {}

    try {}

    If (typeof f [i]! = 'function') / / do not list the field methods

    Console.println (I + ': ' + f [i])

    } catch (e) {} / / an exception occurs when we get a property that

    } / / does not apply to this type of field.

    With the exception of all the scripts that could be associated with the field, I think that the code actually gives the variable "f" a copy of the field "MyField" - with all of its properties and values.  At this point how would I be able to get a copy of all the scripts in action the field?  I want to go to a certain extent, where I could possibly add them to the field 'f'  Is it possible to do this?

    Thank you for your time and consideration,

    Mike

    PS: I use Acrobat Pro XI for the development.

    No, you can not what actions/scripts are attached to field (events) with JavaScript triggers.

  • vCenter alarms and calling a powershell script

    OK, I'm missing something or I'm doing something incredibly stupid.

    I created a simple powershell script that starts a pre-defined VM. I tested it in PowerGUI, it works fine, no problems so far.

    Now all I want to do is set an alarm to ANOTHER VM of vCenter, such that if the virtual machine goes down (power of the off state), the script above is called and "failover" VM is started.

    I set up the alarm with a "run a script" action, the script is: "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe C:\SCRIPTS\FAILOVER.ps1" (including the quotes).

    And you guessed it: the script does not run. I'm sure that it doesn't, because the part of the script creates a log file, and this file is not creaed (it IS created when I run the PowerGUI script).

    What I am doing wrong? How can I get the alarm to hit my script?

    Thank you!

    I've never managed to run a PS script this way or the other.

    But I found a workaround.

    You can start your PS script indirectly via a BAT or CMD file.

    That's what I set in the value field

    c:\windows\system32\cmd.exe /c c:\Scripts\alarmscript.bat
    

    And the BAT file contained this

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsolefile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" -Command C:\Scripts\Test-Alarm.ps1
    

    In the example script I used

    Get-VIToolkitVersion | Out-File "C:\Scripts\PSOut.log" -Append
    Get-PSSnapin | Out-File  "C:\Scripts\PSOut.log" -Append
    
  • start the workflow in webviews - XMLHttpTransport error: 500 Internal Server Error trying to contact vCenter

    Hey all,.

    I use the latest version of vCO (5.5.2.1951762)

    I have a deployment workflow that works well at the start of the customer of vCO with vSphere Web Client.

    When I try to run the same workflow of a webview (on order as well as the default weboperator), I get the following error message as soon as I try to enlarge the vCenter in the tree to select an object for an attribute:

    : Error XMLHttpTransport: 500 Internal Server Error(type: error) "err".


    I also tried some other workflows, which generate drop down menus for the selection of the model with a set of predefined objects VC:VirtualMachine. As soon as I start the workflow, I get the same error.

    It doesn't matter whether the workflow runs as dialogue or not.



    So basically vCO doesn't seem to be able to browse the inventory of server vCenter or something.

    Tried to run the workflow with normal users as well as users who belong to the group admin vCO.

    Attached /var/log/vmware/vco/app-server/server.log log file.

    Any idea?

    Concerning

    Tim

    Here is the link to mentioned ko:KB VMware: fixing related errors in vCenter Orchestrator 5.5.2 SDKTypeConvertor_server

  • Start a workflow context VmFolder

    Hey,.

    I created a workflow customized to deploy virtual machines and allowed him as an action context for Clusters, the VmFolders and data warehouses.

    When I run the workflow in the client vSphere on a Cluster, the Cluster-input parameter is on the cluster where I ran the context menu. It goes the same for the data store.

    Only when I start the workflow by right-clicking a VmFolder, the parameter with the type VC:VmFolder does not get filled.

    No idea why? Is this a bug?

    vCenter version 5.5 U2, vCo device version 5.5.2

    Thank you

    Tim

    Hi Tim,.

    Yes, it's a bug (or, to be precise, not fully implemented implementation of features). I fixed it a week ago. The fix will be included in future releases - 6.0 and 5.5U3.

    -Ilian

  • '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.

  • vCenter alarms &amp; SNMP Trap

    Gang-

    I try to get my vCenter alarms to send traps SNMP for SNMP Manager/receiver so we can automatically open the service tickets based on certain types of vCenter alarms.  I have loaded MIB and OID translate for VMWARE-VC-EVENT-MIBs.

    Everything goes well and using the free utility TrapReceiver I'm able to test receive interrupts.

    Here's my problem...

    I don't know how vCenter is differentiate the name of alarm vCenter in trap data.  Some vCenter alarms/traps, I want my ticket system to open lower or higher priority tickets, so I need to figure out how vCenter translated the alarm at the "vmwVpxdObjValue" into the trap.  Unfortunately I can't find any information on how to translate this value and I don't want to wait for all my events to trigger production, just to get a sample, so I don't know what to expect.

    Any ideas?

    VMWARE-VC-EVENT-MIB

    vpxdAlarmInfo

    notification

    OID - 1.3.6.1.4.1.6876.4.3.0.203

    Thank you

    Well shoot - that isn't quite right either.

    Seems that if it is a fault of the alarm system, the TRAP will leverage the value of $alarm.extensiondata.info.systemname as the beginning of the vmwVpxdObjectValue data.

    If it is a user/custom alarm, it seems to refer to the value of $alarm.extensiondata.info.name.

    I have to have a script that includes both.

  • Curl call to start the workflow with the Type of table / Composite

    Hello I'm trying to start a workflow with an array type / Composite.

    I'm using curl to make the call and post fields look like this when you send just a string:

    {

    "settings":

    [

    {

    'value ':

    {

    "chain": {"value": "test"}

    },

    "type": "string",.

    "name':"vm. "

    "scope": "local".

    }

    ]

    }

    How would he format if I had a type of table / Composite?

    The composite type has the format of the Type / size and String / number

    Well, I don't know like what your workflow, but here is what looks like my quick test workflow:

    MESSAGE: https://YOUR-VCO-SERVER;8281/vco/api/workflows/475a3967-2c29-4140-a63f-ec1822ec330b/executions/

    Headers:

    Content-Type: application/json

    Accept: application/json

    And here is the json work to get into the body:

    {
        "parameters": [
            {
                "value": {
                    "array": {
                        "elements": [
                            {
                                "composite": {
                                    "type": "CompositeType(Type:string,size:number):drives",
                                    "property": [
                                        {
                                            "id": "Type",
                                            "value": {
                                                "string": {
                                                    "value": "NTFS"
                                                }
                                            }
                                        },
                                        {
                                            "id": "size",
                                            "value": {
                                                "number": {
                                                    "value": 20
                                                }
                                            }
                                        }
                                    ]
                                }
                            },
                            {
                                "composite": {
                                    "type": "CompositeType(Type:string,size:number):drives",
                                    "property": [
                                        {
                                            "id": "Type",
                                            "value": {
                                                "string": {
                                                    "value": "ext3"
                                                }
                                            }
                                        },
                                        {
                                            "id": "size",
                                            "value": {
                                                "number": {
                                                    "value": 25
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                },
                "type": "Array/CompositeType(Type:string,size:number):drives",
                "name": "drives",
                "scope": "local"
            }
        ]
    }
    

    I've included the workflow here as well.

    Just a simple script:

    System.debug("Drives:");
    for each (drive in drives){
      System.debug("================");
      System.debug("Type: "+drive.Type);
      System.debug("Size: "+drive.size);
    }
    

    My results:

  • export and import vcenter alarms

    Hello

    I'm working on the migration of all the alarms configured production vcenter (running on 5.1) to another (race with 5.5). Y at - it a medium CLI script or the power to perform the same task.

    your quick response will be highly appreciated. I need this bad.

    Please see the resources below

    VMware KB: Restoration and copy of the Server vCenter alarms

    Download | stripeyfish

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

  • VCenter alarms

    My fault, I removed the lun without deleting the data store in the virtual machines. And now, my sensors are going crazy.

    I made a new analysis of data on my cluster warehouses but how vcenter to alarm.

    I disabled the alarm actions and responsive too.

    Help, please

    Thank you

    RJ

    can you recognize the alarm and then back to green?

  • That starts a workflow?

    Hello

    We want to determine what events or user's activities to start workflows. This question can be interpreted in many ways, so for example, what form button causes workflow POAPPRV to start? We would like to determine for a long list of workflow that gave me.

    Is it possible to determine this?

    Thank you

    The workflow engine API that start the workflow can be found below.

    1 wf_engine. StartProcess()
    The syntax is less than
    StartProcess procedure
    (itemtype in varchar2,
    ItemKey in varchar2);

    ItemType is the name of the workflow that you listed for example: POAPPRV.

    2 wf_engine. LaunchProcess()
    The syntax is less than

    procedure LaunchProcess
    (itemtype in varchar2,
    ItemKey in varchar2,
    process in varchar2 default ",
    Take in varchar2 default ",
    owner in varchar2 default ");

    ItemType is the name of the workflow that you listed for example: POAPPRV.

    You can learn about events that will launch the workflow listed as follows.
    In fact the event subscriber that has the type of action as "Send the event message to a workflow process" will launch the workflow.
    You can find the subscription to events that will launch the workflow using query below
    Select * from wf_active_subscriptions_v where wf_process_type = 'WFERROR.
    wf_process_type - is the name of the process that will be launched

    You should run this query for each of the elements of the workflow

  • change the setting of the alarm (action)

    Hello:

    I need to change the settings for my existing alarm by script.  I need add SNMP specific alarm action (I know how to filter by name).

    Can anyone help me please with it?

    Thank you

    qwert

    I tested with an alarm which has 1 action (send an email) and the adapted below script seems to work.

    $entity = Get-View (Get-Folder -Name "Datacenters").ID
    $alarmMgr = get-view AlarmManager
    
    $tgtAlarmName = "Test Alarm"
    
    $alarms = $alarmMgr.GetAlarm($null)
    $alarms | % {
         $alarm = Get-View $_
         if($alarm.Info.Name -eq $tgtAlarmName){
              $spec = New-Object VMware.Vim.AlarmSpec
              $spec.Expression = $alarm.Info.Expression
              $spec.Setting = $alarm.Info.Setting
              $spec.Name = $alarm.Info.Name
              $spec.Enabled = $alarm.Info.Enabled
              $spec.Description = $alarm.Info.Description
    
              $spec.Action = New-Object VMware.Vim.GroupAlarmAction
              $action = New-Object VMware.Vim.AlarmTriggeringAction
              $action.Action = New-Object VMware.Vim.SendSNMPAction
              $trans = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
              $trans.StartState = "yellow"
              $trans.FinalState = "red"
              $action.TransitionSpecs += $trans
    
              $spec.Action.Action = $alarm.Info.Action.Action
              $spec.Action.Action += $action
    
              $alarm.ReconfigureAlarm($spec)
         }
    }
    

    Note 1: you need not do the LoadWithPartialName more since 1.5 VITK

    Note 2: for the AlarmManager Get-view has a direct pointer. No need to go through ServiceInstance more.

    Note3: first I copy the existing stock of $alarm.Info.Action and then I add the new $action

  • 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)
    
  • Action Script code to restart the application air at regular intervals

    I hope that someone more versed in the action script 3 for air can help me!

    I have an app which I intend to display on the ipad at an exhibition. I'd be able to add code to the script action.
    who's going to restart the application after a certain period of time (say 5 minutes), if it has not interacted with that is the screen has not affected?

    I would be very grateful if someone could help me with this

    You can call a function when the idle time is 5 minutes and function reset everything that is appropriate for your application:

    var fiveMin:int = 5 * 60 * 1000;

    var: timer = new Timer(fiveMin,0);

    timer.addEventListener (TimerEvent.TIMER, resetAppF);

    Timer.Start ();

    this.addEventListener (MouseEvent.MOUSE_DOWN, resetTimerF);

    function resetTimerF(e:MouseEvent):void {}

    Timer.Reset ();

    Timer.Start ();

    }

    function resetAppF(e:TimerEvent):void {}

    do all reset your app

    }

Maybe you are looking for