Hello folks,
I'm working on a collector that should should fetch events from VMware
vCenter database. I'm just struggling with some fundamental problems of
mapping the input to events and defining the offset data. Hope someone
could give me some hints how to progress.
Here's some details:

The DB connector returns the data in map format and appends "col_"
prefix to field names.

sqlquery.base:
SELECT EVENT_ID, CHAIN_ID, EVENT_TYPE, CREATE_TIME, USERNAME, CATEGORY,
VM_ID, VM_NAME, HOST_ID, HOST_NAME
FROM VIM_VCDB.dbo.VPX_EVENT
WHERE EVENT_ID > %s
ORDER BY EVENT_ID

Rec2Evt.map:
DataTagId, rec.RXMap.col_EVENT_ID
EventGroupID, rec.RXMap.col_CHAIN_ID
EventName, rec.RXMap.col_EVENT_TYPE
InitUserName, rec.RXMap.col_USERNAME

modified parts of release.js:

Collector.prototype.initialize = function(){
if (rec.CONNECTION_METHOD == "DATABASE") {
this.PARSER.getOffsetData = function(){
return rec.RXMAP.col_EVENT_ID;
}
instance.CONFIG.DBQuery.addParser(this.PARSER.getO ffsetData);
}
return true;
}

Record.prototype.parse = function(e){
instance.MAPS.Rec2Evt = new DataMap(instance.CONFIG.collDir +
"/Rec2Evt.map"); //Picked this up from some example, not sure if it
should be there. Didn't work without it either
if (rec.convert(e, instance.MAPS.Rec2Evt)) {
instance.SEND_EVENT = true;
}
else {
rec.sendUnsupported();
}
return true;
}

As you can see not all the fetched data is mapped, but I'm just trying
to get something in for starters. The offset should be the EVENT_ID
field. Does this need to be defined somewhere else than where it is at
the moment?
Now the "instance.MAPS.Rec2Evt" only holds the same information as
"Rec2Evt.map". Should it hold the "Event field, data value" (i.e.
DataTagId, 342) information? If so, how to do it?

I'm a newbie with this stuff, so please help me out.
Cheers,
Petri


--
petri_vesamaki
------------------------------------------------------------------------
petri_vesamaki's Profile: http://forums.novell.com/member.php?userid=104165
View this thread: http://forums.novell.com/showthread.php?t=448276