Thank you very much for the prompt reply from you and Robert.
I have forgotten to mention that the manger machine is a 32 bit RHEL WS4 OS.
Could that cause this kind of problem (getting two counter64 vars in one snmpget). Are there any rules that need to be followed when communicating between 64 and 32 bit OSs (like alignment rules etc.). I have tried snmpget with two counters on the same 64 bit OS though. Result is the same. Is the snmpget executable 64 bit OS compliant?
I will try adding the following snippet in to two file .c and .h for this one particular variable and put it into the master agent soon. If I can fix the problem before that, that would be great.
Init routine is as follows:
void
init_scalar_pnu(void)
{
// There are lot more variables than this one (includeing few more counters).
static oid pnuNumNCFileReads_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 42, 5, 3, 9 };
netsnmp_register_scalar(netsnmp_create_handler_registration
("pnuNumNCFileReads", handle_pnuNumNCFileReads,
pnuNumNCFileReads_oid,
OID_LENGTH(pnuNumNCFileReads_oid),
HANDLER_CAN_RONLY));
}
Handle function is as follows:
int
handle_pnuNumNCFileReads(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
tPnuNmeStats *newStats =(tPnuNmeStats *)g_StatisticsAgent.retrievePNUStatsFromShm();
switch (reqinfo->mode) {
case MODE_GET:
struct counter64 counterVar;
// Here I had low and high assigning as follows
// counterVar.low = newStats->NumBCFileRead & 0xffffffff;
// counterVar.high = newStats->NumBCFileRead >> 32;
// After seeing Mr. Robert Story's reply that the counter64 is 128 bit size
// I have change it to the following. Hoping that this is OK
counterVar.low = newStats->NumBCFileRead;
counterVar.high = 0;
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER64,
(u_char *)&counterVar,
sizeof(struct counter64));
break;
default:
snmp_log (LOG_ERR,"unknown mode (%d) in handle_pnuNumNCFileReads\n", reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
Thank you very much
Reddy
Dave Shield <[EMAIL PROTECTED]> wrote:
On 20/10/06, Venkata Guddeti <[EMAIL PROTECTED]> wrote:
>> How are these object implemented? Scalars, or table objects?
> These variables are implemented as scalars.
>> Which helper?
> I am sorry that I could not understand this question.
What does the code of your "init" routine look like?
> > I have also tried using the same counter64 variable twice.
> > snmpget -c public -v 2c localhost firstCounter64Var.0 firstCounter64Var.0
> >
> > I see that the subagent is receiving multiple gets for the first variable
> > and no gets for the 2nd variable.
If these are scalar objects, then the request will probably be "serialised" by
the master agent, so the two varbinds would be processed individually.
This means that the subagent would receive two separate GET requests.
But these should obviously refer to the two variables that have been requested.
> Yes, this is immplementd as subagent, I need to search in the forum for
> making my code as main agent.
You shouldn't need to change the code at all.
Just copy the .c and .h file into the source tree, in the "agent/mibgroup"
directory.
Then run "configure --with-mib-modules=myfile" (assuming the module
files are "myfile.[ch]"), and re-compile.
There are other ways of doing this, but that's probably the simplest.
Dave
[EMAIL PROTECTED]>
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
