Hello,
I've been trying to compile an agent (in win32, using VC++ 6.0) I have
extended to some test mib I have designed. I have executed the mib2c and
generated the 2 files and added them to the project and succesfully built
snmpd. Then I unload the service, replace the snmpd.exe file and upload the
service once again. I do some standard snmpget to system variables and they
work fine, but when I try to do it with the extended part I have made, I get
this message: TEST::avDescr.0 = no such object available on this agent at
this OID, I try using this command: snmpget -m ALL -v 2c -c public localhost
.1.3.6.1.4.1.1.1.1.0
I don't know if I'm doing something wrong in the compiling process or in
modifying the code for the mib. I'm not sure what to fill in this part, I
did this as a test. Part of the code is (I don't know if I'm doing it
alright):
int
handle_avDescr(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/* We are never called for a GETNEXT if it's registered as a
"instance", as it's "magically" handled for us. */
/* a instance handler also only hands us one request at a time, so
we don't need to loop over a list of requests; we'll only get one. */
u_char * test="avDescr test";
switch(reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *)& test/* XXX: a pointer to
the scalar's data */,
strlen(test)/* XXX: the length of the
data in bytes */);
break;
default:
/* we should never get here, so this is a really bad error */
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
Thanks a lot again and sorry to bother so much.
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus
|