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