Re: AgentX reconnect time

2019-02-21 Thread Anders Wallin
It's not working in 5.7.3 either and w/o the possibility to us "-c" option
for the agent.
So it's broken!!

Regards
Anders Wallin


On Fri, Feb 22, 2019 at 7:44 AM Anders Wallin  wrote:

> Hi Mostafa,
>
> which version of net-snmp are you using?
> In 5.8 you can use the "-c" option which works, but I also found a bug in
> it using the default paths
>
> *# ./mysubagent -h   *
> USAGE: ./mysubagent [OPTIONS]
>
> OPTIONS:
>   -c FILE[,...] read FILE(s) as configuration file(s)
>   -Cdo not read the default configuration files
> 
> *# cat agentx.conf *
> [snmp] logTimestamp 1
> agentXPingInterval 5
> *# ./mysubagent -C -c agentx.conf -f -x /var/agentx/master *
> 2019-02-22 07:23:40 Warning: Failed to connect to the agentx master agent
> (/var/agentx/master):
> 2019-02-22 07:23:45 Warning: Failed to connect to the agentx master agent
> (/var/agentx/master):
> 2019-02-22 07:23:50 Warning: Failed to connect to the agentx master agent
> (/var/agentx/master):
>
> The name of the agentx config file can be agentx.conf or agentx.local.conf
> and it should be in one of this  directories
> $HOME/.snmp
> /usr/etc/snmp
> /usr/lib/snmp
> /usr/share/snmp
> /var/lib/net-snmp
> or you can use the SNMPCONFPATH
>
> AND HERE comes the bug!! Using SNMPCONFPATH or the default path, you will
> get "Warning: Unknown token: agentXPingInterval." and the timeout will be
> set to the default value of 15.
> I will file a bug on this!
> *# SNMPCONFPATH=$PWD ./mysubagent -f -x /var/agentx/master*
> 2019-02-22 07:37:22 /root/snmp-test/agentx.conf: line 2: Warning: Unknown
> token: agentXPingInterval.
> 2019-02-22 07:37:22 Warning: Failed to connect to the agentx master agent
> (/var/agentx/master):
> 2019-02-22 07:37:37 Warning: Failed to connect to the agentx master agent
> (/var/agentx/master):
>
> *# cp agentx.conf $HOME/.snmp/*
> *# ./mysubagent -f -x /var/agentx/master*
> 2019-02-22 07:41:39 /root/.snmp/agentx.conf: line 2: Warning: Unknown
> token: agentXPingInterval.
> 2019-02-22 07:41:39 Warning: Failed to connect to the agentx master agent
> (/var/agentx/master):
> 2019-02-22 07:41:54 Warning: Failed to connect to the agentx master agent
> (/var/agentx/master):
>
> I will check 5.7.3  and be back with more information
>
> Regards
> Anders Wallin
>
>
> On Thu, Feb 21, 2019 at 10:43 PM Mostafa Kassem 
> wrote:
>
>> Thank you for your reply, Anders.
>>
>>
>>
>> I created an agentx.conf file with this single line:
>>
>>
>>
>> agentxPingInterval 5
>>
>>
>>
>>
>>
>> I tried putting agentx.conf into one the following directories to no
>> avail:
>>
>> /var/agentx/
>>
>> /var/snmp/
>>
>> Var/net-snmp/
>>
>>
>>
>> Where should the agentx.conf file go? I did a search on this topic and
>> couldn’t find an answer.
>>
>>
>>
>> It is still 15 seconds of disconnection.
>>
>>
>>
>> Thanks again,
>>
>>
>>
>> Mostafa
>>
>>
>>
>> *From:* Anders Wallin 
>> *Sent:* Thursday, February 21, 2019 2:57 AM
>> *To:* Mostafa Kassem 
>> *Cc:* net-snmp-users@lists.sourceforge.net
>> *Subject:* Re: AgentX reconnect time
>>
>>
>>
>> Hi Mostafa,
>>
>>
>>
>> you need to set it in the config file for your agentx(e.g agentx.conf),
>> not in snmpd.conf
>>
>> Regards
>>
>> Anders Wallin
>>
>>
>>
>>
>>
>> On Thu, Feb 21, 2019 at 1:22 AM Mostafa Kassem 
>> wrote:
>>
>> When we restart the snmpd, the agent detects that the snmpd is no longer
>> running and disconnects, waits 15 seconds and then connects to the snmpd
>> again.
>>
>>  AgentX master disconnected us, reconnecting in 15
>>
>>
>>
>> I would like to reduce this time to 5 seconds.
>>
>>
>>
>> Is this time specifieded in agentXPingInterval  as described here?
>> http://www.net-snmp.org/docs/man/snmpd.conf.html
>>
>>
>>
>> However if I add agentXPingInterval 5 to the snmpd.conf file, I get this
>> error:
>>
>> /var/snmp/snmpd.conf: line 35: Warning: Unknown token:agentXPingInterval.
>>
>>
>>
>> I found this code in agentx_config.c which leads me to believe that this
>> value is hardcoded and not set in any configuration file. So changing it
>> requires editing and recompile of the code.
>>
>>
>>
>> #ifdef USING_AGENTX_SUBAGENT_MODULE
>>
>> /*
>>
>>  * tokens for master agent
>>
>>  */
>>
>> if (SUB_AGENT == agent_role) {
>>
>> /*
>>
>>  * set up callbacks to initiate master agent pings for this
>> session
>>
>>  */
>>
>> netsnmp_ds_register_config(ASN_INTEGER,
>>
>>
>> netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
>>
>>NETSNMP_DS_LIB_APPTYPE),
>>
>>"agentxPingInterval",
>>
>>NETSNMP_DS_APPLICATION_ID,
>>
>>NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL);
>>
>> /* ping and/or reconnect by default every 15 seconds */
>>
>> netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
>>
>>NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 15);
>>
>>
>>
>> }
>>
>> #endif /* USING_AGENTX_SUB

