>>> I have debug code in my MIB handler but there is nothing like an error.
>
>>What debug code do you have in this routine?
>>What is displayed when the GET request gets passed over?
>
> I've get only debug code at these routines:
>
> netsnmp_ds_set_string()
> init_agent()
>
>But *WHAT* debug code do you have?
>There's no point in us trying to guess - please post the code of your handler
>routine.
This is in excerpt of my code at the beginning (in C):
/* print log errors to syslog or stderr */
if (background)
snmp_enable_calllog();
else
snmp_enable_stderrlog();
/* we're an agentx subagent? */
if (agentx_subagent) {
/* make us a agentx client. */
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
}
/* run in background, if requested */
if (background && netsnmp_daemonize(1, !slog))
exit(1);
/* initialize tcpip, if necessary */
SOCK_STARTUP;
/*set IP and port of MasterAgent*/
sprintf_s(connectionInfoAgentX,SMALL_BUFFER,"tcp:%s:%s",SnmpMasterAgentIp,SnmpPort);
info=netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,NETSNMP_DS_AGENT_X_SOCKET,
connectionInfoAgentX);
Log(3,"Return of netsnmp_ds_set_string(): %d",info);
/* initialize the agent library */
info=init_agent("omgagent");
Log(3,"Return of init_agent(): %d",info);
/* initialize our mib */
/* 1st init tables */
init_mib_physicalInterfacesTable();
init_mib_bChannelTable();
init_mib_sessionTable();
// Preset with environment value
getenvError=getenv_s(&getenvRetValue,envval,SMALL_BUFFER,"SNMPLOCATION");
if (strlen(envval)!=0) {
scalar_setstr(&mib_scalar_Location, envval);
}
else {
scalar_setstr(&mib_scalar_Location, "Lost in space");
}
getenvError=getenv_s(&getenvRetValue,envval,SMALL_BUFFER,"sn");
if (strlen(envval)!=0) {
scalar_setstr(&mib_scalar_Productname, envval);
}
else {
scalar_setstr(&mib_scalar_Productname, "99999");
}
getenvError=getenv_s(&getenvRetValue,envval,SMALL_BUFFER,"VUSER");
if (strlen(envval)!=0) {
scalar_setstr(&mib_scalar_SoftwareVersion, envval);
}
else {
scalar_setstr(&mib_scalar_SoftwareVersion, "");
}
getenvError=getenv_s(&getenvRetValue,envval,SMALL_BUFFER,"VUTILS");
if (strlen(envval)!=0) {
scalar_setstr(&mib_scalar_UtilityVersion, envval);
}
else {
scalar_setstr(&mib_scalar_UtilityVersion, "");
}
getenvError=getenv_s(&getenvRetValue,envval,SMALL_BUFFER,"VMODULES");
if (strlen(envval)!=0) {
scalar_setstr(&mib_scalar_ModuleVersion, envval);
}
else {
scalar_setstr(&mib_scalar_ModuleVersion, "");
}
scalar_setstr(&mib_scalar_TrapMessage,"");
scalar_setstr(&mib_scalar_fmsrvComponentsUndev, "");
init_mib_scalar();
init_snmp("omgagent"); //say hello to snmpd
/* In case we receive a request to stop (kill -TERM or kill -INT) */
keep_running = 1;
signal(SIGTERM, stop_server);
signal(SIGINT, stop_server);
snmp_log(LOG_INFO,"omgagent is up and running.\n");
Log(3,"Connect to SNMP Master AgentX (IP:%s
Port:%s)",SnmpMasterAgentIp,SnmpPort);
---------------------
The function "scalar_setstr()":
void scalar_setstr(char **scalar, char *string)
{
if (*scalar)
{
free(*scalar);
}
*scalar = malloc(strlen(string)+1);
strcpy(*scalar, string);
}
-------------------------
>What you need (at the very least) is a debug statement at the start of your
>handler routine, which will indicate
>whenever it is called. And possibly debug statements
>at other significant points throughout the processing, so you can trace the
>flow of control.
>
>These probably won't be part of the initial template.
>You will need to add them to the code yourself.
>
>> In my Subagent I call sometimes the routine "Sleep()"
> >but only with a value of between 2 and 5 (Milliseconds).
>
>So no - the argument to 'sleep()' is in seconds, not milliseconds.
>(You'd use 'usleep' for finer-grained delays)
I'm writing in C, there is the definition of Sleep() like that:
VOID WINAPI Sleep(
__in DWORD dwMilliseconds
);
The time interval for which execution is to be suspended, in milliseconds.
Thanks for your rapid help!!
Julian
________________________________
Ferrari electronic AG
Ruhlsdorfer Str. 138
14513 Teltow (bei Berlin)
Handelregister Potsdam: HRB 12091
Vorstand: Johann Deutinger, Ulrich Dziergwa, Dr. Hartmut Fetzer
Aufsichtsrat: Peter Mark Droste (Vorsitzender)
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users