Is it possible to make change in the template to handle the question 1 situation? For example, when see DocsIfCmtsCmStatusValueLastUpdate attribute, then generate agent.getAgentConfigManager().getSNMPv2MIB().getUpTime() - getDocsIfCmtsCmStatusValueLastUpdate() instead.
If question 1 is a No, then what is the best way to maintain custom code in the auto-gen classes so they will not be overwritten in the future generation?
You can put your code into the protected areas (between //--AgentGen BEGIN and //--AgentGen END) as described in the AgenPro documentation:
public TimeTicks getDocsIfCmtsCmStatusValueLastUpdate() {
//--AgentGen BEGIN=docsIfCmtsCmStatusEntry::getDocsIfCmtsCmStatusValueLastUpdate
// place your code here:
if (true) {
return myValue;
}
//--AgentGen END
return (TimeTicks) super.getValue(idxDocsIfCmtsCmStatusValueLastUpdate);
}
does not make any sense to me. Please check if you understand the LastUpdate mechanism! It should be a constant value that returns the value of sysUpTime at the time the object (row) was changed the last time.