Re: AgentX reconnect time

2019-02-21 Thread Anders Wallin
Hi Mostafa,

which version of net-snmp are you using?
In 5.8 you can use the "-c" option which works, but I also found a bug in
it using the default paths

*# ./mysubagent -h   *
USAGE: ./mysubagent [OPTIONS]

OPTIONS:
  -c FILE[,...] read FILE(s) as configuration file(s)
  -Cdo not read the default configuration files

*# cat agentx.conf *
[snmp] logTimestamp 1
agentXPingInterval 5
*# ./mysubagent -C -c agentx.conf -f -x /var/agentx/master *
2019-02-22 07:23:40 Warning: Failed to connect to the agentx master agent
(/var/agentx/master):
2019-02-22 07:23:45 Warning: Failed to connect to the agentx master agent
(/var/agentx/master):
2019-02-22 07:23:50 Warning: Failed to connect to the agentx master agent
(/var/agentx/master):

The name of the agentx config file can be agentx.conf or agentx.local.conf
and it should be in one of this  directories
$HOME/.snmp
/usr/etc/snmp
/usr/lib/snmp
/usr/share/snmp
/var/lib/net-snmp
or you can use the SNMPCONFPATH

AND HERE comes the bug!! Using SNMPCONFPATH or the default path, you will
get "Warning: Unknown token: agentXPingInterval." and the timeout will be
set to the default value of 15.
I will file a bug on this!
*# SNMPCONFPATH=$PWD ./mysubagent -f -x /var/agentx/master*
2019-02-22 07:37:22 /root/snmp-test/agentx.conf: line 2: Warning: Unknown
token: agentXPingInterval.
2019-02-22 07:37:22 Warning: Failed to connect to the agentx master agent
(/var/agentx/master):
2019-02-22 07:37:37 Warning: Failed to connect to the agentx master agent
(/var/agentx/master):

*# cp agentx.conf $HOME/.snmp/*
*# ./mysubagent -f -x /var/agentx/master*
2019-02-22 07:41:39 /root/.snmp/agentx.conf: line 2: Warning: Unknown
token: agentXPingInterval.
2019-02-22 07:41:39 Warning: Failed to connect to the agentx master agent
(/var/agentx/master):
2019-02-22 07:41:54 Warning: Failed to connect to the agentx master agent
(/var/agentx/master):

I will check 5.7.3  and be back with more information

Regards
Anders Wallin


On Thu, Feb 21, 2019 at 10:43 PM Mostafa Kassem 
wrote:

