Hello!
Thanks. That tip will help me to debug programs.
Also I would like to know result of subagent connection inside of code,
fail/success of init_snmp() function.
I have found a workaround, see below
if(snmp_callback_available(SNMP_CALLBACK_APPLICATION,SNMPD_CALLBACK_REGISTER_OID)
!= SNMPERR_SUCCESS)
{
cerr<<"NOT CONNECTED"<<endl;
}
else
{
cerr<<"CONNECTED"<<endl;
}
As I saw in net-snmp code in case of success connection some callbacks are
registered. So, one of way to check success connection is checking
for SNMPD_CALLBACK_REGISTER_OID. I do not think is a right way because this
call back can be set in other places of code of next net-snmp library
releases or it now can be set in other ones.
Thanks in advance.
2009/1/26 Nikos Balkanas <nbalka...@gmail.com>
> Try:
>
> snmpd -f -Le -Dagentx
>
> BR,
> Nikos
>
> ----- Original Message -----
> *From:* Alexander Bubnov <alexander.bub...@gmail.com>
> *To:* net-snmp-users@lists.sourceforge.net
> *Sent:* Monday, January 26, 2009 4:35 PM
> *Subject:* How to know subagent successfully connects to master agent or
> not?
>
> Hello!
>
> I am playing around with NET-SNMP library... and just what to know subj.
>
> My code looks like the tutorial one (see section TUT:Writing a Subagent,
> http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Subagent):
>
> int main() {
>
> ...
> netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE,
> TRUE);
> netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
> NETSNMP_DS_LIB_DONT_PERSIST_STATE, TRUE);
> netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
> NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 100);
>
> netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
> NETSNMP_DS_AGENT_X_SOCKET, "udp:192.168.89.130:705");
>
> init_agent("event_example");
> init_snmp("event_example");
>
> ...
>
> return EXIT_SUCCESS;
>
> }
>
> inside call of init_snmp, subagent tries to connect to master agent. Here
> connection can be fail.
>
> What right way to know about that fail?
>
> Thanks in advance!
> --
> /BR, Alexander
>
> ------------------------------
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
>
> ------------------------------
> _______________________________________________
> Net-snmp-users mailing list
> Net-snmp-users@lists.sourceforge.net
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>
>
--
/BR, Alexander
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users