DX NetOps

 View Only
  • 1.  Spectrum 10.2 and splitting attributes to new attributes

    Posted Apr 10, 2017 12:35 AM

    Hi All

    I'm working on a custom eventdisp for parsing through an event, regexing out a bit of the payload of a varbind, and placing it into a new attribute.
    Having some issues

    The Payload I am regexing is like this with the bit I need being bolded -> so everything after vmwVpxdObjValue =    up to the "-"
    "            vmwVpxdObjValue = alarm.NetworkRedundancyLostAlarm - Event: Lost Network Redundancy (15551862)
                 Summary: Lost uplink redundancy on virtual switch "vSwitchISCSI". Physical NIC vmnic1 is down. Affected portgroups:"iSCSI1".
                 Date: 04/07/17 09:23:31
                 Host: aklw1.tnzi.com
                 Resource pool: LinuxWindows (Mayoral Drive)
                 Data center: Dell-MayoralDrive

    Or like this


        vmwVpxdObjValue = VDP: [002] The VDP appliance is nearly full - vim.event.EventEx (com.vmware.vdp.capacity.ok)  OR vim.event.EventEx (com.vmware.vdp.capacity.warn)  OR vim.event.EventEx (com.vmware.vdp.capacity.alert)  OR vim.event.EventEx (com.vmware.vdp.capacity.full)  OR vim.event.EventEx (com.vmware.vdp2.capacity.ok)  OR vim.event.EventEx (com.vmware.vdp2.capacity.warn)  OR vim.event.EventEx (com.vmware.vdp2.capacity.alert)  OR vim.event.EventEx (com.vmware.vdp2.capacity.full)
                 vmwVpxdTargetObj = akdp7


    Using Regex101 I worked out the regex for grabbing that to be
    vmwVpxdObjValue \=(.*?)\-

     

    So for parsing this I would think I would need to use a Create Event with attributes


    So doing a little googling I tried this
    0xfffa056f E 50 P "CreateEventWithAttributes( { C CURRENT_MODEL }, { H 0xfffa06f6 } SetEventVariable ( GetEventVariableList(), { S 4 }, GetRegexp( ToString({v 20}), {S vmwVpxdObjValue \=(.*?)\- }}, { I 1 })))"

     

    So I'm trying to regex the String for attribute 4 to pull out all the string between "vmwVpxdObjValue =" and "-" then parse that to a new attribute

    Also is there a nice library of examples of this sort of thing on the CA forums? Be nice if there was something we could look at to help our poor brains



  • 2.  Re: Spectrum 10.2 and splitting attributes to new attributes

    Posted Apr 11, 2017 02:19 AM

    Hi Jason,

     

    I don't know if it's the exact answer you are looking for but I did something similar not too long ago.

     

    https://communities.ca.com/thread/241773940

     

    Take a look at that discussion thread, especially the comments and it should help.



  • 3.  Re: Spectrum 10.2 and splitting attributes to new attributes

    Posted Apr 11, 2017 10:31 AM

    Jason,

     

    I got the following event procedure to work:

     

    0xfff00000 E 50 P " \
    CreateEventWithAttributes( \
    { C CURRENT_MODEL }, \
    { H 0xfff00001 }, \
    SetEventAttribute( \
    GetEventAttributeList(), \
    { U 101 }, \
    GetRegexp( GetEventAttribute( { U 1 } ), \
    {S \"vmwVpxdObjValue =(.*?)\-\" }, \
    { U 1 } ) \
    ) \
    )"

     

    I used {U 1} as my input event variable and {U 101} as my output event variable.

     

    Joe