> Thank you for your reply, Anders.
>
>
>
> I created an agentx.conf file with this single line:
>
>
>
> agentxPingInterval 5
>
>
>
>
>
> I tried putting agentx.conf into one the following directories to no avail:
>
> /var/agentx/
>
> /var/snmp/
>
> Var/net-snmp/
>
>
>
> Where should the agentx.conf file go? I did a search on this topic and
> couldn’t find an answer.
>
>
>
> It is still 15 seconds of disconnection.
>
>
>
> Thanks again,
>
>
>
> Mostafa
>
>
>
> *From:* Anders Wallin 
> *Sent:* Thursday, February 21, 2019 2:57 AM
> *To:* Mostafa Kassem 
> *Cc:* net-snmp-users@lists.sourceforge.net
> *Subject:* Re: AgentX reconnect time
>
>
>
> Hi Mostafa,
>
>
>
> you need to set it in the config file for your agentx(e.g agentx.conf),
> not in snmpd.conf
>
> Regards
>
> Anders Wallin
>
>
>
>
>
> On Thu, Feb 21, 2019 at 1:22 AM Mostafa Kassem 
> wrote:
>
> When we restart the snmpd, the agent detects that the snmpd is no longer
> running and disconnects, waits 15 seconds and then connects to the snmpd
> again.
>
>  AgentX master disconnected us, reconnecting in 15
>
>
>
> I would like to reduce this time to 5 seconds.
>
>
>
> Is this time specifieded in agentXPingInterval  as described here?
> http://www.net-snmp.org/docs/man/snmpd.conf.html
>
>
>
> However if I add agentXPingInterval 5 to the snmpd.conf file, I get this
> error:
>
> /var/snmp/snmpd.conf: line 35: Warning: Unknown token:agentXPingInterval.
>
>
>
> I found this code in agentx_config.c which leads me to believe that this
> value is hardcoded and not set in any configuration file. So changing it
> requires editing and recompile of the code.
>
>
>
> #ifdef USING_AGENTX_SUBAGENT_MODULE
>
> /*
>
>  * tokens for master agent
>
>  */
>
> if (SUB_AGENT == agent_role) {
>
> /*
>
>  * set up callbacks to initiate master agent pings for this
> session
>
>  */
>
> netsnmp_ds_register_config(ASN_INTEGER,
>
>
> netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
>
>NETSNMP_DS_LIB_APPTYPE),
>
>"agentxPingInterval",
>
>NETSNMP_DS_APPLICATION_ID,
>
>NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL);
>
> /* ping and/or reconnect by default every 15 seconds */
>
> netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
>
>NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 15);
>
>
>
> }
>
> #endif /* USING_AGENTX_SUBAGENT_MODULE */
>
>
>
> Thanks,
>
>
>
> Mostafa
>
> ___
> 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
>
>
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the followin

RE: AgentX reconnect time

2019-02-21 Thread Mostafa Kassem
Thank you for your reply, Anders.

I created an agentx.conf file with this single line:

agentxPingInterval 5


I tried putting agentx.conf into one the following directories to no avail:
/var/agentx/
/var/snmp/
Var/net-snmp/

Where should the agentx.conf file go? I did a search on this topic and couldn’t 
find an answer.

It is still 15 seconds of disconnection.

Thanks again,

Mostafa

From: Anders Wallin 
Sent: Thursday, February 21, 2019 2:57 AM
To: Mostafa Kassem 
Cc: net-snmp-users@lists.sourceforge.net
Subject: Re: AgentX reconnect time

Hi Mostafa,

you need to set it in the config file for your agentx(e.g agentx.conf), not in 
snmpd.conf
Regards
Anders Wallin


On Thu, Feb 21, 2019 at 1:22 AM Mostafa Kassem 
mailto:mosta...@danlawinc.com>> wrote:
When we restart the snmpd, the agent detects that the snmpd is no longer 
running and disconnects, waits 15 seconds and then connects to the snmpd again.
 AgentX master disconnected us, reconnecting in 15

I would like to reduce this time to 5 seconds.

Is this time specifieded in agentXPingInterval  as described here?   
http://www.net-snmp.org/docs/man/snmpd.conf.html

However if I add agentXPingInterval 5 to the snmpd.conf file, I get this error:
/var/snmp/snmpd.conf: line 35: Warning: Unknown token:agentXPingInterval.

I found this code in agentx_config.c which leads me to believe that this value 
is hardcoded and not set in any configuration file. So changing it requires 
editing and recompile of the code.

#ifdef USING_AGENTX_SUBAGENT_MODULE
/*
 * tokens for master agent
 */
if (SUB_AGENT == agent_role) {
/*
 * set up callbacks to initiate master agent pings for this session
 */
netsnmp_ds_register_config(ASN_INTEGER,
netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
   NETSNMP_DS_LIB_APPTYPE),
   "agentxPingInterval",
   NETSNMP_DS_APPLICATION_ID,
   NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL);
/* ping and/or reconnect by default every 15 seconds */
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
   NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 15);

}
#endif /* USING_AGENTX_SUBAGENT_MODULE */

Thanks,

Mostafa
___
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
___
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