Re: Failed to connect to the agentx master agent

This is a discussion on Re: Failed to connect to the agentx master agent within the SNMP Coders forums, part of the Networking and Network Related category; --===============0212282354== Content-Type: multipart/alternative; boundary="----=_Part_23984_6697601.1165408446487" ------=_Part_23984_6697601.1165408446487 Content-Type: text/plain; charset=ISO-8859-1; ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-06-2006
bhushan
 
Posts: n/a
Default Re: Failed to connect to the agentx master agent

--===============0212282354==
Content-Type: multipart/alternative;
boundary="----=_Part_23984_6697601.1165408446487"

------=_Part_23984_6697601.1165408446487
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

hello friends
for finding reason for this failure i found that
following function get call when i call init_agent
init_agent
|--subagent_pre_init
|--agentx_reopen_session
|--subagent_open_master_session
|---snmp_open_ex
|---snmp_sess_open
|-- _sess_open

|---netsnmp_tdomain_transport
netsnmp_tdomain_transport called as follows
slp->transport = netsnmp_tdomain_transport
& this netsnmp_tdomain_transport function fails it returns NULL
because of this session not get completed & so by this flow of code
if (main_session == NULL) {
printf("\n Failure snmp_open_ex\n\n");
}
if (main_session == NULL) {
/*
* Diagnose snmp_open errors with the input
* netsnmp_session pointer.
*/
if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID ,
NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS)) {
char buf[1024];
if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID ,
NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
snprintf(buf, sizeof(buf), "Warning: "
"Failed to connect to the agentx master agent
(%s)",
sess.peername);
netsnmp_sess_log_error(LOG_WARNING, buf, &sess);
} else {
snprintf(buf, sizeof(buf), "Error: "
"Failed to connect to the agentx master agent
(%s)",
sess.peername);
snmp_sess_perror(buf, &sess);
}
}

i get "Failed to connect to the agentx master agent" message
so what may be the problem ?
one more thing i understand that
if (session->flags & SNMP_FLAGS_STREAM_SOCKET)
this condition always get executed to true part of above if
so when i set udp in
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,NE TSNMP_DS_AGENT_X_SOCKET,
"udp:localhost:705");
or
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET,
"tcp:localhost:705");
it always execute true part of if i.e for TCP case
What is the problem here ?

Thanks in advance
Regards
Bhushan E. Sonawane

------=_Part_23984_6697601.1165408446487
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

hello friends<br>for finding reason for this failure i found that <br>follo=
wing function get call when i call init_agent<br>init_agent<br>|--subagent_=
pre_init<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; |--agentx_reopen_session<br>&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; |--sub=
agent_open_master_session
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp; |---snmp_o=
pen_ex<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp; |---snmp_sess=
_open<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |-- _sess_open<br>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; |---netsnmp_tdomain_transpor=
t
<br>netsnmp_tdomain_transport called as follows<br>slp-&gt;transport =3D ne=
tsnmp_tdomain_transport<br>&amp; this netsnmp_tdomain_transport function fa=
ils it returns NULL<br> because of this session not get completed &amp; so =
by this flow of code
<br>if (main_session =3D=3D NULL) {<br>&nbsp;&nbsp;&nbsp; printf(&quot;\n F=
ailure snmp_open_ex\n\n&quot;);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbs=
p; if (main_session =3D=3D NULL) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; /*<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp; * Diagnose snm=
p_open errors with the input<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&=
nbsp; * netsnmp_session pointer.&nbsp;=20
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p; */<br>&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp; if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATI=
ON_ID, NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS)) {<br>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char buf[1024];<br>&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (!netsnmp_ds_ge=
t_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; snprintf(buf, sizeof(buf), &quot;Warning: &quot;<br>&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp; &quot;Fa=
iled to connect to the agentx master agent (%s)&quot;,<br>&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p; sess.peername);<br>&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; netsnmp_sess_log_error(LOG_WARNING, buf, &amp;sess);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp; } el=
se {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; snprintf(buf, sizeof(buf), &quot;Error: &quot;<br>&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;=
Failed to connect to the agentx master agent (%s)&quot;,<br>&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp; sess.peername
);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; snmp_sess_perror(buf, &amp;sess);<br>&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ; }<br>&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br=
>&nbsp;i get &quot;Failed to connect to the agentx master agent&quot; messa=

ge <br>so what may be the problem ?<br>one more thing i understand that=20
<br>if (session-&gt;flags &amp; SNMP_FLAGS_STREAM_SOCKET) <br>this conditio=
n always get executed to true&nbsp; part of above if <br>so when i set udp =
in<br>netsnmp_ds_set_string(NETSNMP_DS_APPLICATION _ID,NETSNMP_DS_AGENT_X_SO=
CKET, &quot;udp:localhost:705&quot;);
<br>or <br>netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_I D, NETSNMP_DS_AGEN=
T_X_SOCKET, &quot;tcp:localhost:705&quot;);
<br>it always execute true part of if i.e for&nbsp; TCP case <br>What is th=
e problem here ?<br><br>Thanks in advance<br>Regards<br>Bhushan E. Sonawane=
<br><br>

------=_Part_23984_6697601.1165408446487--


--===============0212282354==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?p...rge&CID=DEVDEV
--===============0212282354==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders

--===============0212282354==--

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:02 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0