Hello,
I installed recently the 5.2 release of NetSNMP.
I'm trying to use the perl module, but not as an embedded agent.
Thus, I instantiate an NetSNMP::agent as it follows.

use SNMP;
use NetSNMP::agent;

# SNMP::initMib();                                                            # 
line 1
# SNMP::addMibFiles("/path/to/my/mib/file.txt")           # line 2

my $agent= new NetSNMP::agent(Name => 'myAgent');
$agent->register('myAgent', 'ucdavis', sub { print "In handler\n"; });

my $goOn= 1;

$SIG{'INT'}= sub { $goOn= 0; };

while ($goOn) {
    $agent->agent_check_and_process(0);
    sleep(1);
}

exit(0);

If line 1 and line 2 are set as comments, the agent is correctly launched, and 
it starts to listen for connections on the port specified in the 
$SNMPCONFPATH/myAgent.conf. If I uncomment line 1, or line 2, or both, the 
configuration file $SNMPCONFPATH/myAgent.conf is not read, and the agent starts 
listening on the 161 port (if it can, i.e. if the script is launched as root).

It's a bit odd, and embarrassing. Indeed, if I want to make the agent handle 
requests for an oid which is not in the mib files automatically loaded, I have 
to ask SNMP to load the mib which contains this oid, and thus to use the 
SNMP::addMibFiles function. Doing this, as I wrote it above, apparently 
prevents SNMP to read the $SNMPCONFPATH/myAgent.conf configuration file.

Thanks for your help

Gaël

This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
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

Reply via email to