mObj = create("MonFetch", "mFetch");
default ClassName = "";
me=this->ReadsRulesFrom->fileName;
instrPack="";
START {
..eol
} do {
/*
print("");
print("Usage: sm_adapter -s <serverName> -b <brokerLoc> -DClassName=<className> ".me);
print("[Default mode runs on whole topology]");
print("");
*/
if (ClassName == "") {
GET_TOPO_INSTR();
} else {
print(mObj->getInstrumentationMapping(ClassName));
}
}
GET_TOPO_INSTR() do {
print("<TopoMonitor>");
foreach topoInst (getInstances("ICIM_UnitaryComputerSystem")){
tObj = object(topoInst);
sysOID = tObj->SystemObjectID;
dName = tObj->Name;
oData=sysOID.",".dName;
print("<Device sysOID=\"".sysOID."\" name=\"".dName."\">");
instrDeviceTable = table();
foreach cRel (tObj->ComposedOf) {
cRelObj = object(cRel);
foreach instrRel (cRelObj->InstrumentedBy) {
instrObj = object(instrRel);
ClassName = instrObj->CreationClassName;
if (!defined(instrDeviceTable[ClassName])) {
instrDeviceTable[ClassName]=dName;
}
}
}
foreach className (instrDeviceTable) {
attrData=list();
print("<Class name=\"".className."\">");
oidPack = mObj->getInstrumentationMapping(className);
//attrData = PROCESS_OIDPACK(oidPack);
attrData = PROCESS_OIDPACK(oidPack)? IGNORE;
if (sizeOf(attrData)== 0 ) {
print("</Class>");
continue;
}
print("<attributes>");
foreach attr (attrData) {
print("<attribute nameOID=\"".attr."\"\/>");
}
print("</attributes>");
print("</Class>");
}
print("</Device>");
}
print("</TopoMonitor>");
}
PROCESS_OIDPACK(oidPack){
input = oidPack; do {vBind=list(); }
rep(var:word do {vBind += var; } )
}do {
return vBind;
}