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; ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
--===============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> &n bsp; &nb= sp; |--agentx_reopen_session<br> &= nbsp; &nb sp; &nbs= p; |--sub= agent_open_master_session <br> &nbs p;  = ; & nbsp; &n= bsp; &nbs p; |---snmp_o= pen_ex<br> &nbs p;  = ; & nbsp; &n= bsp; &nbs p;  = ; & nbsp; |---snmp_sess= _open<br>   ; = &n bsp; &nb= sp;   ; = &n bsp; &nb= sp; |-- _sess_open<br>  = ; & nbsp; &n= bsp; &nbs p;  = ; & nbsp; &n= bsp; &nbs p;  = ; |---netsnmp_tdomain_transpor= t <br>netsnmp_tdomain_transport called as follows<br>slp->transport =3D ne= tsnmp_tdomain_transport<br>& this netsnmp_tdomain_transport function fa= ils it returns NULL<br> because of this session not get completed & so = by this flow of code <br>if (main_session =3D=3D NULL) {<br> printf("\n F= ailure snmp_open_ex\n\n");<br> }<br> &nbs= p; if (main_session =3D=3D NULL) {<br> &= nbsp; /*<br> &nb sp; * Diagnose snm= p_open errors with the input<br>   ;&= nbsp; * netsnmp_session pointer. =20 <br> &nbs p; */<br> &nbs= p; if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATI= ON_ID, NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS)) {<br> &nb= sp; char buf[1024];<br> &nbs= p; if (!netsnmp_ds_ge= t_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) { <br> &nbs p;  = ; snprintf(buf, sizeof(buf), "Warning: "<br>&nb= sp;   ; = &n bsp; "Fa= iled to connect to the agentx master agent (%s)",<br>  = ; & nbsp; &n= bsp; &nbs p; sess.peername);<br>&nb= sp;   ; = netsnmp_sess_log_error(LOG_WARNING, buf, &sess); <br> &nbs p; } el= se {<br> &nb sp; &= nbsp; snprintf(buf, sizeof(buf), "Error: "<br>&= nbsp; &nb sp; &nbs= p; "= Failed to connect to the agentx master agent (%s)",<br> &nb= sp;   ; = &n bsp; sess.peername );<br> &n bsp; &nb= sp; snmp_sess_perror(buf, &sess);<br> &nbs= p;   ; }<br> &= nbsp; }<br> <br= > i get "Failed to connect to the agentx master agent" messa= ge <br>so what may be the problem ?<br>one more thing i understand that=20 <br>if (session->flags & SNMP_FLAGS_STREAM_SOCKET) <br>this conditio= n always get executed to true 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, "udp:localhost:705"); <br>or <br>netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_I D, NETSNMP_DS_AGEN= T_X_SOCKET, "tcp:localhost:705"); <br>it always execute true part of if i.e for 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==-- |
![]() |
| Thread Tools | |
| Display Modes | |
|
|